GNU bug report logs - #19148
ls --inode --sort=inode

Previous Next

Package: coreutils;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Sat, 22 Nov 2014 00:05:01 UTC

Severity: normal

Tags: notabug

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eric Blake <eblake <at> redhat.com>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>, 19148 <at> debbugs.gnu.org
Subject: bug#19148: ls --inode --sort=inode
Date: Fri, 21 Nov 2014 17:33:14 -0700
[Message part 1 (text/plain, inline)]
On 11/21/2014 04:57 PM, 積丹尼 Dan Jacobson wrote:
> $ man ls
>        --sort=WORD
>               sort  by  WORD instead of name: none (-U), size (-S), time (-t),
>               version (-v), extension (-X)
> 
> Perhaps add new functionality: inode (-i)

Nice idea, especially since we've already proven that 'rm' and other
tasks run faster when it first sorts by inode internally.

To _some_ extent, you can get the behavior by doing:
  ls -iU | sort -k1,1n | sed 's/^[0-9]* //'
but since ls already is wired for sorting, it has a nice appeal to do it
all from with ls.  Also, my workaround doesn't help with ls outputs
other than single file per line, and isn't entirely robust if a filename
contains newline.

However, we CANNOT treat '--sort=inode' as equivalent to '-i', because
the existing meaning of -i does NOT affect sorting (all of the other
sort options -U, -S, -t, -v, and -X DO affect sorting, and --sort is
just a long-option-y way of spelling the same), and for back-compat
reasons, we cannot change the behavior of -i.  Also, I'm very reluctant
to burn another short-option letter for 'ls'.  Besides, since both '-i'
and '-I' are already burned, and what other good mnemonic would we even
have?

I guess it would be okay to have a long option with no short-option
counterpart; it would look a bit awkward in the help text, but we could
figure something out.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 10 years and 242 days ago.

Previous Next


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