GNU bug report logs -
#50694
ls and cpio's idea of "six months ago" are slightly different
Previous Next
Full log
View this message in rfc822 format
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.
This bug report was last modified 3 years and 159 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.