#2169 new defect

rename(2) does not allow destination file to exist, contravenes POSIX and RTEMS documentation

Reported by: Nick Withers Owned by: Chris Johns
Priority: highest Milestone: Indefinite
Component: fs Version:
Severity: normal Keywords: POSIX-Compliance
Cc: sebastian.huber@…, gedare@… Blocked By:

Description (last modified by Gedare Bloom)

The rename(2) call is required by POSIX to allow the destination file to already exist: "If the link named by the new argument exists, it shall be removed and old renamed to new" ( http://pubs.opengroup.org/onlinepubs/009695399/functions/rename.html ).

RTEMS documentation at http://rtems.org/onlinedocs/doc-current/share/rtems/html/posix_users/Files-and-Directories-Manager-rename-_002d-Renames-a-file.html suggests this is implemented: "If a file already exists by the name new, it is removed", but also reserves error code EEXIST "The named file already exists".

Testing with a rename of a file (on JFFS2) failed with EEXIST.

Attachments (1)

posix1003.1.patch (1.7 KB) - added by Nick Withers on Feb 17, 2014 at 7:52:05 AM.
Mention in the RTEMS POSIX 1003.1 Compliance Guide that rename() is only partially supported. Doesn't explain *how* this is the case

Download all attachments as: .zip

Change History (13)

comment:1 Changed on Jan 20, 2014 at 7:09:40 AM by Sebastian Huber

Cc: Sebastian Huber added

comment:2 Changed on Jan 21, 2014 at 1:00:38 PM by Gedare Bloom

Cc: Gedare Bloom added

Changed on Feb 17, 2014 at 7:52:05 AM by Nick Withers

Attachment: posix1003.1.patch added

Mention in the RTEMS POSIX 1003.1 Compliance Guide that rename() is only partially supported. Doesn't explain *how* this is the case

comment:3 Changed on Feb 17, 2014 at 7:52:05 AM by Nick Withers

Also adds rename() to the "ANSI C Section 4.9 — Input/Output?" section, where it was mentioned that remane() also appears elsewhere, but in which rename didn't actually appear.

It would be (really) useful to document how exactly rename() is only partially supported but it's unclear to me that the current documentation layout accommodates this.

Thoughts? Perhaps a new section detailing deficiencies would be good?

comment:4 Changed on Apr 11, 2014 at 7:19:59 PM by Gedare Bloom

Milestone: 4.114.12

comment:5 Changed on Nov 20, 2014 at 3:31:07 AM by Chris Johns

Milestone: 4.124.11

comment:6 Changed on Nov 24, 2014 at 6:58:28 PM by Gedare Bloom

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

comment:7 Changed on Dec 3, 2014 at 6:24:26 AM by Nick Withers

Hrmmm... Where did this comment go? The CC change still appears

Gedare <gedare@rtems.org> changed:

           What    |Removed                     |Added
                 CC|                            |gedare@rtems.org

--- Comment #5 from Gedare <gedare@rtems.org> 2014-01-21 08:00:38 CST ---
then the documentation should be fixed, and should specifically indicate how it
is not like posix.

comment:8 Changed on Dec 19, 2014 at 5:06:18 AM by Gedare Bloom

Priority: normalhighest

Bump priority to highest for tickets with a fix attached or seemingly simple fix proposed in the description or comments.

comment:9 Changed on Feb 19, 2015 at 9:35:04 PM by Nick Withers <nick.withers@…>

In c53705c384e3cbb9716e2709e5cd3b7bbaa20609/rtems:

doc: Note that rename() is only partially implemented.

Replacing of existing files is not supported. See #2169.

comment:10 Changed on Feb 19, 2015 at 9:36:45 PM by Gedare Bloom

Description: modified (diff)
Milestone: 4.115.0

Committed the note in doc. Pushing milestone since there seems little interest in fixing it for 4.11, and we should not fix it in a dot release.

comment:11 Changed on Apr 3, 2017 at 11:28:59 PM by Joel Sherrill

Keywords: POSIX-Compliance added

comment:12 Changed on Aug 13, 2017 at 11:38:57 PM by Chris Johns

Milestone: 5.0Indefinite
Version: 4.11
Note: See TracTickets for help on using tickets.