GNU bug report logs -
#6582
minor issue with du command
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6582 in the body.
You can then email your comments to 6582 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#6582
; Package
coreutils
.
(Wed, 07 Jul 2010 22:46:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Warren L Dodge <warrend <at> Tektronix.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Wed, 07 Jul 2010 22:46:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
I did a du -s * .??* in my /tmp directory and got this
du: invalid option -- 1
du: invalid option -- 2
du: invalid option -- 3
It turns out I had a directory named of all things "-123"
I tried du -s /dev/null * .??* witht e same results.
It seems like there would be a way to
stop processing switches. But it looks like even if I put -123 as the
last file of 30 others it still processes it as a switch.
No big deal since this doesn't happen to much (I assume).
Reply sent
to
Bob Proulx <bob <at> proulx.com>
:
You have taken responsibility.
(Wed, 07 Jul 2010 23:08:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Warren L Dodge <warrend <at> Tektronix.com>
:
bug acknowledged by developer.
(Wed, 07 Jul 2010 23:08:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 6582-done <at> debbugs.gnu.org (full text, mbox):
Warren L Dodge wrote:
> I did a du -s * .??* in my /tmp directory and got this
>
> du: invalid option -- 1
> du: invalid option -- 2
> du: invalid option -- 3
>
> It turns out I had a directory named of all things "-123"
Yes, that would do it.
> It seems like there would be a way to stop processing switches. But
> it looks like even if I put -123 as the last file of 30 others it
> still processes it as a switch.
That is a good idea! Hmm... What can we do about that. After due
consideration we have added a way to stop processing arguments as
options. Put a "--" on the command line after all of your option
arguments and before your file arguments. Check your system as we
have already updated it. :-)
du -s -- -123
du -s -- * .??*
Or traditionally prefixing the filename with a "./" also avoids having
the file look like an option argument.
du -s ./-123
du -s ./* ./.??*
> No big deal since this doesn't happen to much (I assume).
Unix folk tend to avoid filenames that start with an option letter or
that contain spaces. Why cause trouble? But for robust operation you
should always use either ./ or -- to avoid a filename being parsed as
an option argument and creating a data dependent failure.
Bob
Message #11 received at 6582-done <at> debbugs.gnu.org (full text, mbox):
Thanks.
I did figure the ./ out after I sent the report. I looked for -- in the
man page but didn't see it. So I didn't try it.
Does -- need added there? Or is it just "common knowledge".
> Date: Wed, 7 Jul 2010 17:07:07 -0600
> From: Bob Proulx <bob <at> proulx.com>
> CC: 6582-done <at> debbugs.gnu.org
> MIME-Version: 1.0
> Content-Type: text/plain; charset="us-ascii"
> Content-Disposition: inline
>
> Warren L Dodge wrote:
> > I did a du -s * .??* in my /tmp directory and got this
> >
> > du: invalid option -- 1
> > du: invalid option -- 2
> > du: invalid option -- 3
> >
> > It turns out I had a directory named of all things "-123"
>
> Yes, that would do it.
>
> > It seems like there would be a way to stop processing switches. But
> > it looks like even if I put -123 as the last file of 30 others it
> > still processes it as a switch.
>
> That is a good idea! Hmm... What can we do about that. After due
> consideration we have added a way to stop processing arguments as
> options. Put a "--" on the command line after all of your option
> arguments and before your file arguments. Check your system as we
> have already updated it. :-)
>
> du -s -- -123
> du -s -- * .??*
>
> Or traditionally prefixing the filename with a "./" also avoids having
> the file look like an option argument.
>
> du -s ./-123
> du -s ./* ./.??*
>
> > No big deal since this doesn't happen to much (I assume).
>
> Unix folk tend to avoid filenames that start with an option letter or
> that contain spaces. Why cause trouble? But for robust operation you
> should always use either ./ or -- to avoid a filename being parsed as
> an option argument and creating a data dependent failure.
>
> Bob
>
>
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 05 Aug 2010 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 14 years and 318 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.