GNU bug report logs - #8513
stat list file name

Previous Next

Package: coreutils;

Reported by: - - <wififu <at> gmail.com>

Date: Sun, 17 Apr 2011 02:54:02 UTC

Severity: normal

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Bob Proulx <bob <at> proulx.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#8513: closed (stat list file name)
Date: Sun, 17 Apr 2011 05:52:03 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 16 Apr 2011 23:51:10 -0600
with message-id <20110417055110.GA11268 <at> hysteria.proulx.com>
and subject line Re: bug#8513: stat list file name
has caused the GNU bug report #8513,
regarding stat list file name
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
8513: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8513
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: - - <wififu <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: stat list file name
Date: Sun, 17 Apr 2011 04:47:59 +0200
[Message part 3 (text/plain, inline)]
here a small bug in stat:

stat -c %n *
stat : option invalide -- 's'
Saisissez « stat --help » pour plus d'informations.

ls
-sdjfè`@$&.txt

stat is not able to list a direstory if a file start with a -
[Message part 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
From: Bob Proulx <bob <at> proulx.com>
To: - - <wififu <at> gmail.com>
Cc: 8513-done <at> debbugs.gnu.org
Subject: Re: bug#8513: stat list file name
Date: Sat, 16 Apr 2011 23:51:10 -0600
- - wrote:
> here a small bug in stat:
> 
> stat -c %n *
> stat : option invalide -- 's'
> Saisissez « stat --help » pour plus d'informations.
> 
> ls
> -sdjfè`@$&.txt
> 
> stat is not able to list a direstory if a file start with a -

Thank you for your bug report but this is not a bug in stat but a
misunderstanding of how file globs operate with your command shell.

The '*' on your command line is expanded by the shell to all of the
files in the directory.  You have a filename that starts with a dash.
The resulting command line is the same as if you had placed the dash
on the command line yourself.

You can see this by using 'echo' to print out the command.

  $ echo stat -c %n *
  echo stat -c %n -sdjfè`@$&.txt

As you can see by using echo there is no difference between having a
file starting with a dash and placing an option with a dash on the
command line.  The only way to tell is for you to invoke the command
without the ambiguity.  Either use ./* to avoid having filenames start
with a dash or use "--" to signal to the command that there are no
further options.

Either:

  $ stat -c %n ./*

Or:

  $ stat -c %n -- *

Bob


This bug report was last modified 14 years and 99 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.