GNU bug report logs - #50694
ls and cpio's idea of "six months ago" are slightly different

Previous Next

Package: coreutils;

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

Date: Mon, 20 Sep 2021 05:32:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50694 in the body.
You can then email your comments to 50694 AT debbugs.gnu.org in the normal way.

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#50694; Package coreutils. (Mon, 20 Sep 2021 05:32: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. (Mon, 20 Sep 2021 05:32: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, bug-cpio <at> gnu.org
Subject: ls and cpio's idea of "six months ago" are slightly different
Date: Mon, 20 Sep 2021 13:06:36 +0800
What a headache.
"Six months ago" means slightly different things to cpio and ls.
And ls documents do say exactly what,
and cpio documents don't even say six months.

$ cat prover
set -eu
cd /tmp
for i in `seq 170 190`
do
    touch -d "$i days ago" x
    {
	env - ls -l x|tr -s ' '
	ls x|cpio -o 2>&-|cpio -tv 2>&-|tr -s ' '
    } > z
    if test `sort -u z|wc -l` != 1
    then cat z; echo
    fi
done
$ sh prover
-rw-r--r-- 1 jidanni jidanni 0 Mar 23 12:47 x
-rw-r--r-- 1 jidanni jidanni 0 Mar 23 2021 x

-rw-r--r-- 1 jidanni jidanni 0 Mar 22 12:47 x
-rw-r--r-- 1 jidanni jidanni 0 Mar 22 2021 x

So two things that should look the same ... don't.

What's worse is there is no option to change cpio's date format.

Well then just change ls's date format to match cpio's right?
Well yes, but then there is no way to change ls's idea of six months,
even if we examined cpio's source code to find out what it uses.

$ ls --version
ls (GNU coreutils) 8.32
Copyright (C) 2020 Free Software Foundation, Inc.

$ cpio --version
cpio (GNU cpio) 2.13
Copyright (C) 2017 Free Software Foundation, Inc.




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Mon, 07 Feb 2022 02:54:02 GMT) Full text and rfc822 format available.

Notification sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
bug acknowledged by developer. (Mon, 07 Feb 2022 02:54:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 50694-done <at> debbugs.gnu.org, bug-cpio <at> gnu.org
Subject: Re: bug#50694: ls and cpio's idea of "six months ago" are slightly
 different
Date: Sun, 6 Feb 2022 18:53:34 -0800
[Message part 1 (text/plain, inline)]
On 9/19/21 22:06 in <https://bugs.gnu.org/50694>, 積丹尼 Dan Jacobson wrote:

> What a headache.
> "Six months ago" means slightly different things to cpio and ls.
> And ls documents do say exactly what,
> and cpio documents don't even say six months.

Thanks for the bug report. Since the behavior is documented for ls but 
not cpio and lots more people use ls, let's change cpio to behave like 
ls. Proposed patches to cpio attached. The last patch does the actual 
change; the earlier ones are issues I noticed on the way.

(Sergey, I don't have commit privileges for cpio on Savannah. If you 
give me privileges I can install these patches; otherwise, please take a 
look and install if you like. Thanks.)

In the meantime I'll close the coreutils bug report, as I don't think we 
need to change GNU 'ls'.
[0001-Remove-trailing-white-space-and-empty-lines.patch (text/x-patch, attachment)]
[0002-build-update-submodules-to-latest.patch (text/x-patch, attachment)]
[0003-Fix-integer-overflows-in-timestamp-output.patch (text/x-patch, attachment)]
[0004-Use-GNU-ls-algorithm-for-deciding-timestamp-format.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 07 Mar 2022 12:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 44 days ago.

Previous Next


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