Bug 1001875 - Argument 'excludes' of tar-out does not work
Argument 'excludes' of tar-out does not work
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs (Show other bugs)
7.0
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-27 22:53 EDT by bfan
Modified: 2014-06-17 22:01 EDT (History)
2 users (show)

See Also:
Fixed In Version: libguestfs-1.22.6-5.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 06:04:29 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description bfan 2013-08-27 22:53:34 EDT
Description of problem:
Argument 'excludes' of tar-out does not work


Version-Release number of selected component (if applicable):
libguestfs-1.22.6-4.el7.x86_64


How reproducible:
Always


Steps to Reproduce:
# guestfish -a test1.img -m /dev/sda1

><fs> ll /
total 17
drwxr-xr-x  3 root root  1024 Aug 22 11:05 .
drwxr-xr-x 23 root root  4096 Aug 22 11:02 ..
-rw-r--r--  1 root root     0 Aug 22 11:05 hello.c
-rw-r--r--  1 root root     0 Aug 22 11:05 helloworld.c
drwx------  2 root root 12288 Aug 21 16:39 lost+found
-rw-r--r--  1 root root     0 Aug 22 11:05 world.c

><fs> tar-out / /tmp/excludes1 excludes:"hello*"
><fs> tar-out / /tmp/excludes2 excludes:"hello.*"
><fs> tar-out / /tmp/excludes3 excludes:"hello.c"


# tar tvf /tmp/excludes1
drwxr-xr-x root/root         0 2013-08-22 11:05 ./
-rw-r--r-- root/root         0 2013-08-22 11:05 ./hello.c
-rw-r--r-- root/root         0 2013-08-22 11:05 ./helloworld.c
drwx------ root/root         0 2013-08-21 16:39 ./lost+found/
-rw-r--r-- root/root         0 2013-08-22 11:05 ./world.c

# tar tvf /tmp/excludes2
drwxr-xr-x root/root         0 2013-08-22 11:05 ./
-rw-r--r-- root/root         0 2013-08-22 11:05 ./hello.c
-rw-r--r-- root/root         0 2013-08-22 11:05 ./helloworld.c
drwx------ root/root         0 2013-08-21 16:39 ./lost+found/
-rw-r--r-- root/root         0 2013-08-22 11:05 ./world.c

# tar tvf /tmp/excludes3
drwxr-xr-x root/root         0 2013-08-28 10:37 ./
-rw-r--r-- root/root         0 2013-08-28 10:35 ./hello.c
-rw-r--r-- root/root         0 2013-08-28 10:35 ./helloworld.c
drwx------ root/root         0 2013-08-28 10:35 ./lost+found/
-rw-r--r-- root/root         0 2013-08-28 10:35 ./world.c


Actual results:
The matched files are still included in tar package


Expected results:
The matched files are not included in tar package


Additional info:
Has same issue in RHEL6, libguestfs-1.20.10-3.el6.x86_64
Comment 1 Richard W.M. Jones 2013-08-29 08:45:25 EDT
This is actually user error (it wasn't obvious, even to me).

If you write:

><fs> tar-out / /tmp/excludes1 excludes:"hello*"

then the list of strings passed to libguestfs is:

[ "\"hello*\"" ]

ie. the quotes are included in the string.  libguestfs
correctly passes this, quoting and everything, to the
tar command.

The correct command is:

><fs> tar-out / /tmp/excludes1 "excludes:hello*"

or you can omit the quotes (in this case).

Nevertheless, I've make the use of the optional excludes
pattern more robust, and also added a regression test:

https://github.com/libguestfs/libguestfs/commit/91c162586cc2170ea224016307016153f3d081b5
https://github.com/libguestfs/libguestfs/commit/1b34d6171bb4aaa1134a9d867918d7163cc7e069
Comment 2 Richard W.M. Jones 2013-08-29 10:22:40 EDT
Fix also included in libguestfs-1.20.10-4.el6 (note
there is no separate bug for RHEL 6, I just included
the fix in the routine build).
Comment 4 bfan 2013-12-04 00:46:31 EST
Verified with libguestfs-1.22.6-16.el7.x86_64

><fs> ll /
total 4
drwxr-xr-x  2 root root   53 Dec  4 13:36 .
drwxr-xr-x 23 root root 4096 Dec  4 13:35 ..
-rw-r--r--  1 root root    0 Dec  4 13:36 hello.c
-rw-r--r--  1 root root    0 Dec  4 13:36 helloworld.c
-rw-r--r--  1 root root    0 Dec  4 13:36 world.c

><fs> tar-out / /tmp/excludes1 excludes:hello*
><fs> tar-out / /tmp/excludes2 "excludes:hello*"

[root@]# tar tvf /tmp/excludes1
drwxr-xr-x root/root         0 2013-12-04 13:36 ./
-rw-r--r-- root/root         0 2013-12-04 13:36 ./world.c
[root@]# tar tvf /tmp/excludes2
drwxr-xr-x root/root         0 2013-12-04 13:36 ./
-rw-r--r-- root/root         0 2013-12-04 13:36 ./world.c


It works with two ways
Comment 5 Ludek Smid 2014-06-13 06:04:29 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

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