GNU bug report logs - #13120
expand/unexpand: streamline first-only/initial options

Previous Next

Package: coreutils;

Reported by: Todd Shandelman <todd.shandelman <at> gmail.com>

Date: Fri, 7 Dec 2012 21:24:03 UTC

Severity: wishlist

To reply to this bug, email your comments to 13120 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#13120; Package coreutils. (Fri, 07 Dec 2012 21:24:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Todd Shandelman <todd.shandelman <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 07 Dec 2012 21:24:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Todd Shandelman <todd.shandelman <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: Not quite a bug, but ...
Date: Fri, 7 Dec 2012 14:23:12 -0600
[Message part 1 (text/plain, inline)]
Hi,  bug-coreutils <at> gnu.org  -

Not quite a bug, but why does the same option, essentially, have two very
different names in the 'expand' and 'unexpand'  utilities?

This is confusing and hampers convenient usage.

I am referring to* --initial* in the one case and* --first-only* in the
other.

See below.

Or what am I missing?

Thanks.

Todd Shandelman
Houston, TX

############################################################################################

* expand --help*
Usage: expand [OPTION]... [FILE]...
Convert tabs in each FILE to spaces, writing to standard output.
With no FILE, or when FILE is -, read standard input.

Mandatory arguments to long options are mandatory for short options too.
  -i, --initial       do not convert tabs after non blanks
  -t, --tabs=NUMBER   have tabs NUMBER characters apart, not 8
  -t, --tabs=LIST     use comma separated list of explicit tab positions
      --help     display this help and exit
      --version  output version information and exit

Report bugs to <bug-coreutils <at> gnu.org>.

$ *unexpand --help*
Usage: unexpand [OPTION]... [FILE]...
Convert blanks in each FILE to tabs, writing to standard output.
With no FILE, or when FILE is -, read standard input.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all        convert all blanks, instead of just initial blanks
      --first-only convert only leading sequences of blanks (overrides -a)
  -t, --tabs=N     have tabs N characters apart instead of 8 (enables -a)
  -t, --tabs=LIST  use comma separated LIST of tab positions (enables -a)
      --help     display this help and exit
      --version  output version information and exit

Report bugs to <bug-coreutils <at> gnu.org>.
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#13120; Package coreutils. (Sun, 09 Dec 2012 12:36:01 GMT) Full text and rfc822 format available.

Message #8 received at 13120 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Todd Shandelman <todd.shandelman <at> gmail.com>
Cc: 13120 <at> debbugs.gnu.org
Subject: Re: bug#13120: Not quite a bug, but ...
Date: Sun, 09 Dec 2012 12:34:44 +0000
On 12/07/2012 08:23 PM, Todd Shandelman wrote:
> Hi,  bug-coreutils <at> gnu.org  -
>
> Not quite a bug, but why does the same option, essentially, have two very
> different names in the 'expand' and 'unexpand'  utilities?
>
> This is confusing and hampers convenient usage.
>
> I am referring to* --initial* in the one case and* --first-only* in the
> other.
>
> See below.
>
> Or what am I missing?

Yes that is inconsistent.
Interestingly the POSIX defined expand and unexpand are inconsistent
in relation to this to start with.

unexpand only processes leading blanks by default, but
expand processes all blanks by default.

So unexpand needs the -a option to process all blanks,
and expand needs the -i, --initial option to process only leading blanks.

Given the above you might think that the --first-only option to unexpand
is redundant.  However -a is implied by -t (as per POSIX), therefore
to really limit to initial blanks, you need this option.

So as for naming.  I agree that --first-only is inconsistent.
It's also a bit ambiguous. Does it mean only the first tab is written,
or all leading blanks are processed.  Now deprecating --first-only
for the more consistent --initial has some cost.  For example
it would break part of my FSlint program:
http://code.google.com/p/fslint/source/browse/trunk/fslint/supprt/rmlint/fix_ws.sh
Also, I see busybox copied --first-only into its unexpand implementation.
But I guess to be forward looking --first-only should be deprecated
in favor of --initial?

thanks,
Pádraig.




Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 18 Oct 2018 23:02:02 GMT) Full text and rfc822 format available.

Changed bug title to 'expand/unexpand: streamline first-only/initial options' from 'Not quite a bug, but ...' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 18 Oct 2018 23:02:02 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 302 days ago.

Previous Next


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