GNU bug report logs - #6582
minor issue with du command

Previous Next

Package: coreutils;

Reported by: Warren L Dodge <warrend <at> Tektronix.com>

Date: Wed, 7 Jul 2010 22:46:01 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: Warren L Dodge <warrend <at> Tektronix.com>
Subject: bug#6582: closed (Re: bug#6582: minor issue with du command)
Date: Wed, 07 Jul 2010 23:08:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#6582: minor issue with du command

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 6582 <at> debbugs.gnu.org.

-- 
6582: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6582
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Bob Proulx <bob <at> proulx.com>
To: Warren L Dodge <warrend <at> Tektronix.com>
Cc: 6582-done <at> debbugs.gnu.org
Subject: Re: bug#6582: minor issue with du command
Date: Wed, 7 Jul 2010 17:07:07 -0600
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 part 3 (message/rfc822, inline)]
From: Warren L Dodge <warrend <at> Tektronix.com>
To: bug-coreutils <at> gnu.org
Subject: minor issue with du command
Date: Wed, 7 Jul 2010 15:15:05 -0700
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).





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.