Bug 980445

Summary: rlFileRestore does not handle --clean while namespace is used
Product: [Fedora] Fedora Reporter: Dalibor Pospíšil <dapospis>
Component: beakerlibAssignee: Dalibor Pospíšil <dapospis>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 20CC: amahdal, dspurek, jjelen, ksrot, pmuller, psplicha
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: beakerlib-1.9-3.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 984675 (view as bug list) Environment:
Last Closed: 2014-07-30 06:57:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1116308, 1116317    
Attachments:
Description Flags
rlFileBackup-and-rlFileRestore-namespaces-fix
none
fixed patch
none
test if namespaced backups "clean too much"
none
log from failed test
none
log from passed test none

Description Dalibor Pospíšil 2013-07-02 11:45:53 UTC
Created attachment 767694 [details]
rlFileBackup-and-rlFileRestore-namespaces-fix

rlFileBackup and rlFileRestore does not correctly handle namespaces if --clean option is used.
This cause the last rlFileRestore, no matter what namespace, do the clean (rm -rf) on all backed up locations.

Included patch solves this issue.

Comment 1 David Spurek 2013-07-02 11:58:28 UTC
Tests that use rlFileBackup --clean with more namespaces are destructive due to this bug.

Comment 2 Dalibor Pospíšil 2013-07-10 13:38:23 UTC
The $namespace should be replaced by $(echo -n "$namespace" | od -A n -t x1 -v | tr -d ' ') in the patch to prevent unwanted characters in variable names.

Petr, this is really crucial thing to allow usage of the namespaces with --clean. Could you include this patch ASAP in at least in testing beakerlib?

Comment 3 Dalibor Pospíšil 2013-07-10 14:19:13 UTC
Created attachment 771650 [details]
fixed patch

Adding fixed patch.

Comment 4 Petr Muller 2013-07-10 14:54:41 UTC
I do not plan to do new RPMs anytime soon. I fail to see how this is urgent and crucial.

Comment 6 Dalibor Pospíšil 2013-08-05 09:25:13 UTC
We have discovered an issue in the patch.
line:
eval $tmp="\$$tmp\n\$file"

should be replaced by:
eval $tmp="\$$tmp\\\n\$file"

Since eval breaks the backslash before the new line character.

To be more precise even the double-quotes should be escaped but there should not be any whitespace in it so it is not necessary.

Comment 7 Dalibor Pospíšil 2013-09-10 10:00:05 UTC
Hi Peter, is there any progress on it?

Comment 8 Petr Muller 2013-09-10 12:04:54 UTC
No. I would have updated this BZ otherwise.

Comment 9 Fedora End Of Life 2013-09-16 16:45:25 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 20 development cycle.
Changing version to '20'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora20

Comment 10 Karel Srot 2014-01-15 16:29:04 UTC
Hi Peter, is there anything we can do to get this patch into the beakerlib any time soon?  Thank you.

Comment 11 Dalibor Pospíšil 2014-03-06 16:13:43 UTC
code fixed by https://git.fedorahosted.org/cgit/beakerlib.git/commit/?id=44b8f7c306e4c1e7f4a147fc7dc599422fe7b887

Code is now ready for release in git.

Comment 12 Alois Mahdal 2014-06-09 20:09:47 UTC
This bug is still present in beakerlib-1.8-4.fc20.noarch and others (el6, el7...).

Is there a release planned that would contain the fix?  Let me know if I can help.

Comment 13 Alois Mahdal 2014-06-09 20:12:19 UTC
Created attachment 906135 [details]
test if namespaced backups "clean too much"

Comment 14 Fedora Update System 2014-06-17 13:41:45 UTC
beakerlib-1.9-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/beakerlib-1.9-1.fc20

Comment 15 Fedora Update System 2014-06-17 23:29:16 UTC
Package beakerlib-1.9-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing beakerlib-1.9-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-7442/beakerlib-1.9-1.fc20
then log in and leave karma (feedback).

