GNU bug report logs - #49716
no -print0 for ls?

Previous Next

Package: coreutils;

Reported by: Vito Caputo <vcaputo <at> pengaru.com>

Date: Sat, 24 Jul 2021 09:45:02 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: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>, Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Vito Caputo <vcaputo <at> pengaru.com>, 49716 <at> debbugs.gnu.org
Subject: bug#49716: no -print0 for ls?
Date: Mon, 26 Jul 2021 21:52:26 +0200
On 7/26/21 5:00 PM, Pádraig Brady wrote:
> The patch set looks good thanks.

Wait - I see another reason why we didn't add it earlier:

The --null option is not compatible with about half of the other options of ls(1);
at least the actual output is more than questionable, and not usable in programmatic
context.  The -R option is the first one which obviously can't work as such.

The following options don't work well with --null, because they output other,
additional information or transform/escape the file names:

  -b, --escape               print C-style escapes for nongraphic characters
  -C                         list entries by columns
      --color[=WHEN]         colorize the output; WHEN can be 'always' (default
                               if omitted), 'auto', or 'never'; more info below
  -F, --classify             append indicator (one of */=>@|) to entries
      --file-type            likewise, except do not append '*'
      --full-time            like -l --time-style=full-iso
  -g                         like -l, but do not list owner
      --indicator-style=WORD  append indicator with style WORD to entry names:
                               none (default), slash (-p),
                               file-type (--file-type), classify (-F)
  -i, --inode                print the index number of each file
  -l                         use a long listing format
  -m                         fill width with a comma separated list of entries
  -n, --numeric-uid-gid      like -l, but list numeric user and group IDs
  -o                         like -l, but do not list group information
  -p, --indicator-style=slash
                             append / indicator to directories
  -q, --hide-control-chars   print ? instead of nongraphic characters
  -Q, --quote-name           enclose entry names in double quotes
      --quoting-style=WORD   use quoting style WORD for entry names:
                               literal, locale, shell, shell-always,
                               shell-escape, shell-escape-always, c, escape
                               (overrides QUOTING_STYLE environment variable)
  -R, --recursive            list subdirectories recursively
  -s, --size                 print the allocated size of each file, in blocks
  -x                         list entries by lines instead of by columns
  -Z, --context              print any security context of each file

While the actual change is small - i.e., change the newline to a '\0' for the eolchar,
I'm afraid that it will become quite hairy to discuss the actual problems of future users
of that option when combining it with one of the above options.

I really have some qualms with adding --null to ls(1).  If this is about listing files
in the current directory in a certain sort order for a processing purpose, then this
would IMO warrant a new utility rather than blowing ls(1).

Have a nice day,
Berny




This bug report was last modified 3 years and 353 days ago.

Previous Next


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