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


Message #11 received at 6582-done <at> debbugs.gnu.org (full text, mbox):

From: Warren Dodge <warren.l.dodge <at> Tektronix.com>
To: Bob Proulx <bob <at> proulx.com>
Cc: 6582-done <at> debbugs.gnu.org
Subject: Re: bug#6582: minor issue with du command
Date: Wed, 7 Jul 2010 16:23:02 -0700
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
>  
>  





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

Previous Next


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