RTEMS | rename() fails when source and target are the same - violates POSIX compliance (#5487)
Mazen hassan (@Mazen_Hassan)
gitlab at rtems.org
Wed Apr 8 11:56:25 UTC 2026
Mazen hassan commented on a discussion: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5487#note_148228
Hi @somil, I've submitted a fix for the same-file case (`mv a a`) by evaluating the destination path without `RTEMS_FS_EXCLUSIVE` first, then comparing `node_access` pointers of both locations. If they point to the same filesystem node, we return 0 immediately as POSIX requires.
You're correct that the overwrite case (`mv a b` where `b` already exists) is not addressed here — that requires removing `RTEMS_FS_EXCLUSIVE` from the general path and handling the overwrite logic inside each filesystem's `rename_h` implementation (like `IMFS_rename`), which is a broader change. I've left a FIXME comment in the code acknowledging this so it's clear to reviewers that the overwrite case is known and intentionally out of scope for this MR.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5487#note_148228
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260408/33f873b1/attachment.htm>
More information about the bugs
mailing list