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

2020-05-10 Thread Paul Eggert
On 5/7/20 7:06 PM, Eric Blake wrote: > > (My personal wish: I would love a variation of mkdir that returns an open fd > on > the just-created directory on success in a single syscall, Yes! That would be a worthy addition.

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

2020-05-07 Thread Eric Blake
On 5/7/20 6:29 AM, Jonny Grant wrote: We already have mkdirat() specified by POSIX.  It would be easier to add a new O_ flag that tells mkdirat() to give a different errno failure than to add a completely new interface.  But emulating that new flag on older kernels that don't natively

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

2020-05-07 Thread Jonny Grant
Hi Eric On 05/05/2020 20:58, Eric Blake wrote: On 5/5/20 1:36 PM, Jonny Grant wrote: Okay.  That's confusing.  The only value in hand being EEXIST then that is the error to be reported.  If this were repeated many times then sometimes we would catch it as an actual directory.   

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

2020-05-05 Thread Bob Proulx
taehwan jeoung wrote: > Can this error message be clarified? The directory already exists, it is > not a file. That is incorrect. Directories are files. FIFOs are files. Device nodes are files. Symlinks are files. Network sockets are files. They are all files. Therefore it is not incorrect

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

2020-05-05 Thread taehwan jeoung via GNU coreutils Bug Reports
Stupid.mkdir -r test.mkdir test.Read your gnu manual to solve your digital illiteracy. 2020년 5월 2일 토요일 오전 12시 17분 45초 GMT+9, 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

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

2020-05-05 Thread Eric Blake
On 5/5/20 1:36 PM, Jonny Grant wrote: Okay.  That's confusing.  The only value in hand being EEXIST then that is the error to be reported.  If this were repeated many times then sometimes we would catch it as an actual directory.    lstat("foodir1", 0x7ffcafc12800)   = -1 ENOENT (No such

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

2020-05-05 Thread Jonny Grant
On 04/05/2020 20:32, Bob Proulx wrote: Jonny Grant wrote: Paul Eggert wrote: Jonny Grant wrote: Is a more accurate strerror considered unreliable? Current: mkdir: cannot create directory ‘test’: File exists Proposed: mkdir: cannot create directory ‘test’: Is a directory I don't

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

2020-05-04 Thread Bob Proulx
Jonny Grant wrote: > Paul Eggert wrote: > > Jonny Grant wrote: > > > Is a more accurate strerror considered unreliable? > > > > > > Current: > > > mkdir: cannot create directory ‘test’: File exists > > > > > > Proposed: > > > mkdir: cannot create directory ‘test’: Is a directory > > > > I don't

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

2020-05-03 Thread Jonny Grant
Hi! On 03/05/2020 00:13, Paul Eggert wrote: On 5/2/20 3:41 PM, Jonny Grant wrote: Is a more accurate strerror considered unreliable? Current: mkdir: cannot create directory ‘test’: File exists Proposed: mkdir: cannot create directory ‘test’: Is a directory I don't understand this comment.

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

2020-05-02 Thread Paul Eggert
On 5/2/20 3:41 PM, Jonny Grant wrote: > Is a more accurate strerror considered unreliable? > > Current: > mkdir: cannot create directory ‘test’: File exists > > Proposed: > mkdir: cannot create directory ‘test’: Is a directory I don't understand this comment. As I understand it you're proposing

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

2020-05-02 Thread Jonny Grant
On 02/05/2020 20:47, Paul Eggert wrote: On 5/2/20 6:26 AM, Jonny Grant wrote: If developers have race conditions in their shell scripts I've personally fixed a bug in the GNU mkdir command that was triggered by such races. Core utilities should be reliable even when these races are

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

2020-05-02 Thread Paul Eggert
On 5/2/20 6:26 AM, Jonny Grant wrote: > If developers have race conditions in their shell scripts I've personally fixed a bug in the GNU mkdir command that was triggered by such races. Core utilities should be reliable even when these races are happening.

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

2020-05-02 Thread Jonny Grant
On 01/05/2020 21:32, Paul Eggert wrote: 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

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