Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
"tar" option "--directory" no longer ignored
Previously, the "--directory" option of the "tar" command was ignored when used in combination with the "--remove-files" option. As a consequence, files in the current working directory were removed instead of the files in the directory specified by the "--directory" option. To fix this bug, new functions and an attribute that retrieve, store, and act upon the "--directory" option have been added. As a result, files are now correctly removed from the directory specified by the "--directory" option.
Description of problem:
Tar does not honor --directory option for --remove-files, it tries to remove files in the current working directory instead.
Version-Release number of selected component (if applicable):
tar-1.26-29.el7.x86_64
How reproducible:
always
Steps to Reproduce:
1. cd $HOME
2. rm -f tartest.tar
3. mkdir -p indirectdir/test
4. touch indirectdir/test/afile
5. tar --remove-files --append --atime-preserve --directory $HOME/indirectdir --mode 444 --file $HOME/tartest.tar test/afile
6. ls indirectdir/test/afile
Actual results:
ls indirectdir/test/afile
shows the file still exists
Expected results:
ls: indirectdir/test/afile: No such file or directory
Additional info:
tar-1.15.1-32.el5_8 in RHEL 5 and tar-1.23-14.el6.x86_64 in RHEL 6 work as expected
strace in RHEL 6 (similar in RHEL 5) shows:
getcwd("/home/user/indirectdir", 4096) = 26
write(3, "test/afile\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 10240) = 10240
clock_gettime(CLOCK_REALTIME, {1458573540, 334576437}) = 0
clock_gettime(CLOCK_REALTIME, {1458573540, 334595612}) = 0
close(3) = 0
unlink("/home/user/indirectdir/test/afile") = 0
close(1) = 0
close(2) = 0
exit_group(0) = ?
+++ exited with 0 +++
strace in RHEL 7:
getcwd("/home/user", 4096) = 14
write(3, "test/afile\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 10240) = 10240
close(3) = 0
unlinkat(4, "/home/user/test/afile", 0) = -1 ENOENT (No such file or directory)
close(1) = 0
close(2) = 0
exit_group(0) = ?
+++ exited with 0 +++
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHBA-2017:2012
Description of problem: Tar does not honor --directory option for --remove-files, it tries to remove files in the current working directory instead. Version-Release number of selected component (if applicable): tar-1.26-29.el7.x86_64 How reproducible: always Steps to Reproduce: 1. cd $HOME 2. rm -f tartest.tar 3. mkdir -p indirectdir/test 4. touch indirectdir/test/afile 5. tar --remove-files --append --atime-preserve --directory $HOME/indirectdir --mode 444 --file $HOME/tartest.tar test/afile 6. ls indirectdir/test/afile Actual results: ls indirectdir/test/afile shows the file still exists Expected results: ls: indirectdir/test/afile: No such file or directory Additional info: tar-1.15.1-32.el5_8 in RHEL 5 and tar-1.23-14.el6.x86_64 in RHEL 6 work as expected strace in RHEL 6 (similar in RHEL 5) shows: getcwd("/home/user/indirectdir", 4096) = 26 write(3, "test/afile\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 10240) = 10240 clock_gettime(CLOCK_REALTIME, {1458573540, 334576437}) = 0 clock_gettime(CLOCK_REALTIME, {1458573540, 334595612}) = 0 close(3) = 0 unlink("/home/user/indirectdir/test/afile") = 0 close(1) = 0 close(2) = 0 exit_group(0) = ? +++ exited with 0 +++ strace in RHEL 7: getcwd("/home/user", 4096) = 14 write(3, "test/afile\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 10240) = 10240 close(3) = 0 unlinkat(4, "/home/user/test/afile", 0) = -1 ENOENT (No such file or directory) close(1) = 0 close(2) = 0 exit_group(0) = ? +++ exited with 0 +++