Bug 49999 - lrz in lrzsz-0.12.20(comms/lrzsz) sets invalid timestamp
lrz in lrzsz-0.12.20(comms/lrzsz) sets invalid timestamp
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Any Any
: Normal Affects Only Me
Assigned To: FreeBSD ports mailing list
Depends on:
  Show dependency treegraph
Reported: 2003-03-14 08:00 UTC by delmonta
Modified: 2003-09-29 00:05 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description delmonta 2003-03-14 08:00:20 UTC
        When I send a file from Windows with Tera Term Pro and receive
        it by lrz on FreeBSD, the timestamp (modification time) of the received
        file is always set to 1991-Apr-20 03:36:12 GMT (which may change
	according to compiler's optimization), neither the original
        file's timestamp nor the time that the file was transferred.

	I have reported to the original author on March 9th, with no response.

Fix: Apply the following patch:

nameend = name + 1 + strlen(name);
	if (*nameend) { /* file coming from Unix or DOS system */
-		long modtime;
-		long bytes_total;
-		int mode;
+		long modtime = 0;
+		long bytes_total = DEFBYTL;
+		int mode = 0;
		sscanf(nameend, "%ld%lo%o", &bytes_total, &modtime, &mode);

The mechanism of this bug is as follows:

        lrz.c (original lrzsz-0.12.20), line 1160-
        |nameend = name + 1 + strlen(name);
        |if (*nameend) { /* file coming from Unix or DOS system */
        |       long modtime;
        |       long bytes_total;
        |       int mode;
        |       sscanf(nameend, "%ld%lo%o", &bytes_total, &modtime, &mode);
        |       zi->modtime=modtime;
        |       <snip>

On a transfer from TeraTerm Pro (to either FreeBSD or Debian), the string
nameend contains only file size information and neither timestamp nor file
mode, so the variables modtime and mode are left uninitialized.
Therefore, a 'garbage' is set to zi->modtime.

On Debian, modtime contains zero before sscanf (and of course, after sscanf
too) and happens nothing, but on FreeBSD, modtime contains 672118572 with my
compiler settings, and the received files' timestamps are set to that value.--VwmxmCKnDpdmBwEDKELog2z2fY6d7VSL4dg5EWwUdT74uOSG
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- lrz.c.orig  1998-12-30 16:49:24.000000000 +0900
+++ lrz.c       2003-03-09 13:27:49.000000000 +0900
@@ -1159,9 +1159,9 @@
How-To-Repeat:         Simply build lrz from ports, then do a transfer to FreeBSD.
Comment 1 delmonta 2003-03-28 22:22:48 UTC
Still no answer from the original author.
It seems he ceised to develop lrzsz.
Comment 2 Edwin Groothuis freebsd_committer 2003-09-29 00:04:54 UTC
State Changed
From-To: open->closed

Commited, thanks!