Skip to content

[gap] rmdir deletes directory symlinks and NTFS junctions (GNU refuses: Not a directory) #1062

Closed

Description

@caomengxuan666

Summary

rmdir deletes directory symlinks and NTFS junctions. GNU rmdir refuses: a symlink is not a directory (failed to remove 'dlink': Not a directory, rc=1); only rm removes links. On Windows this happens because RemoveDirectoryW removes the reparse point itself.

Setup: dlink -> realdir (native dir symlink via MSYS=winsymlinks:nativestrict ln -s), jlink (junction via mklink /J).

Repro

winuxcmd.exe rmdir dlink     ->  rc=0, the SYMLINK IS DELETED (realdir untouched)
winuxcmd.exe rmdir jlink     ->  rc=0, the JUNCTION IS DELETED

GNU:
rmdir dlink                  ->  rmdir: failed to remove 'dlink': Not a directory   rc=1 (link kept)
rmdir jlink                  ->  rmdir: failed to remove 'jlink': Not a directory   rc=1

(rmdir link.txt on a FILE symlink correctly errors "Not a directory" in both — only dir-symlinks/junctions pass through.)

Distinct from #279 (which covers rmdir symlink/ trailing-slash forms); this is plain rmdir symlink.

Versions

  • WinuxCmd 1.0.6 (build-vs, WINUX_LANG=en)
  • GNU coreutils 8.32 (D:/Git/usr/bin/rmdir.exe)

Activity

  1. added
    bug
    compat-gap
    on Sep 14, 2026
  2. caomengxuan666 commented on Sep 14, 2026

    @caomengxuan666
    MemberAuthor

    Fixed/verified in b9211d5 — GNU expression parser for test/[, rmdir refuses dir symlinks+junctions with GNU diagnostics, mkdir EEXIST/deep-path fixes, rm --no-preserve-root abbreviation refusal, chmod -v GNU output. Verified vs WSL coreutils 9.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcompat-gap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions