GNU bug report logs -
#8513
stat list file name
Previous Next
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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8513 in the body.
You can then email your comments to 8513 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#8513
; Package
coreutils
.
(Sun, 17 Apr 2011 02:54:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
- - <wififu <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Sun, 17 Apr 2011 02:54:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (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 2 (text/html, inline)]
Reply sent
to
Bob Proulx <bob <at> proulx.com>
:
You have taken responsibility.
(Sun, 17 Apr 2011 05:52:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
- - <wififu <at> gmail.com>
:
bug acknowledged by developer.
(Sun, 17 Apr 2011 05:52:03 GMT)
Full text and
rfc822 format available.
Message #10 received at 8513-done <at> debbugs.gnu.org (full text, mbox):
- - 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
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#8513
; Package
coreutils
.
(Sun, 17 Apr 2011 06:07:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 8513 <at> debbugs.gnu.org (full text, mbox):
On 04/16/2011 07:47 PM, - - 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 -
>
>
>
That's not a bug with stat. It's due to the fact that the general unix
style of command parameters starts with a dash. The problem is that for
40 years, the writers of utilities assumed nobody would ever name a file
starting with a dash -- which is why they used a dash to indicate a
command line parameter.
Almost all utilities which use command line parameters or options which
start with a dash will have the same problem with any file that starts
with a dash, because when they see a "-" they think it's a parameter or
option instead of a file.
The solution is to provide a fuller path to the file. Instead of doing
stat * do stat ./* or if the file is named -something, do stat
./-something. The leading "./" (which stands for "Current directory)
comes in front of the dash and so stat doesn't think it's a parameter or
option.
Jesse Gordon
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#8513
; Package
coreutils
.
(Sun, 17 Apr 2011 06:30:03 GMT)
Full text and
rfc822 format available.
Message #16 received at 8513 <at> debbugs.gnu.org (full text, mbox):
tags 8513 notabug
close 8513
thanks
Bob Proulx wrote:
> 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.
And thank you for replying, Bob.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 15 May 2011 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 14 years and 98 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.