From unknown Sun Aug 17 22:01:38 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#23263 <23263@debbugs.gnu.org> To: bug#23263 <23263@debbugs.gnu.org> Subject: Status: cat: missingfile: No such file or directory Reply-To: bug#23263 <23263@debbugs.gnu.org> Date: Mon, 18 Aug 2025 05:01:38 +0000 retitle 23263 cat: missingfile: No such file or directory reassign 23263 coreutils submitter 23263 Jonny Grant severity 23263 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 10 14:44:11 2016 Received: (at submit) by debbugs.gnu.org; 10 Apr 2016 18:44:11 +0000 Received: from localhost ([127.0.0.1]:57502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apKLC-0000VI-OY for submit@debbugs.gnu.org; Sun, 10 Apr 2016 14:44:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45292) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apKLB-0000V1-AX for submit@debbugs.gnu.org; Sun, 10 Apr 2016 14:44:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1apKL5-0000Dh-Iq for submit@debbugs.gnu.org; Sun, 10 Apr 2016 14:44:04 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35469) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apKL5-0000Dd-Fq for submit@debbugs.gnu.org; Sun, 10 Apr 2016 14:44:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apKL4-0008LJ-JI for bug-coreutils@gnu.org; Sun, 10 Apr 2016 14:44:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1apKL1-0000DC-Eh for bug-coreutils@gnu.org; Sun, 10 Apr 2016 14:44:02 -0400 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]:35984) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apKL1-0000D8-7J for bug-coreutils@gnu.org; Sun, 10 Apr 2016 14:43:59 -0400 Received: by mail-wm0-x230.google.com with SMTP id v188so63384862wme.1 for ; Sun, 10 Apr 2016 11:43:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=p133BQ5lD23Eu1QImHYEXgMWsF1PCcrQBDlo8+RvOFk=; b=0PqU6k1MVCSXU6FLGWBZgEZREMTfCqk+cBZr7c+zzUfUB14TJWb66+UdBZI09fwhPE /5QE3UQKcszLtw9uzp/8rKKVq9xZgZgyq5xm3WeP17fNeAVQbK7N3xCa8JuDakFkSrom 5ZUBI1ISIr9lOUzXUMy4phs6VLQLcppZSO4db4d/B7bnu2kDG5BPuXXWXGS9Eef2NZFZ QBnGuQVKn+klHxQtCnqx1eW6jp4ZZycp1mmnnVKkcqrt3shsXubHbyDK8E/MIEY9SZPV B0r9UjDlGqiyoNBpAAi1bZkEn/oRBSdL7X5h+yozlJLeB3h7QVwlpT19a4XwZbHXTdk1 N5jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-transfer-encoding; bh=p133BQ5lD23Eu1QImHYEXgMWsF1PCcrQBDlo8+RvOFk=; b=haDGrKCwqaEdA/27jnwZmfeg6RHkHdHEjPxQ71G78eKANjwQdLt34GbY1G3BfJeehH Dw44Fb3ShtAR5N/wjmiBywcxe4mHwOg1y3lwn3lkSXr9X2/zjzedmH8vn2bmaQT5pYOa SYL621wovU5XZd0waXri9bLno3DUJVYP+IAuZZIpVXAm0loiCTWhX2UgDysyBQoeZyyS Y1mV5OwfRY6+x4WeQ0C/TISJJ3ECw0kYUbENylzvOmFgbp1Y7qjLcVmJR3DandjTRrPi twSlXqbIXWXTCtb452XLWcNcVmY/rtrVBbYo5cw/TSfXJvM8CdSFqf0wW39U5bLsbr5w jikw== X-Gm-Message-State: AD7BkJJwL8UY5DY+JNdOgQHjBx5dWSfzQHXFwnNRuKPgKSlgULfrPl6RpHs/X+9ANMXcvw== X-Received: by 10.194.5.194 with SMTP id u2mr19848734wju.139.1460313838068; Sun, 10 Apr 2016 11:43:58 -0700 (PDT) Received: from [192.168.1.83] (54.158.189.80.dyn.plus.net. [80.189.158.54]) by smtp.googlemail.com with ESMTPSA id u3sm13428429wmg.15.2016.04.10.11.43.56 for (version=TLSv1/SSLv3 cipher=OTHER); Sun, 10 Apr 2016 11:43:56 -0700 (PDT) To: bug-coreutils@gnu.org From: Jonny Grant Subject: cat: missingfile: No such file or directory Message-ID: <570A9ED4.7030805@jguk.org> Date: Sun, 10 Apr 2016 19:43:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.8 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.8 (---) 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 I wrote up the details of the ENOENT problem here: http://technoramauk.blogspot.co.uk/2015/12/enoent-considered-harmful.html Please keep my email address in any replies as I am not on this mailing list. Cheers, Jonny From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 10 15:01:23 2016 Received: (at 23263-done) by debbugs.gnu.org; 10 Apr 2016 19:01:23 +0000 Received: from localhost ([127.0.0.1]:57525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apKbr-0000wZ-43 for submit@debbugs.gnu.org; Sun, 10 Apr 2016 15:01:23 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:41609) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apKbp-0000wM-3q for 23263-done@debbugs.gnu.org; Sun, 10 Apr 2016 15:01:21 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 19489161245; Sun, 10 Apr 2016 12:01:15 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 1wQ_k6mYVfUz; Sun, 10 Apr 2016 12:01:14 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 66435161250; Sun, 10 Apr 2016 12:01:14 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id yw3riJRiGYuZ; Sun, 10 Apr 2016 12:01:14 -0700 (PDT) Received: from [192.168.1.9] (unknown [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 46A36161245; Sun, 10 Apr 2016 12:01:14 -0700 (PDT) Subject: Re: bug#23263: cat: missingfile: No such file or directory To: Jonny Grant , 23263-done@debbugs.gnu.org References: <570A9ED4.7030805@jguk.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <570AA2F5.804@cs.ucla.edu> Date: Sun, 10 Apr 2016 12:01:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <570A9ED4.7030805@jguk.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.0 (-) X-Debbugs-Envelope-To: 23263-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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. 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. From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 10 15:41:37 2016 Received: (at 23263-done) by debbugs.gnu.org; 10 Apr 2016 19:41:38 +0000 Received: from localhost ([127.0.0.1]:57556 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apLEn-0001si-O2 for submit@debbugs.gnu.org; Sun, 10 Apr 2016 15:41:37 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:37044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apLEm-0001sV-89 for 23263-done@debbugs.gnu.org; Sun, 10 Apr 2016 15:41:36 -0400 Received: by mail-wm0-f51.google.com with SMTP id n3so79595363wmn.0 for <23263-done@debbugs.gnu.org>; Sun, 10 Apr 2016 12:41:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=TLU41Bp0HurKeQYcyQg76HIY6iRQqWLsDo5/S8VKKqI=; b=XA1CnFwETsy/Cw3YyrFIroTP871RzmI3wSMBlEF0goulRK8ryJBmZAE141v336p7xX C9+Wmphk1FzngjTjczoqSqfzLVLrAx04T02FBZcPIvhKONK/l6chMOk/iYQojQpJbr5W CagyKfXPjVSkj8nRh8rqCfVdEgfNEqTgpcSq3eaElKaI1rsGWyS7J9T+bW7Otp6jvZiE qkaHY6HjLZju1c1pzrt0egWJ2gy0oGWTCkIryipp9tjUDLMd86fuAE5gRWonrruLUyFY 2G2dLWFm0Zg6xJ9JlU1uyzTGUtVFvrRAkl+vMlT+a/WmIJBaQCz/x8I/QMGgwDFSO8wN 0qKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=TLU41Bp0HurKeQYcyQg76HIY6iRQqWLsDo5/S8VKKqI=; b=J7ld5vxm3pCR1hax9GxpibdZRhCWFZApz0lgyr8KQmausQmjz+fm24uBzNunSFR3hW 8JYTz+qgRalFwrFvAkaUPmZUq3HQE9Rh7B4+rM+sy+4qPtIfRUImTbGXGIoTBd0Eczfc S9QO5UAnndeL/lgbvCSMU+JabKHuugSSKmVBDF883jJfZEfiwqQu0ymrJdwsqoTn8EBW h1ETR42z+1+hV/dNX/3/yKo9BYBv5lud58143FigkLOtwKIGOgpnaFSNXpFnL+dVihfQ kQbFKl3NsQ4YX2tCr1a9/MtkCY5939PFI5VixMoTGDSXVdjgp2/lqUxuKMSBp1qZdy/H d7HQ== X-Gm-Message-State: AD7BkJJMmXMs6ZtahAVsrptwxlNCUuyWziPzTWew4dY2gD3BYFfhhuvmgAivUL0l6ywY5g== X-Received: by 10.28.213.66 with SMTP id m63mr14963381wmg.2.1460317290705; Sun, 10 Apr 2016 12:41:30 -0700 (PDT) Received: from [192.168.1.83] (54.158.189.80.dyn.plus.net. [80.189.158.54]) by smtp.googlemail.com with ESMTPSA id r8sm24131046wjz.34.2016.04.10.12.41.29 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 10 Apr 2016 12:41:29 -0700 (PDT) Subject: Re: bug#23263: cat: missingfile: No such file or directory To: Paul Eggert , 23263-done@debbugs.gnu.org References: <570A9ED4.7030805@jguk.org> <570AA2F5.804@cs.ucla.edu> From: Jonny Grant Message-ID: <570AAC52.2090705@jguk.org> 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 MIME-Version: 1.0 In-Reply-To: <570AA2F5.804@cs.ucla.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 23263-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) 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. jonny@ubuntu1404:~$ 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 From unknown Sun Aug 17 22:01:38 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 09 May 2016 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator