#2169 assigned defect

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

Reported by: Nick Withers Owned by: Needs Funding
Priority: normal Milestone: Indefinite
Component: fs Version:
Severity: normal Keywords: POSIX-Compliance
Cc: sebastian.huber@…, gedare@…, oliva@… 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 02/17/14 at 07:52:05.
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 (16)

comment:1 Changed on 01/20/14 at 07:09:40 by Sebastian Huber

Cc: Sebastian Huber added

comment:2 Changed on 01/21/14 at 13:00:38 by Gedare Bloom

Cc: Gedare Bloom added

Changed on 02/17/14 at 07:52:05 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 02/17/14 at 07:52:05 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 04/11/14 at 19:19:59 by Gedare Bloom

Milestone: 4.114.12

comment:5 Changed on 11/20/14 at 03:31:07 by Chris Johns

Milestone: 4.124.11

comment:6 Changed on 11/24/14 at 18:58:28 by Gedare Bloom

Version: HEAD4.11

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

comment:7 Changed on 12/03/14 at 06:24:26 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 12/19/14 at 05:06:18 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 02/19/15 at 21:35:04 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 02/19/15 at 21:36:45 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 04/03/17 at 23:28:59 by Joel Sherrill

Keywords: POSIX-Compliance added

comment:12 Changed on 08/13/17 at 23:38:57 by Chris Johns

Milestone: 5.0Indefinite
Version: 4.11

comment:13 Changed on 06/23/22 at 07:03:07 by Alexandre Oliva

Cc: oliva@… added

comment:14 Changed on 06/23/22 at 07:24:16 by Sebastian Huber

It is unlikely that someone will work on a fix for this bug. I guess that the rename() is not used that often for this scenario in RTEMS applications.

Last edited on 06/23/22 at 07:24:37 by Sebastian Huber (previous) (diff)

comment:15 Changed on 06/24/22 at 05:47:44 by Sebastian Huber

Owner: changed from Chris Johns to Needs Funding
Priority: highestnormal
Status: newassigned
Note: See TracTickets for help on using tickets.