From unknown Mon Jun 23 23:51:38 2025 X-Loop: help-debbugs@gnu.org Subject: bug#30963: ls -fA -> still . and .. Resent-From: Karl Berry Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 27 Mar 2018 17:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 30963 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 30963@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.152217166521453 (code B ref -1); Tue, 27 Mar 2018 17:28:01 +0000 Received: (at submit) by debbugs.gnu.org; 27 Mar 2018 17:27:45 +0000 Received: from localhost ([127.0.0.1]:56196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f0sNs-0005Zx-TD for submit@debbugs.gnu.org; Tue, 27 Mar 2018 13:27:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45626) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f0sNp-0005Zi-HL for submit@debbugs.gnu.org; Tue, 27 Mar 2018 13:27:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0sNj-0006Co-I2 for submit@debbugs.gnu.org; Tue, 27 Mar 2018 13:27:36 -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 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:32791) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0sNj-0006Cc-FH for submit@debbugs.gnu.org; Tue, 27 Mar 2018 13:27:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0sNi-0002Vs-3H for bug-coreutils@gnu.org; Tue, 27 Mar 2018 13:27:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0sNe-0006AY-J9 for bug-coreutils@gnu.org; Tue, 27 Mar 2018 13:27:34 -0400 Received: from freefriends.org ([96.88.95.60]:41918) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0sNe-0006AG-Bb for bug-coreutils@gnu.org; Tue, 27 Mar 2018 13:27:30 -0400 X-Envelope-From: karl@freefriends.org X-Envelope-To: Received: from freefriends.org (localhost [127.0.0.1]) by freefriends.org (8.14.9/8.14.9) with ESMTP id w2RHRTGA007720 for ; Tue, 27 Mar 2018 11:27:29 -0600 Received: (from karl@localhost) by freefriends.org (8.14.9/8.14.9/submit) id w2RHRShd007719; Tue, 27 Mar 2018 17:27:28 GMT From: Karl Berry Date: Tue, 27 Mar 2018 11:27:28 -0600 Message-ID: <86muyt77jz.fsf@frenzy.freefriends.org> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) 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: -4.0 (----) $ mkdir foo $ cd foo $ \ls -fA . .. $ I rather expected this output to be empty. -f enables -a, fine, but it seems like the -A should override the -a, since it's specified after? I guess it has nothing to do with -f in particular. \ls -aA also shows . and ..; maybe it shouldn't? Not sure, though ... --thanks, karl. From unknown Mon Jun 23 23:51:38 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Karl Berry Subject: bug#30963: closed (Re: bug#30963: ls -fA -> still . and ..) Message-ID: References: <2b1ac1c7-a2e1-2e4f-6ec7-c228179c7d31@cs.ucla.edu> <86muyt77jz.fsf@frenzy.freefriends.org> X-Gnu-PR-Message: they-closed 30963 X-Gnu-PR-Package: coreutils Reply-To: 30963@debbugs.gnu.org Date: Tue, 27 Mar 2018 22:07:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1522188422-21998-1" This is a multi-part message in MIME format... ------------=_1522188422-21998-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #30963: ls -fA -> still . and .. which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 30963@debbugs.gnu.org. --=20 30963: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D30963 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1522188422-21998-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 30963-done) by debbugs.gnu.org; 27 Mar 2018 22:06:42 +0000 Received: from localhost ([127.0.0.1]:56340 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f0wjg-0005i7-Mg for submit@debbugs.gnu.org; Tue, 27 Mar 2018 18:06:42 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:51680) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f0wjc-0005hr-23 for 30963-done@debbugs.gnu.org; Tue, 27 Mar 2018 18:06:31 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E73F1160E32; Tue, 27 Mar 2018 15:06:21 -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 M8bP_PGHVCTH; Tue, 27 Mar 2018 15:06:20 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id ED63E1611D3; Tue, 27 Mar 2018 15:06:19 -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 iuZSwi-ZpmeW; Tue, 27 Mar 2018 15:06:19 -0700 (PDT) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id D0459160E32; Tue, 27 Mar 2018 15:06:19 -0700 (PDT) Subject: Re: bug#30963: ls -fA -> still . and .. To: Karl Berry , 30963-done@debbugs.gnu.org References: <86muyt77jz.fsf@frenzy.freefriends.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <2b1ac1c7-a2e1-2e4f-6ec7-c228179c7d31@cs.ucla.edu> Date: Tue, 27 Mar 2018 15:06:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <86muyt77jz.fsf@frenzy.freefriends.org> Content-Type: multipart/mixed; boundary="------------CD131484950EB77B5480DEA8" Content-Language: en-US X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 30963-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.0 (/) This is a multi-part message in MIME format. --------------CD131484950EB77B5480DEA8 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 03/27/2018 10:27 AM, Karl Berry wrote: > ls -aA also shows . and ..; maybe it shouldn't? You're right, it shouldn't. This was a bug I introduced in 2004 and I think you're the first to report it (!). In my defense, it wasn't officially a bug until POSIX.1-2008 came out and specified that -a and -A should override each other. Anyway, thanks. I installed the attached patch. --------------CD131484950EB77B5480DEA8 Content-Type: text/x-patch; name="0001-ls-A-now-overrides-a.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-ls-A-now-overrides-a.patch" >From 8969027d310e036f1c11f3d8f6da2e4a55ecb460 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 27 Mar 2018 14:55:22 -0700 Subject: [PATCH] ls: -A now overrides -a Problem reported by Karl Berry (Bug#30963). * NEWS: Mention this. * src/ls.c (decode_switches): Implement this. * tests/ls/a-option.sh: New file. * tests/local.mk (all_tests): Add it. --- NEWS | 3 +++ src/ls.c | 3 +-- tests/local.mk | 1 + tests/ls/a-option.sh | 27 +++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100755 tests/ls/a-option.sh diff --git a/NEWS b/NEWS index 351a0827b..207e785b3 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,9 @@ GNU coreutils NEWS -*- outline -*- ** Bug fixes + 'ls -aA' is now equivalent to 'ls -A', since -A now overrides -a. + [bug introduced in coreutils-5.3.0] + 'mv -n A B' no longer suffers from a race condition that can overwrite a simultaneously-created B. This bug fix requires platform support for the renameat2 or renameatx_np syscalls, found diff --git a/src/ls.c b/src/ls.c index c89a22f68..bae2c1104 100644 --- a/src/ls.c +++ b/src/ls.c @@ -1903,8 +1903,7 @@ decode_switches (int argc, char **argv) break; case 'A': - if (ignore_mode == IGNORE_DEFAULT) - ignore_mode = IGNORE_DOT_AND_DOTDOT; + ignore_mode = IGNORE_DOT_AND_DOTDOT; break; case 'B': diff --git a/tests/local.mk b/tests/local.mk index c798cc83a..e60ea1d1e 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -575,6 +575,7 @@ all_tests = \ tests/ln/sf-1.sh \ tests/ln/slash-decorated-nonexistent-dest.sh \ tests/ln/target-1.sh \ + tests/ls/a-option.sh \ tests/ls/abmon-align.sh \ tests/ls/block-size.sh \ tests/ls/color-clear-to-eol.sh \ diff --git a/tests/ls/a-option.sh b/tests/ls/a-option.sh new file mode 100755 index 000000000..4fe1e9394 --- /dev/null +++ b/tests/ls/a-option.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# exercise the -a option + +# Copyright 2018 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src +print_ver_ ls + +mkdir d || framework_failure_ + +ls -aA d >out || framework_failure +compare /dev/null out || fail=1 + +Exit $fail -- 2.14.3 --------------CD131484950EB77B5480DEA8-- ------------=_1522188422-21998-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 27 Mar 2018 17:27:45 +0000 Received: from localhost ([127.0.0.1]:56196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f0sNs-0005Zx-TD for submit@debbugs.gnu.org; Tue, 27 Mar 2018 13:27:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45626) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f0sNp-0005Zi-HL for submit@debbugs.gnu.org; Tue, 27 Mar 2018 13:27:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0sNj-0006Co-I2 for submit@debbugs.gnu.org; Tue, 27 Mar 2018 13:27:36 -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 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:32791) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0sNj-0006Cc-FH for submit@debbugs.gnu.org; Tue, 27 Mar 2018 13:27:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0sNi-0002Vs-3H for bug-coreutils@gnu.org; Tue, 27 Mar 2018 13:27:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0sNe-0006AY-J9 for bug-coreutils@gnu.org; Tue, 27 Mar 2018 13:27:34 -0400 Received: from freefriends.org ([96.88.95.60]:41918) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0sNe-0006AG-Bb for bug-coreutils@gnu.org; Tue, 27 Mar 2018 13:27:30 -0400 X-Envelope-From: karl@freefriends.org X-Envelope-To: Received: from freefriends.org (localhost [127.0.0.1]) by freefriends.org (8.14.9/8.14.9) with ESMTP id w2RHRTGA007720 for ; Tue, 27 Mar 2018 11:27:29 -0600 Received: (from karl@localhost) by freefriends.org (8.14.9/8.14.9/submit) id w2RHRShd007719; Tue, 27 Mar 2018 17:27:28 GMT From: Karl Berry To: bug-coreutils@gnu.org Subject: ls -fA -> still . and .. Date: Tue, 27 Mar 2018 11:27:28 -0600 Message-ID: <86muyt77jz.fsf@frenzy.freefriends.org> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) 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: -4.0 (----) $ mkdir foo $ cd foo $ \ls -fA . .. $ I rather expected this output to be empty. -f enables -a, fine, but it seems like the -A should override the -a, since it's specified after? I guess it has nothing to do with -f in particular. \ls -aA also shows . and ..; maybe it shouldn't? Not sure, though ... --thanks, karl. ------------=_1522188422-21998-1-- From unknown Mon Jun 23 23:51:38 2025 X-Loop: help-debbugs@gnu.org Subject: bug#30963: ls -fA -> still . and .. Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 27 Mar 2018 22:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30963 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 30963@debbugs.gnu.org, Paul Eggert , Karl Berry Received: via spool by 30963-submit@debbugs.gnu.org id=B30963.152219105025806 (code B ref 30963); Tue, 27 Mar 2018 22:51:02 +0000 Received: (at 30963) by debbugs.gnu.org; 27 Mar 2018 22:50:50 +0000 Received: from localhost ([127.0.0.1]:56362 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f0xQY-0006iA-58 for submit@debbugs.gnu.org; Tue, 27 Mar 2018 18:50:50 -0400 Received: from mail-qk0-f177.google.com ([209.85.220.177]:43245) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f0xQW-0006hv-Jg for 30963@debbugs.gnu.org; Tue, 27 Mar 2018 18:50:49 -0400 Received: by mail-qk0-f177.google.com with SMTP id v2so547231qkh.10 for <30963@debbugs.gnu.org>; Tue, 27 Mar 2018 15:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=XIDr2NXAhd3lzi1CuJG2SwRn9rjo3Ss3+98t4TNaSCA=; b=ghhTkvB3/QyVIS2gvCqRswlaP/6KzqpRBxqrweJED39bhI7mvN2ciVBeyHjYa6/GOk teJilde99gSsAf4kexpPA76202FImSHSDLRPdZdwAnRrSYnW64TI7dfql8vvmvfsmD7p 2Y2cUDmNO4Y+fTR1IPpmf+0+LIi0vrACgmKC9tuYE2af18PFBYd7m4FtLrUQqB/hULxD OAq6x0G1x8x9QlzSTuJ2UEyMVLfVJdiKqlq3BC1ExT5OsK1wKNPAd9FjsI30NCGBjr8E iA/gfLaaT0lFofdv0aUqC3PiIz3ySQDLuPJCCeUNUIGAaIC3sQlzZC0mK2VRFJXfYjag 8X+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=XIDr2NXAhd3lzi1CuJG2SwRn9rjo3Ss3+98t4TNaSCA=; b=QvdC4QnBD3VeLpp0jpn00cVcwjPpkJD/e3MlQ+zYSqZqvMIRiO9YIKKKMcH0s2T47W 3R/RKF5h6ExzayM/hvQGSXUxHI+QtVm2Y3wWL8+ZExF8Ke2jTREp88obEvBDc50qgWUc Rj77C+FB0P2ui8YYUdJ9trRpEAd3sRmcu+0vmVGwedfaTCfTO98IytlURXvfzynzOuOw 1a+kwrr70151/Id7Mwzi3Zl+O0/Z01MXaykXmQjHVLpPXNOTg47rUBmGTWUZC5KBrrIh 8A6eGtdP5Wzz9vv12EmK6fesQz9pDrHsjX4pZIO6EmWiFvcon5alSyR9lUfekcpgb5Zi 3AiQ== X-Gm-Message-State: AElRT7EAFBhNZzvk7pZdfbosSiS0MtGlNQtds3T8QWP/1kfUEbDRZbiS FDp0oEUXtervrxqL44LoOHqOKdTOqPtAdjP0EN8= X-Google-Smtp-Source: AIpwx4/blYAfuCiWjxkHAzIicy5B6nA2MHEi7Ef2mXCXrb04mVP08bCsKKmP4Xfs6KKvC8heUfuQ7RAaTS+lqx+gqn8= X-Received: by 10.55.10.6 with SMTP id 6mr1832286qkk.271.1522191042151; Tue, 27 Mar 2018 15:50:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.98.4 with HTTP; Tue, 27 Mar 2018 15:50:21 -0700 (PDT) In-Reply-To: <2b1ac1c7-a2e1-2e4f-6ec7-c228179c7d31@cs.ucla.edu> References: <86muyt77jz.fsf@frenzy.freefriends.org> <2b1ac1c7-a2e1-2e4f-6ec7-c228179c7d31@cs.ucla.edu> From: Jim Meyering Date: Tue, 27 Mar 2018 15:50:21 -0700 X-Google-Sender-Auth: ifEJ08I6w79PqHT3WuUTqhpWuk0 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) 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 (/) On Tue, Mar 27, 2018 at 3:06 PM, Paul Eggert wrote: > On 03/27/2018 10:27 AM, Karl Berry wrote: >> >> ls -aA also shows . and ..; maybe it shouldn't? > > You're right, it shouldn't. This was a bug I introduced in 2004 and I think > you're the first to report it (!). In my defense, it wasn't officially a bug > until POSIX.1-2008 came out and specified that -a and -A should override > each other. Anyway, thanks. I installed the attached patch. Nice! Thank you both.