Comment 16 Alois Mahdal 2014-06-18 11:35:38 UTC
Sorry but rlBackup/rlRestore still fail.  Excerpt from running the test I have attached:


    :: [  BEGIN   ] :: compare results :: actually running 'diff -u ORIG POST'
    --- ORIG	2014-06-18 13:26:08.384142718 +0200
    +++ POST	2014-06-18 13:26:08.811146452 +0200
    @@ -1,4 +1,6 @@
     dir1
     dir2
    +dir2/trash
     dirA
     dirB
    +dirB/trash
    :: [   FAIL   ] :: compare results (Expected 0, got 1)


Note that there are some messages evoked during rlFileBackup (shouldn't they cause failure of the backup?):


    :: [  BEGIN   ] :: save original state :: actually running 'lsall > ORIG'
    :: [   PASS   ] :: save original state (Expected 0, got 0)
    [GENERIC]
    bnvtymvycwo. = ZGlyMQo=

    bstor: PUT needs exactly three arguments (command, key, value)
    [GENERIC]
    bnvtymvycwo. = ZGlyMQo=
    bgv0dgvycwo. = ZGlyQQo=

    bstor: PUT needs exactly three arguments (command, key, value)
    :: [  BEGIN   ] :: Running 'mktrash'

Comment 17 Alois Mahdal 2014-06-18 11:53:55 UTC
Created attachment 909983 [details]
log from failed test

Comment 18 Dalibor Pospíšil 2014-06-19 08:25:38 UTC
Actually it is bug in the new part behind this.

fixed by https://git.fedorahosted.org/cgit/beakerlib.git/commit/?id=32a0abbee3f5d4b0f167783c7e1b1cc9fce205e2

Comment 19 Fedora Update System 2014-07-02 08:01:26 UTC
beakerlib-1.9-2.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/beakerlib-1.9-2.fc20

Comment 20 Fedora Update System 2014-07-03 04:03:01 UTC
Package beakerlib-1.9-2.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing beakerlib-1.9-2.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-7998/beakerlib-1.9-2.fc20
then log in and leave karma (feedback).

Comment 21 Jakub Jelen 2014-07-03 06:59:07 UTC
Created attachment 914363 [details]
log from passed test

Current version in Rawhide (beakerlib-1.9-2.fc21.noarch) seems to work - attached test PASSes for me on Rawhide (see log).

But since we use test /distribution/system/setup PHASE=workarounds, current check doesn't work anymore and we are getting errors [1]. According to this I propose to update this test to patch only version 1.8 (I hope we don't use any older version somewhere). This patch should make it:
http://pastebin.test.redhat.com/219360

[1] https://beaker.engineering.redhat.com/recipes/1409888#task22184555

Comment 22 Dalibor Pospíšil 2014-07-03 08:26:53 UTC
(In reply to Jakub Jelen from comment #21)
> Created attachment 914363 [details]
> log from passed test
> 
> Current version in Rawhide (beakerlib-1.9-2.fc21.noarch) seems to work -
> attached test PASSes for me on Rawhide (see log).
> 
> But since we use test /distribution/system/setup PHASE=workarounds, current
> check doesn't work anymore and we are getting errors [1]. According to this
> I propose to update this test to patch only version 1.8 (I hope we don't use
> any older version somewhere). This patch should make it:
> http://pastebin.test.redhat.com/219360
> 
> [1] https://beaker.engineering.redhat.com/recipes/1409888#task22184555

Thanks for that. I have fixed workarounds.

Comment 23 Dalibor Pospíšil 2014-07-04 08:50:59 UTC
Please consider the package fixing this bug available in Fedora stable repos once bz1116308 is closed and RHEL stable repos once bz1116317 is closed.

Fixed in:
beakerlib-1.9-2.fc19
beakerlib-1.9-2.fc20
beakerlib-1.9-2.fc21
beakerlib-1.9-3.el5
beakerlib-1.9-2.el6
beakerlib-1.9-2.el7

Comment 24 Fedora Update System 2014-07-17 13:15:46 UTC
beakerlib-1.9-3.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/beakerlib-1.9-3.fc20

Comment 25 Fedora Update System 2014-07-30 06:57:17 UTC
beakerlib-1.9-3.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.