Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Mar 2003 16:58:43 +0900
From:      IIJIMA Hiromitsu <delmonta@ht.sakura.ne.jp>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/49999: lrz in lrzsz-0.12.20(comms/lrzsz) sets invalid timestamp
Message-ID:  <3E718BB3.C9C8B4A6@ht.sakura.ne.jp>

next in thread | raw e-mail | index | archive | help

>Number:         49999
>Category:       ports
>Synopsis:       lrz in lrzsz-0.12.20(comms/lrzsz) sets invalid timestamp
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 14 00:00:20 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     IIJIMA Hiromitsu
>Release:        FreeBSD 4.7-RELEASE-p3 i386
>Organization:
DENNOU GEDOU GAKKAI, N.D.D.
		http://www.dennougedougakkai-ndd.org/
>Environment:
System: FreeBSD sodans.usata.org 4.7-RELEASE-p3 FreeBSD 4.7-RELEASE-p3 #0: Wed Jan 22 14:50:19 JST 2003 root@www.my.domain:/usr/src/sys/compile/RENTALv6 i386

        Also checked on a Debian GNU/Linux, version unknown, kernel 2.4.20

        Peer: Tera Term Pro 2.3 on Windows Me
                http://hp.vector.co.jp/authors/VA002416/teraterm.html

>Description:
        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.

>How-To-Repeat:
        Simply build lrz from ports, then do a transfer to FreeBSD.
>Fix:
        Apply the following patch:

--- 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 @@

	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);
		zi->modtime=modtime;
		zi->bytes_total=bytes_total;

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.
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3E718BB3.C9C8B4A6>