Bug 1216177 - rlFileBackup --clean can corrupt files
Summary: rlFileBackup --clean can corrupt files
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: beakerlib
Version: 22
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
Assignee: Dalibor Pospíšil
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1173652 Fedora-beakerlib
TreeView+ depends on / blocked
 
Reported: 2015-04-28 16:55 UTC by Alois Mahdal
Modified: 2015-12-08 08:45 UTC (History)
6 users (show)

Fixed In Version: beakerlib-1.11-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-08 08:45:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Patch, version A (1.04 KB, patch)
2015-04-28 17:09 UTC, Alois Mahdal
no flags Details | Diff
Patch, version B (1023 bytes, patch)
2015-04-28 17:09 UTC, Alois Mahdal
no flags Details | Diff
test case tarball (1.67 KB, application/x-gzip)
2015-04-28 17:32 UTC, Alois Mahdal
no flags Details

Description Alois Mahdal 2015-04-28 16:55:23 UTC
Description of problem
======================

rlFileBackup can corrupt user's files.

If rlFileBackup

 *  is called with --clean
 *  and more than 2 arguments,
 *  and DEBUG is set to 1,

then part of message from rlLogDebug around line 600 of infrastructure.sh
will be written to *second* of files that are to be backed up.


Version-Release number of selected component
============================================

beakerlib-1.10-2.el6eso.noarch


How reproducible
================

Always


Steps to Reproduce
==================

rlFileBackup --clean arg1 arg2 arg3


Actual results
==============

A partial debug message gets written to arg2 file before backing up.


Expected results
================

All three files untouched (backed up verbatim)


Additional info
===============

Apparently this stems from the use of '$@' in the call.  In Bash, with
three arguments, say, "a", "b", and "c":

    "foo $@ bar"

is interpreted as

    "foo a" "b" "c bar"

i.e. three arguments in case of the mentioned *rlrlLogDebug* call.
Looking at *rlLogDebug* and its backend *rlLog*, the above example
would mean

    "log 'foo a' to file 'b' with priority 'c bar'"

With 2 arguments the problem is just more subtle:

    "log 'foo a' to file 'b bar'"

that is, lost debug message and dropping debris to $PWD.


Proposed fix
============

One could simply replace rhe `$@` with `$*` (which does not split the
final string into arguments), but the resulting message does not seem
to be a little confusing:

    "Adding 'a b c' to the clean list"

Therefore I moved the debug message to the nearby for loop so that N
messages (among others) get emitted:

    "Adding 'a' to the clean list"
    "Adding 'b' to the clean list"
    "Adding 'c' to the clean list"

I'm including both patches, though.

Comment 1 Alois Mahdal 2015-04-28 17:09:06 UTC
Created attachment 1019807 [details]
Patch, version A

Comment 2 Alois Mahdal 2015-04-28 17:09:35 UTC
Created attachment 1019808 [details]
Patch, version B

Comment 3 Alois Mahdal 2015-04-28 17:32:55 UTC
Created attachment 1019810 [details]
test case tarball

Comment 4 Dalibor Pospíšil 2015-04-29 07:18:40 UTC
That's really good point. Thanks for report and patch.

Comment 6 Fedora Update System 2015-11-03 12:41:17 UTC
beakerlib-1.11-1.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-f36ff57e84

Comment 7 Fedora Update System 2015-11-03 18:20:52 UTC
beakerlib-1.11-1.fc21 has been pushed to the Fedora 21 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update beakerlib'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-4c96e73472

Comment 8 Fedora Update System 2015-11-03 18:56:16 UTC
beakerlib-1.11-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update beakerlib'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-ba802d1bd6

Comment 9 Fedora Update System 2015-11-03 19:52:21 UTC
beakerlib-1.11-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update beakerlib'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-7ab9feeb42

Comment 10 Fedora Update System 2015-11-03 21:50:10 UTC
beakerlib-1.11-1.el5 has been pushed to the Fedora EPEL 5 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'yum --enablerepo=epel-testing update beakerlib'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-0e03df1475

Comment 11 Fedora End Of Life 2015-11-04 16:00:01 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 12 Alois Mahdal 2015-11-04 19:18:19 UTC
Still relevant in FC22; in fact the fix is being tested by now.

Comment 13 Fedora Update System 2015-11-05 17:19:17 UTC
beakerlib-1.11-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'yum --enablerepo=epel-testing update beakerlib'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-8f65d5290a

Comment 14 Fedora Update System 2015-11-05 20:18:11 UTC
beakerlib-1.11-1.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'yum --enablerepo=epel-testing update beakerlib'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-f36ff57e84

Comment 15 Fedora Update System 2015-11-17 15:51:54 UTC
beakerlib-1.11-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2015-11-17 18:23:48 UTC
beakerlib-1.11-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 17 Fedora Update System 2015-11-19 16:50:03 UTC
beakerlib-1.11-1.el5 has been pushed to the Fedora EPEL 5 stable repository. If problems still persist, please make note of it in this bug report.

Comment 18 Fedora Update System 2015-11-20 23:24:51 UTC
beakerlib-1.11-1.fc21 has been pushed to the Fedora 21 stable repository. If problems still persist, please make note of it in this bug report.

Comment 19 Fedora Update System 2015-11-21 14:26:06 UTC
beakerlib-1.11-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.

Comment 20 Fedora Update System 2015-11-21 20:29:58 UTC
beakerlib-1.11-1.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.