GNU bug report logs - #33577
doc: mention find/stat in ls documentation

Previous Next

Package: coreutils;

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

Date: Sun, 2 Dec 2018 11:01:02 UTC

Severity: wishlist

Tags: notabug

To reply to this bug, email your comments to 33577 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#33577; Package coreutils. (Sun, 02 Dec 2018 11:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sun, 02 Dec 2018 11:01:02 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: bug-coreutils <at> gnu.org
Subject: ls lacks null terminator option
Date: Sun, 02 Dec 2018 18:53:06 +0800
For files with blanks in their names,
one shouldn't need this workaround:
$ ls -t | tr \\n \\0 | xargs -0 more > /tmp/z.txt
Please add a --print0 option. like find(1) has.

ls (GNU coreutils) 8.30




Information forwarded to bug-coreutils <at> gnu.org:
bug#33577; Package coreutils. (Mon, 03 Dec 2018 19:56:01 GMT) Full text and rfc822 format available.

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

From: Bob Proulx <bob <at> proulx.com>
To: 33577 <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#33577: ls lacks null terminator option
Date: Mon, 3 Dec 2018 12:55:30 -0700
積丹尼 Dan Jacobson wrote:
> For files with blanks in their names,
> one shouldn't need this workaround:
> $ ls -t | tr \\n \\0 | xargs -0 more > /tmp/z.txt
> Please add a --print0 option. like find(1) has.

I think that adding a --print0 option to 'ls' is not wise because it
would suggest to people seeing it that 'ls' should be used in scripts.
But 'ls' is a command designed for human interaction not for use in
scripts.  Using 'find' for scripted use is the desired utility.

Such a patch has previously been submitted.

  http://lists.gnu.org/archive/html/coreutils/2014-02/msg00005.html

Bob




Information forwarded to bug-coreutils <at> gnu.org:
bug#33577; Package coreutils. (Tue, 04 Dec 2018 20:36:01 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Bob Proulx <bob <at> proulx.com>
Cc: 33577 <at> debbugs.gnu.org
Subject: Re: bug#33577: ls lacks null terminator option
Date: Wed, 05 Dec 2018 04:35:09 +0800
Bob, I remember from my K&R Unix book that ls can be used in scripts.
In fact that is why
$ ls
acts different than
$ ls | cat

Plus there are lots of things ls can do that find cannot.

For instance sorting.

How are you going to do
$ ls -t
with find?




Information forwarded to bug-coreutils <at> gnu.org:
bug#33577; Package coreutils. (Tue, 04 Dec 2018 21:12:01 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Bob Proulx <bob <at> proulx.com>
Cc: 33577 <at> debbugs.gnu.org
Subject: Re: bug#33577: ls lacks null terminator option
Date: Wed, 05 Dec 2018 05:11:02 +0800
(Probably The Unix Programming Environment by K & P.)




Information forwarded to bug-coreutils <at> gnu.org:
bug#33577; Package coreutils. (Tue, 04 Dec 2018 21:13:02 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Bob Proulx <bob <at> proulx.com>
Cc: 33577 <at> debbugs.gnu.org
Subject: Re: bug#33577: ls lacks null terminator option
Date: Wed, 05 Dec 2018 05:12:01 +0800
Don't let that ls colors stuff fool you. It originally didn't have that.




Information forwarded to bug-coreutils <at> gnu.org:
bug#33577; Package coreutils. (Tue, 04 Dec 2018 21:14:01 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Bob Proulx <bob <at> proulx.com>
Cc: 33577 <at> debbugs.gnu.org
Subject: Re: bug#33577: ls lacks null terminator option
Date: Wed, 05 Dec 2018 05:13:26 +0800
Are you saying you want to enhance find(1) to sort its output?




Information forwarded to bug-coreutils <at> gnu.org:
bug#33577; Package coreutils. (Wed, 05 Dec 2018 10:26:02 GMT) Full text and rfc822 format available.

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

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>,
 Bob Proulx <bob <at> proulx.com>
Cc: 33577 <at> debbugs.gnu.org
Subject: Re: bug#33577: ls lacks null terminator option
Date: Wed, 5 Dec 2018 11:25:29 +0100
On 12/4/18 9:35 PM, 積丹尼 Dan Jacobson wrote:
> Bob, I remember from my K&R Unix book that ls can be used in scripts.
> In fact that is why
> $ ls
> acts different than
> $ ls | cat
> 
> Plus there are lots of things ls can do that find cannot.
> 
> For instance sorting.

You didn't mention sorting in your original post, but actually that's a
typical post-action which can be glued together the UNIX way via pipes,
using the decorate-process-undecorate pattern:

  $ find -printf '%T@:%p\0' | sort -znr | cut -zd: -f2- | $PRG

with e.g.
  PRG='head -zn1'
to get the newest file.

And yes, if you really want to cater for arbitrary file names with blanks,
newlines, and control character - short: everything apart from '/' and '\0',
or more malicious file names e.g. starting with '-' or '--' to fool scripts,
then it is quite complex by nature to get it right: think about what
you have to do in the consuming $PRG to perform the processing safely.

> Are you saying you want to enhance find(1) to sort its output?

No, because that what 'sort' is for.

Have a nice day,
Berny




Information forwarded to bug-coreutils <at> gnu.org:
bug#33577; Package coreutils. (Wed, 05 Dec 2018 11:40:02 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 33577 <at> debbugs.gnu.org, Bob Proulx <bob <at> proulx.com>
Subject: Re: bug#33577: ls lacks null terminator option
Date: Wed, 05 Dec 2018 19:39:09 +0800
Fine. Put a message on top of (info "(coreutils) ls invocation")
saying that your pipes are better.




Information forwarded to bug-coreutils <at> gnu.org:
bug#33577; Package coreutils. (Wed, 05 Dec 2018 13:07:02 GMT) Full text and rfc822 format available.

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

From: Peter Edwards <peter.edwards <at> csiro.au>
To: <bug-coreutils <at> gnu.org>
Subject: bug#33577: ls lacks null terminator option
Date: Wed, 5 Dec 2018 19:50:53 +1100
The output from stat(1) can be controlled, and is therefore easier
to parse than ls's human-friendly output, IMO.

Regards - Peter




Information forwarded to bug-coreutils <at> gnu.org:
bug#33577; Package coreutils. (Thu, 13 Dec 2018 20:40:02 GMT) Full text and rfc822 format available.

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

From: Assaf Gordon <assafgordon <at> gmail.com>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>,
 Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 33577 <at> debbugs.gnu.org, Bob Proulx <bob <at> proulx.com>
Subject: Re: bug#33577: ls lacks null terminator option
Date: Thu, 13 Dec 2018 13:39:46 -0700
tags 33577 notabug
severity 33577 wishlist
retitle 33577 doc: mention find/stat in ls documentation
stop

Hello,

On 2018-12-05 4:39 a.m., 積丹尼 Dan Jacobson wrote:
> Fine. Put a message on top of (info "(coreutils) ls invocation")
> saying that your pipes are better.

Given the suggested solution from Bob and Bernhard,
I'm marking this as a wishlish (todo) item
to improve ls's documentation.

regards,
 - assaf







Added tag(s) notabug. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 13 Dec 2018 20:40:03 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 13 Dec 2018 20:40:03 GMT) Full text and rfc822 format available.

Changed bug title to 'doc: mention find/stat in ls documentation' from 'ls lacks null terminator option' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 13 Dec 2018 20:40:03 GMT) Full text and rfc822 format available.

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

Previous Next


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