Bug 1293271
Summary: | virt-sysprep --delete fails to delete a symbolic link to a dir | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Xianghua Chen <xchen> | ||||
Component: | libguestfs | Assignee: | Pino Toscano <ptoscano> | ||||
Status: | CLOSED WONTFIX | QA Contact: | Virtualization Bugs <virt-bugs> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 6.8 | CC: | leiwang, linl, ptoscano, rjones, wshi, xchen | ||||
Target Milestone: | rc | Keywords: | Reopened | ||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2017-11-13 14:02:14 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: |
|
Description
Xianghua Chen
2015-12-21 09:34:52 UTC
*** This bug has been marked as a duplicate of bug 1216296 *** I'm unduplicating this, because it doesn't really have anything to do with the rm-rf API. What happens is that we call glob_expand first, and that API returns the path with trailing "/": libguestfs: trace: glob_expand "/home/testdir_link" libguestfs: trace: glob_expand = ["/home/testdir_link/"] libguestfs: trace: rm_rf "/home/testdir_link/" What's interesting is: (1) This does not happen upstream. Upstream, the virt-sysprep --delete option does not support globbing at all, which I think may be an accidental regression. (2) This does not happen in upstream 1.20 either. It only happens in RHEL 6 because we backported the following commits: https://github.com/libguestfs/libguestfs/commit/405263ab9642bb025b5af699de1b1599f7b0ffce https://github.com/libguestfs/libguestfs/commit/3bebe598abaa490c6f0743b8fb0447e113913ac3 (The second commit is just a doc change). (In reply to Richard W.M. Jones from comment #2) > I'm unduplicating this, because it doesn't really have > anything to do with the rm-rf API. > > What happens is that we call glob_expand first, and that API > returns the path with trailing "/": > > libguestfs: trace: glob_expand "/home/testdir_link" > libguestfs: trace: glob_expand = ["/home/testdir_link/"] > libguestfs: trace: rm_rf "/home/testdir_link/" > > What's interesting is: > > (1) This does not happen upstream. Upstream, the virt-sysprep > --delete option does not support globbing at all, which I think > may be an accidental regression. > > (2) This does not happen in upstream 1.20 either. > > It only happens in RHEL 6 because we backported the following > commits: > > https://github.com/libguestfs/libguestfs/commit/ > 405263ab9642bb025b5af699de1b1599f7b0ffce > https://github.com/libguestfs/libguestfs/commit/ > 3bebe598abaa490c6f0743b8fb0447e113913ac3 > > (The second commit is just a doc change). Yes, I agree with you, it has nothing to do with rm-rf API, but I looked into the steps of the bug 1216296, it's actually the same. So I duplicate it because they are the same problem, may be the subject of bug 1216296 is not proper. I'll close the bug 1216296 as duplicate if it confused you. The situation described in this bug is actually a bit more convoluted than it seems: (1) --delete in RHEL 7 and upstream does not support globbing; this has been introduced during the creation of virt-customize, when virt-sysprep has been changed to use the customize operations, losing the globbing feature of --delete (2) when globbing is used, glob_expand returns paths with trailing slash, and `rm -rf dir-symlink/` does not work; this happens because in the glob_expand implementation we pass GLOB_MARK to glob() (3) `rm -rf dir-symlink/` does not remove that symlink to a directory (whereas without the slash it works); this is also bug #1216296 So: - regarding (1): implementing globbing for --delete is trivial, but then it would introduce (2) upstream as well - removing GLOB_MARK from the flags of glob() fixes (2), although that may break users of the glob_expand API (i.e. those relying on directories ending with slash, and not appending it by themselves) *** Bug 1216296 has been marked as a duplicate of this bug. *** I'm closing this as WONTFIX for a couple of reasons: (1) RHEL 6 is in production phase 3. (2) This wasn't reported by a customer. Note that this does not mean this is not a bug, just that we are not going to fix it in RHEL 6. |