#578517 moreutils: "ts -r" non-functionning

Package:
moreutils
Source:
moreutils
Description:
additional Unix utilities
Submitter:
Yann Dirson
Date:
2010-04-30 06:42:03 UTC
Severity:
normal
#578517#5
Date:
2010-04-20 14:48:12 UTC
From:
To:
I can hardly get "ts -r" to rewrite its own timestamps.

Testcase: "ls / | ts | ts -r %H"

With 0.34 and 0.39, no rewrite ever occurs.
With 0.31, the rewrite does occur (so there likely is a regression),
but then before each line of output I get an error like:

Use of uninitialized value in localtime at /usr/bin/ts line 86, <> line
12.

#578517#10
Date:
2010-04-20 17:26:23 UTC
From:
To:
Yann Dirson wrote:

0.39 works for me.

I wonder if this could be a locale problem?

So str2time (from Date::Parse) is failing, or
ts has not managed to match the date stamp to feed to it.

#578517#15
Date:
2010-04-21 07:06:46 UTC
From:
To:
Hi Joey,

Sorry my tests were wrong when trying to discriminate the locale factor
out: "ls / | env LC_ALL=C ts | ts -r %H" does work with 0.34 and 0.39.

More specifically, it looks like "env LC_ALL=xxx sh -c 'ls / | ts | ts
-r %H'" works for "C" and "en" locales, but at least not for french
ones on those versions.

Similarly on 0.31, the "uninitialized" do not appear for "C", although
it appears for "en".

#578517#20
Date:
2010-04-27 19:10:20 UTC
From:
To:
Yann Dirson wrote:

Date::Parse does not support localized dates.

But I do not get uninitialized values running ts -r on input like:

avril 27 15:08:14 bin/   etc/	    lib/	 mnt/	root/	  srv/ usr/
avril 27 15:08:14 boot/  home/	    lost+found/  opt/	sbin/

#578517#25
Date:
2010-04-28 08:54:54 UTC
From:
To:
Le Tue, 27 Apr 2010 15:10:20 -0400,
Joey Hess <joeyh@debian.org> a écrit :

Ah, that's unfortunate :)

I don't get them with current versions, only with 0.31.

#578517#30
Date:
2010-04-28 09:50:19 UTC
From:
To:
Le Wed, 28 Apr 2010 10:54:54 +0200,
Yann Dirson <dirson@bertin.fr> a écrit :

I wanted to add, a note about that in the docs may be good.

Also, I infer that in 0.31 there was another mechanism in use, which
supported localized timestamps (strptime ?).  Maybe it can be
reintroduced as a fallback when Date::Parse fails ?

Best regards,

#578517#35
Date:
2010-04-28 15:47:02 UTC
From:
To:
Yann Dirson wrote:

No, code has not changed since 0.31.

#578517#40
Date:
2010-04-29 06:44:59 UTC
From:
To:
Le Wed, 28 Apr 2010 11:47:02 -0400,
Joey Hess <joeyh@debian.org> a écrit :

My bad, it did not really work with 0.31 - reformatting to %H%M%S
always yields "010000" regardless of actual timestamp.  That may be
related to the "uninitialized value" exceptions.
Indeed 0.31 also rewrite file dates in a "ls -l|ts" stream, which is
also quite unexpected.

So 0.39 is actually better than 0.31 :)

What about the idea of falling back to strptime ?

#578517#45
Date:
2010-04-29 16:27:51 UTC
From:
To:
Yann Dirson wrote:

It's a good idea, but I have not been able to find a perl interface to
strptime yet, oddly.

#578517#50
Date:
2010-04-30 06:35:35 UTC
From:
To:
Le Thu, 29 Apr 2010 12:27:51 -0400,
Joey Hess <joeyh@debian.org> a écrit :

Maybe not as standard, but google quickly reveals a POSIX::strptime on
CPAN, and apt-cache search shows libtime-piece-perl, which provides a
bit more, and libdatetime-format-strptime-perl, which "implements most
of strptime" (sic).  Not sure what to use, my naive choice would be
for the one that is not yet packaged :)

Best regards,