[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#41001: mkdir: cannot create directory ‘test’: File exists
From: |
Paul Eggert |
Subject: |
bug#41001: mkdir: cannot create directory ‘test’: File exists |
Date: |
Fri, 1 May 2020 11:07:48 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
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 exists
Here the system call mkdir("d", 0777) failed with errno == EEXIST (File exists).
Presumably you wouldn't object to the diagnostic here because d is a regular
file, not a directory. But the mkdir system call fails in exactly the same way
if d is a directory, so the error message is the same in both cases.
Directories are files, so the error message is correct even if it confused you.
I don't see any portable and efficient way to make the diagnostic less confusing
for you, without also making diagnostic incorrect in some other scenarios (such
as the scenario described above).
- bug#41001: mkdir: cannot create directory ‘test’: File exists, Jonny Grant, 2020/05/01
- bug#41001: mkdir: cannot create directory ‘test’: File exists, Eric Blake, 2020/05/01
- bug#41001: mkdir: cannot create directory ‘test’: File exists, Jonny Grant, 2020/05/01
- bug#41001: mkdir: cannot create directory ‘test’: File exists,
Paul Eggert <=
- bug#41001: mkdir: cannot create directory ‘test’: File exists, Jonny Grant, 2020/05/01
- bug#41001: mkdir: cannot create directory ‘test’: File exists, Paul Eggert, 2020/05/01
- bug#41001: mkdir: cannot create directory ‘test’: File exists, Jonny Grant, 2020/05/02
- bug#41001: mkdir: cannot create directory ‘test’: File exists, Paul Eggert, 2020/05/02
- bug#41001: mkdir: cannot create directory ‘test’: File exists, Jonny Grant, 2020/05/02
- bug#41001: mkdir: cannot create directory ‘test’: File exists, Paul Eggert, 2020/05/02
- bug#41001: mkdir: cannot create directory ‘test’: File exists, Jonny Grant, 2020/05/03
- bug#41001: mkdir: cannot create directory ‘test’: File exists, Bob Proulx, 2020/05/04
- bug#41001: mkdir: cannot create directory ‘test’: File exists, Jonny Grant, 2020/05/05
- bug#41001: mkdir: cannot create directory ‘test’: File exists, Eric Blake, 2020/05/05