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
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
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).
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
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.