Bug 273921
Summary: | rename(a,b) does not replace b if a and b are hard linked | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Daphne Shaw <dshaw> | ||||
Component: | kernel | Assignee: | Kernel Maintainer List <kernel-maint> | ||||
Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | low | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 7 | CC: | kzak | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2007-09-04 23:22:59 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Daphne Shaw
2007-09-01 15:44:15 UTC
Created attachment 184541 [details]
Rename syscall problem demonstration
I see this bug has been reassigned to util-linux. Note that I'm filing a bug
against the rename syscall and not the rename command line tool. I only used
to rename command line tool to demonstrate the syscall.
Here is a demonstration program that does not use the rename command line tool.
Note that the rename() succeeds, but leaves both "foo" and "bar" behind.
Posix spec says this is correct: "If the old argument and the new argument resolve to the same existing file, rename() shall return successfully and perform no other action." I disagree (as do the BSD people, it seems, as rename() there works the other way). The Posix language does indeed say what you quoted, however, it also adds some clarifying language to the bit you quoted in the Rationale section: The specification that if old and new refer to the same file is intended to guarantee that: rename("x", "x"); does not remove the file. The clarification makes sense (renaming something to the same name doesn't make sense). Renaming something to another name does make sense, and it's very odd that it wouldn't work just because the files happened to be linked to each other. Names have nothing to do with the links. |