Bhuvan B created an issue: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5487



## Summary

The RTEMS implementation of `rename()` does not comply with POSIX standards. 
When the source and target paths resolve to the same file, `rename()` 
incorrectly fails instead of succeeding as a no-op as required by POSIX.

In `cpukit/libcsupport/src/_rename_r.c`

## Steps to reproduce

**Steps to reproduce**

Environment:

* BSP: `sparc/erc32` (sis simulator)

1. Start RTEMS shell in shell sample
2. Create a file:

   ```
   touch a
   ```
   3. Attempt to rename file to itself:

      ```
      SHLL [/] # mv a a   # Should succeed as a no-op
      
      rename a to a: File exists
      ```

**POSIX.1-2024 requirement:** "If the old argument and the new argument resolve 
to either the same existing directory entry or different directory entries for 
the same existing file, rename() shall return successfully and perform no other 
action."

**Expected result:** `mv a a` should succeed as a no-op (do nothing, return 
success)

**Actual result:** `rename()` returns error `"rename a to a: File exists"`

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5487
You're receiving this email because of your account on gitlab.rtems.org.


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to