bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23263: cat: missingfile: No such file or directory


From: Jonny Grant
Subject: bug#23263: cat: missingfile: No such file or directory
Date: Sun, 10 Apr 2016 20:41:06 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

Hello Paul



On 10/04/16 20:01, Paul Eggert wrote:
Jonny Grant wrote:
Hello

I noticed that cat doesn't have an accurate message in the following
use-case:

$ cat missingfile
cat: missingfile: No such file or directory
$ mkdir testdir
$ cat testdir
cat: testdir: Is a directory

The "No such file or directory" message occurs because the operating
system does not have a separate error code for missing directory versus
missing file. In the example you gave, perhaps the working directory is
missing (this can happen on some systems), or perhaps there is no file
named "missingfile" in the working directory; the same code is returned
for both situations.

Other GNU tools that only accept files, don't have this problem though. ie GNU objdump. They workaround the ENOENT problem.

address@hidden:~$ objdump -d missingfile
objdump: 'missingfile': No such file

cat doesn't ever accept directories, so it should never output a message mentioning directory.


This is not a coreutils issue, but is instead a kernel and C library
issue. It's not something that coreutils can "fix", even assuming it was
agreed that it was a bug. If it really bothers you, I suggest writing
the POSIX standardization committee, but I should warn you that you'll
need a strong argument to change something that has been standardized
for decades.

yes I agree. I feel it is something that is a POSIX deficiency, having the same error code for files and directories. The POSIX standard ideally updated to reflect the situation in the year 2016. Technology shouldn't be static. I don't have the influence to persuade POSIX to reform unfortunately.

Thank you again for your reply.

Regards, Jonny





reply via email to

[Prev in Thread] Current Thread [Next in Thread]