s3: renaming a file onto an existing folder name (or a folder onto a file name) is not refused as on POSIX #963

Closed
opened 2026-10-18 22:16:03 +00:00 by Cordy · 1 comment
Owner

Found while fixing #960 (batch 3, Task C report, 2026-10-18).

Problem: #960 makes an S3 folder rename onto an existing folder refuse, the same as POSIX. Two cross-type cases are still not refused on S3:

  • renaming a file onto a name that is an existing folder (prefix);
  • renaming a folder onto a name that is an existing file.

On POSIX both fail (EISDIR / ENOTDIR). On S3 a file key and a folder prefix of the same name can then exist side by side, so listings show two items with one name and later operations pick one of them.

Expected: S3 refuses both cases with the same storage error POSIX maps to. Every caller keeps its current behaviour: WebDAV MOVE with Overwrite, REST rename, trash and convergence. Tests run on posix and s3.

Found while fixing #960 (batch 3, Task C report, 2026-10-18). **Problem:** #960 makes an S3 *folder* rename onto an existing folder refuse, the same as POSIX. Two cross-type cases are still not refused on S3: - renaming a file onto a name that is an existing folder (prefix); - renaming a folder onto a name that is an existing file. On POSIX both fail (EISDIR / ENOTDIR). On S3 a file key and a folder prefix of the same name can then exist side by side, so listings show two items with one name and later operations pick one of them. **Expected:** S3 refuses both cases with the same storage error POSIX maps to. Every caller keeps its current behaviour: WebDAV MOVE with Overwrite, REST rename, trash and convergence. Tests run on posix and s3.
Author
Owner

Shipped in v0.6.351 (PR #984), with #976. Both dogfoods run it. Live check, 2026-10-20: PASS.

On files-bao (Garage) and on files (posix):

  • A file uploaded onto an existing folder's name answered 409 destination-exists.
  • On files-bao, the folder's own file (sub/in.txt) still read back afterwards.
  • On files, a read below a file (a.txt/x) answered 404, where it used to be 500.
  • The S3 start probe on files-bao logged no WARN, so Garage answers HEAD of a folder name with 404, as the name checks assume.

Renames and copies across kinds, WebDAV (405/409/412), TUS, the drop link and restores are covered by tests on posix and s3.

Remaining limits, filed:

  • #979: NFC/NFD twins.
  • #980: S3 creates a missing parent folder implicitly.
  • #742: the race window between instances.

The test data is removed.

**Shipped in v0.6.351 (PR #984), with #976. Both dogfoods run it. Live check, 2026-10-20: PASS.** On files-bao (Garage) and on files (posix): - A file uploaded onto an existing folder's name answered 409 `destination-exists`. - On files-bao, the folder's own file (`sub/in.txt`) still read back afterwards. - On files, a read below a file (`a.txt/x`) answered 404, where it used to be 500. - The S3 start probe on files-bao logged no WARN, so Garage answers HEAD of a folder name with 404, as the name checks assume. Renames and copies across kinds, WebDAV (405/409/412), TUS, the drop link and restores are covered by tests on posix and s3. **Remaining limits, filed:** - #979: NFC/NFD twins. - #980: S3 creates a missing parent folder implicitly. - #742: the race window between instances. The test data is removed.
Cordy closed this issue 2026-10-20 13:58:13 +00:00
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#963
No description provided.