bug#41001: mkdir: cannot create directory ‘test’: File exists

2020-05-01 Thread Paul Eggert
On 5/1/20 1:21 PM, Jonny Grant wrote: > yes, the fix pretty trivial for mkdir as you highlight EISDIR: > stat(), S_ISDIR(sb.st_mode), and set errno to EISDIR or output > strerror(EISDIR) That would introduce a race condition, and wouldn't behave correctly if some other process changes the

bug#41001: mkdir: cannot create directory ‘test’: File exists

2020-05-01 Thread Jonny Grant
On 01/05/2020 19:07, Paul Eggert wrote: On 5/1/20 9:16 AM, Jonny Grant wrote: rm: cannot remove 'test': Is a directory That's because rm used unlink which failed with EISDIR, which is a different error number. yes, the fix pretty trivial for mkdir as you highlight EISDIR: stat(),

bug#41001: mkdir: cannot create directory ‘test’: File exists

2020-05-01 Thread Paul Eggert
On 5/1/20 9:16 AM, Jonny Grant wrote: > rm: cannot remove 'test': Is a directory That's because rm used unlink which failed with EISDIR, which is a different error number. Consider this example: $ >d # Create an empty regular file. $ mkdir d mkdir: cannot create directory ‘d’: File

bug#41001: mkdir: cannot create directory ‘test’: File exists

2020-05-01 Thread Eric Blake
tag 41001 notabug thanks On 5/1/20 10:06 AM, Jonny Grant wrote: Hello! Can this error message be clarified? The directory already exists, it is not a file. By one definition, a directory _is_ a file, just with different semantics (in the same way a block device, character device, symlink,

bug#41001: mkdir: cannot create directory ‘test’: File exists

2020-05-01 Thread Jonny Grant
Hello! Can this error message be clarified? The directory already exists, it is not a file. lib/mkdir-p.c:200 contains this line of code that triggers below:- error (0, mkdir_errno, _("cannot create directory %s"), quote (dir)); As it's easy enough to know that the reason mkdir fails is