rmdir of non empty dir causes wrong errno with SMB or NFS fs

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Jul 14 14:39:36 GMT 2025


Hi Aurélien,

On Jul 12 15:02, Aurélien Couderc wrote:
> Cygwin 3.7.0-0.219.gbf81e32f29e0.x86_64, /bin/rmdir causes wrong errno
> if the filesystem is SMB or NFS.
> 
> Test case:
> bash -c 'rm -Rf d1 ; mkdir d1 ; touch d1/f1 ; rmdir d1'
> 
> On C; I get:
> rmdir: failed to remove 'd1': Directory not empty
> 
> On N: (Windows NFS) I get:
> rmdir: failed to remove 'd1': Bad address
> 
> if I trace this I get:
> bash -c 'rm -Rf d1 ; mkdir d1 ; touch d1/f1 ; strace -o
> /tmp/rmdirtracelog.txt rmdir d1'
> rmdir: failed to remove 'd1': Permission denied
> 
> Both "Bad address" and "Permission denied" are IMO wrong, the expected
> error would be "Directory not empty".

I can't reproduce this:

  $ uname -r
  3.7.0-dev-228-g8065978ff838.x86_64
  $ cd <my Samba mount>
  $  bash -c 'rm -Rf d1 ; mkdir d1 ; touch d1/f1 ; rmdir d1'
  rmdir: failed to remove 'd1': Directory not empty
  $ cd <my MSFT NFS v3 mount>
  $  bash -c 'rm -Rf d1 ; mkdir d1 ; touch d1/f1 ; rmdir d1'
  rmdir: failed to remove 'd1': Directory not empty

Sorry, I have no idea why this fails for you.  On a hunch, are you
missing identity mapping?  Different SIDs on SMB, no identity mapping on
NFS?


Corinna


More information about the Cygwin mailing list