Bug 1216296
Summary: | rm-rf does not follow symlinks | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Hu Zhang <huzhan> | ||||
Component: | libguestfs | Assignee: | Pino Toscano <ptoscano> | ||||
Status: | CLOSED DUPLICATE | QA Contact: | Virtualization Bugs <virt-bugs> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 6.7 | CC: | leiwang, linl, ptoscano, wshi, xchen | ||||
Target Milestone: | rc | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2016-02-01 07:28:05 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: | 1301844 | ||||||
Attachments: |
|
virt-sysprep in the ends uses the rm-rf API, which just runs "rm -rf" from the appliance (outside the /sysroot chroot). The problem seems to be there, as it does not follow symlinks at all, neither absolute (like the provided example) nor relative. This can be easily reproduced with: $ guestfish -N fs <<EOF mount /dev/sda1 / mkdir /dir-abs mkdir /dir-rel touch /file-abs touch /file-rel ln-s /dir-abs /link-abs ln-s dir-rel /link-rel ln-s /file-abs /link-file-abs ln-s file-rel /link-file-rel ll / rm-rf /link-abs rm-rf /link-rel rm-rf /link-file-abs rm-rf /link-file-rel ll / EOF If the bug is fixed, then second ll output will show only lost+found; if not, it will show also the two dir-abs and dir-rel directories and the two file-abs and file-rel files. This fails for me everywhere (RHEL 6, RHEL 7, upstream too). (In reply to Hu Zhang from comment #0) > virt-sysprep with '--delete' option fails to delete the symbolic link to a > directory. It can delete the symbolic link to a file. This works well in > rhel7.1. I tried and it fails the same way for me also in RHEL 7 and upstream. Can you please explain a bit more what test did you do? I'm not really convinced this is a bug. Ordinary 'rm' on the host doesn't follow symlinks either. Created attachment 1111339 [details]
log for virt-sysprep --delete
log for virt-sysprep --delete
(In reply to Richard W.M. Jones from comment #3) > I'm not really convinced this is a bug. Ordinary 'rm' on the host > doesn't follow symlinks either. I tried in guestfish and found that you can only use "rm-rf /home/testdir_link" to delete the symlink (it's same as the host): $ guestfish -a RHEL-Server-6.7-32-hvm.raw -i ><fs> rm-rf /home/testdir_link/ ><fs> ls /home/ testdir testdir_link ><fs> rm-rf /home/testdir_link ><fs> ls /home/ testdir So,I think the problem is, It should call "rm_rf /home/testdir_link" instead of "rm_rf /home/testdir_link/" when using:" virt-sysprep --delete /home/testdir_link -a $img" Please refer to the detailed log attached. *** Bug 1293271 has been marked as a duplicate of this bug. *** *** This bug has been marked as a duplicate of bug 1293271 *** (In reply to Xianghua Chen from comment #8) > > *** This bug has been marked as a duplicate of bug 1293271 *** I'm not sure this is the case: this bug is just part of what bug 1293271 describes (and part of that can affect also upstream versions), so fixing bug 1293271 would not fix this one. Also, per comment #3 this might not be a bug at all. (In reply to Pino Toscano from comment #9) > (In reply to Xianghua Chen from comment #8) > > > > *** This bug has been marked as a duplicate of bug 1293271 *** > > I'm not sure this is the case: this bug is just part of what bug 1293271 > describes (and part of that can affect also upstream versions), so fixing > bug 1293271 would not fix this one. > > Also, per comment #3 this might not be a bug at all. I closed it as duplicate because the steps and the problem of the two bug were exactly the same, but this one may be has an confused subject, because the rm actually acts the same as on the host as described in comment #3 . So, the problem is not about rm , please refer to comment #6. |
Description of problem: virt-sysprep with '--delete' option fails to delete the symbolic link to a directory. It can delete the symbolic link to a file. This works well in rhel7.1. Version-Release number of selected component (if applicable): libguestfs-1.20.11-14.el6.x86_64 libguestfs-tools-c-1.20.11-14.el6.x86_64 How reproducible: Always Steps to Reproduce: 1. Get a rhel image. 2. Start the guest and create a directory and a soft link point to it ... ><fs> mkdir /home/testdir ><fs> ln-s /home/testdir /home/testdir_link 3. delete the testdir_link # virt-sysprep --delete /home/testdir_link -a $img 4. Chech in guest # guestfish -a $img -i glob-expand '/home/testdir_link' Actual results: Step 4, it returns: # guestfish -a $img -i glob-expand '/home/testdir_link' /home/testdir_link/ Expected results: The symbolic link to the /home/testdir should be deleted successfully. Additional info: