From unknown Tue Aug 19 05:13:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33943: (omitted) ls directly uses filename as option parameter Resent-From: westlake Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 01 Jan 2019 08:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33943 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 33943@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15463315279398 (code B ref -1); Tue, 01 Jan 2019 08:33:01 +0000 Received: (at submit) by debbugs.gnu.org; 1 Jan 2019 08:32:07 +0000 Received: from localhost ([127.0.0.1]:43773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1geFT5-0002RU-0r for submit@debbugs.gnu.org; Tue, 01 Jan 2019 03:32:07 -0500 Received: from eggs.gnu.org ([208.118.235.92]:57314) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1geCsb-0006U7-29 for submit@debbugs.gnu.org; Tue, 01 Jan 2019 00:46:17 -0500 Received: from lists.gnu.org ([208.118.235.17]:33814) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1geCsZ-0002Qf-Qq for submit@debbugs.gnu.org; Tue, 01 Jan 2019 00:46:16 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1geCsZ-00049T-1y for bug-coreutils@gnu.org; Tue, 01 Jan 2019 00:46:15 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_LOW autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1geCsT-0002Ci-Hf for bug-coreutils@gnu.org; Tue, 01 Jan 2019 00:46:14 -0500 Received: from alt33.smtp-out.videotron.ca ([24.53.0.22]:61495) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1geCsP-0001yI-Pl for bug-coreutils@gnu.org; Tue, 01 Jan 2019 00:46:07 -0500 Received: from [192.168.1.145] ([24.202.243.79]) by Videotron with SMTP id eCsMg9zGvcWUZeCsNgr9SX; Tue, 01 Jan 2019 00:46:03 -0500 X-Authority-Analysis: v=2.3 cv=VtMN/d+n c=1 sm=1 tr=0 a=bLM/ODb0GI2A3veO+gxPdQ==:117 a=bLM/ODb0GI2A3veO+gxPdQ==:17 a=IkcTkHD0fZMA:10 a=91LHTotOCl6xg5UcSw8A:9 a=QEXdDO2ut3YA:10 From: westlake Message-ID: Date: Tue, 1 Jan 2019 00:46:02 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfMdExVhA0ioN8ErT97Zj36Q6AvA8fRnIxa8P/RZ++3PRXHhTTbC96dwgW7W7PmOV4kg1JGgUwmehUdTE489ZnCZ2jXXWzAat+wCarwal1jZ37d0lKEWz OrEqEr1ZXkhnikYBVxZ9IlVOezND2lRd1vTz4BT9DZkm8kBKXY87ofVObUMdvGnTMPXWQxGAyf55KQ== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 24.53.0.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -4.0 (----) X-Mailman-Approved-At: Tue, 01 Jan 2019 03:32:05 -0500 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: -5.0 (-----) Hi coreutils team, I have omitted that I recently downgraded my coreutils to doublecheck behaviour for ls, and noticed immediately the same behaviour was occuring, .. however a period of time the behaviour is no longer exhibiting the same, I suppose I did not wait long enough for the new "ls" or whatever it is to come into effect... but there's still oddities with ls, I guess it is the unprediction of "getopt".. and so I guess I should address any further concerns with the developers of getopt. thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 02 13:09:55 2019 Received: (at control) by debbugs.gnu.org; 2 Jan 2019 18:09:55 +0000 Received: from localhost ([127.0.0.1]:44957 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gekxn-000538-16 for submit@debbugs.gnu.org; Wed, 02 Jan 2019 13:09:55 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38531) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gekxl-00052z-Px for control@debbugs.gnu.org; Wed, 02 Jan 2019 13:09:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gekxl-00070x-3Z for control@debbugs.gnu.org; Wed, 02 Jan 2019 13:09:53 -0500 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 fencepost.gnu.org ([2001:4830:134:3::e]:54793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gekxk-00070l-Tv for control@debbugs.gnu.org; Wed, 02 Jan 2019 13:09:53 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1gekxj-00068M-Fg for control@debbugs.gnu.org; Wed, 02 Jan 2019 13:09:52 -0500 Subject: control message for bug 33943 To: X-Mailer: mail (GNU Mailutils 2.99.98) Message-Id: From: Glenn Morris Date: Wed, 02 Jan 2019 13:09:51 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control 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: -6.0 (------) forcemerge 33942 33943 From unknown Tue Aug 19 05:13:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33943: (omitted) ls directly uses filename as option parameter Resent-From: Bob Proulx Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 03 Jan 2019 04:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33943 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: westlake Cc: 33943@debbugs.gnu.org Received: via spool by 33943-submit@debbugs.gnu.org id=B33943.154648839226674 (code B ref 33943); Thu, 03 Jan 2019 04:07:01 +0000 Received: (at 33943) by debbugs.gnu.org; 3 Jan 2019 04:06:32 +0000 Received: from localhost ([127.0.0.1]:45144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1geuH8-0006w7-45 for submit@debbugs.gnu.org; Wed, 02 Jan 2019 23:06:30 -0500 Received: from havoc.proulx.com ([96.88.95.61]:34189) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1geuH5-0006vn-MV; Wed, 02 Jan 2019 23:06:28 -0500 Received: from joseki.proulx.com (localhost [127.0.0.1]) by havoc.proulx.com (Postfix) with ESMTP id EB9FCECA; Wed, 2 Jan 2019 21:06:21 -0700 (MST) Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id A0EA821243; Wed, 2 Jan 2019 21:06:21 -0700 (MST) Received: by hysteria.proulx.com (Postfix, from userid 1000) id 8D0262DC7B; Wed, 2 Jan 2019 21:06:21 -0700 (MST) Date: Wed, 2 Jan 2019 21:06:21 -0700 From: Bob Proulx Message-ID: <20190102205501180158993@bob.proulx.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Score: -0.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: -1.0 (-) tags 33943 notabug close 33943 merge 33942 thanks This message generated a new bug ticket. I merged it with the previous bug ticket. westlake wrote: > I have omitted that I recently downgraded my coreutils to doublecheck > behaviour for ls, and noticed immediately the same behaviour was occuring, It was still occurring because this is not a new behavior of 'ls'. This is the Unix has operated since the beginning. It seems that you missed seeing Assaf's explanation of it. Let me repeat some of it. > $touch 0 ./--a ./-a ./-_a ./-- > $ ls -lad -* [^-]* Here the first example nicely uses ./ in front of the problematic characters. But the second one did not have ./ there. If it did then there would be no problem. But instead the "-*" above is trouble. Don't do it! Always put ./ in front of file globs (wildcards) like that. It should be: $ ls -lad ./-* ./[^-]* > .. however a period of time the behaviour is no longer exhibiting the same, It was not a period of time. It was the contents of the directory upon which the commands were used. It is data dependent. It depends upon the file names that exist. If there are no file names that start with a '-' then none will be mistaken for an option. As you knew when you created the test case using touch above. > I suppose I did not wait long enough for the new "ls" or whatever it is to > come into effect... It is not a time issue. It is only a matter of file glob wildcard expansion as done by the command line shell. Using 'echo' to see a preview of the command will show this. > but there's still oddities with ls, I guess it is the unprediction of > "getopt".. and so I guess I should address any further concerns with the > developers of getopt. This is also not a getopt issue. The best practice is to prefix all wildcards with ./ such as ./*.txt so that the resulting text string will not be confused with an option starting with a '-' even if the file name starts with a '-' as the result will be "./-something" but the resulting argument to ls will start with "./" instead of "-". Bob