Bug 1293516 - rm-rf can not delete files and dirs in symbolic link dir
rm-rf can not delete files and dirs in symbolic link dir
Status: NEW
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
unspecified
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-12-21 21:15 EST by Xianghua Chen
Modified: 2016-05-16 00:26 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
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 Xianghua Chen 2015-12-21 21:15:13 EST
Description of problem:
rm-rf  can not delete files and dirs in symbolic link dir and there is no error prompted.

Version-Release number of selected component (if applicable):
libguestfs-1.20.11-16.el6.x86_64

How reproducible:


Steps to Reproduce:
1. Prepare a image: RHEL-Server-6.7-32-hvm.raw
2. # guestfish -a RHEL-Server-6.7-32-hvm.raw -i
><fs> mkdir /home/testdir
><fs> ln-s /home/testdir/ /home/testdir_link
><fs> touch /home/testdir_link/file1
><fs> mkdir /home/testdir_link/subdir
><fs> trace 1
><fs> verbose 1
><fs> glob rm-rf /home/testdir_link/*
libguestfs: trace: glob_expand "/home/testdir_link/*"
libguestfs: send_to_daemon: 68 bytes: 00 00 00 40 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 71 | 00 00 00 00 | ...
guestfsd: main_loop: new request, len 0x40
guestfsd: main_loop: proc 113 (glibguestfs: recv_from_daemon: 104 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 71 | 00 00 00 01 | 00 12 34 96 | ...
libguestfs: trace: glob_expand = ["/home/testdir_link/file1", "/home/testdir_link/subdir/"]
libguestfs: trace: rm_rf "/home/testdir_link/file1"
libguestfs: send_to_daemon: 72 bytes: 00 00 00 44 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 1f | 00 00 00 00 | ...
lob_expand) took 0.00 seconds
guestfsd: main_loop: new request, len 0x44
rm -rf /sysroot/home/testdir_link/file1
libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 1f | 00 00 00 01 | 00 12 34 97 | ...
libguestfs: trace: rm_rf = 0
libguestfs: trace: rm_rf "/home/testdir_link/subdir/"
libguestfs: send_to_daemon: 76 bytes: 00 00 00 48 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 1f | 00 00 00 00 | ...
guestfsd: main_loop: proc 31 (rm_rf) took 0.00 seconds
guestfsd: main_loop: new request, len 0x48
rm -rf /sysroot/home/testdir_link/subdir/
libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 1f | 00 00 00 01 | 00 12 34 98 | ...
libguestfs: trace: rm_rf = 0

><fs> ls /home/testdir_link/
file1
subdir

p.s.: You can not delete them by "rm-rf /home/testdir_link/file1" & "rm-rf /home/testdir_link/subdir" either.

3. Then I tried to delete the contents from the source dir, it's can be deleted.
><fs> glob rm-rf /home/testdir/*
libguestfs: trace: glob_expand "/home/testdir/*"
libguestfs: send_to_daemon: 64 bytes: 00 00 00 3c | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 71 | 00 00 00 00 | ...
guestfsd: main_loop: new request, len 0x3c
guestfsd: main_loop: proc 113 (glob_expand) took 0.00 seconds
libguestfs: recv_from_daemon: 96 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 71 | 00 00 00 01 | 00 12 34 9a | ...
libguestfs: trace: glob_expand = ["/home/testdir/file1", "/home/testdir/subdir/"]
libguestfs: trace: rm_rf "/home/testdir/file1"
libguestfs: send_to_daemon: 68 bytes: 00 00 00 40 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 1f | 00 00 00 00 | ...
guestfsd: main_loop: new request, len 0x40
rm -rf /sysroot/home/testdir/file1
libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 1f | 00 00 00 01 | 00 12 34 9b | ...
libguestfs: trace: rm_rf = 0
libguestfs: trace: rm_rf "/home/testdir/subdir/"
libguestfs: send_to_daemon: 72 bytes: 00 00 00 44 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 1f | 00 00 00 00 | ...
guestfsd: main_loop: proc 31 (rm_rf) took 0.00 seconds
guestfsd: main_loop: new request, len 0x44
rm -rf /sysroot/home/testdir/subdir/
guestfsd: main_loop: proc 31 (rm_rf) took 0.00 seconds
libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 1f | 00 00 00 01 | 00 12 34 9c | ...
libguestfs: trace: rm_rf = 0

><fs> ls /home/testdir_link/

The contents are all deleted.


Actual results:
At step 2 , the contents cannot be deleted.

Expected results:
It can delete all the contents  at step 2 & 3.

Additional info:
1. On RHEL7.2(libguestfs-1.28.1-55.el7.x86_64) , there is the same problem.
Comment 1 Xianghua Chen 2015-12-21 21:18:20 EST
How reproducible:
100%
Comment 2 Richard W.M. Jones 2016-01-04 08:18:55 EST
The one line reproducer for this is:

guestfish -N fs -m /dev/sda1 mkdir /dir : ln-s /dir/ /link : touch /link/file1 : mkdir /link/subdir : glob rm-rf /link/* : ls /link/

Upstream, this also fails (ie. the final 'ls' prints out the two
files which are supposed to have been deleted).

OT: It would be very helpful if you could concentrate on testing
RHEL 7.3 and/or upstream, since libguestfs in RHEL 6 is mostly in
maintenance mode.  We're only making very important fixes to RHEL 6,
and so bugs like this will just be closed / WONTFIX, not because they
are not bugs, but because they are not very serious for RHEL 6.  It
is for this reason that I'm moving this bug to upstream.
Comment 3 Xianghua Chen 2016-01-05 00:54:00 EST
Yeah, I'll trace this bug upstream.
I also have reproduced this bug on Fedora 23 with libguestfs-1.30.5-2.fc23.x86_64, it failed too.

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