Date: Sat, 16 Feb 2002 00:52:18 -0800 (PST) From: Shunichiro Ariura <syun1rou@blackshell.org> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/34992: fetch can not change timestamp when same name file is exist. Message-ID: <200202160852.g1G8qIv90495@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 34992
>Category: bin
>Synopsis: fetch can not change timestamp when same name file is exist.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Feb 16 01:00:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Shunichiro Ariura
>Release: 4.5-STABLE
>Organization:
>Environment:
FreeBSD comet.blackshell.org 4.5-STABLE FreeBSD 4.5-STABLE #0: Thu Feb 14 19:08\
:36 JST 2002 admin@comet.blackshell.org:/opt/sources/src-stable/sys/compile\
/COMET i386
>Description:
When downloading finished, fetch changes timestamp of file
to original file's timestamp on remote host.
But, if same name file is exist, fetch can not change
This function is implemented as following:
# I said abount src/usr.bin/fetch/fetch.c,v 1.10.2.17 2001/12/18 09:48:09
1) If same name file(original file) is exist, fetch download to
templary file.(L475-489)
2) When downloading finished, fetch change timestamp of
original file.(L544-554)
3) fetch rename from temporary file to original file.
finaly, the file's timestamp is not changed.
>How-To-Repeat:
comet:ariura{83} date
Sat Feb 16 17:43:34 JST 2002
comet:ariura{84} ls -l index.html
ls: index.html: No such file or directory
comet:ariura{85} fetch -q http://www.freebsd.org/index.html
comet:ariura{86} ls -l index.html
-rw-r--r-- 1 ariura wheel 24106 Feb 12 22:34 index.html
comet:ariura{87} fetch -q http://www.freebsd.org/index.html
comet:ariura{88} ls -l index.html
-rw------- 1 ariura wheel 24106 Feb 16 17:43 index.html
>Fix:
When fetch change timestamp, check tmppath variable is NULL.
If tmppath is'nt NULL, use tmppath to call utimes.
I.E.:
552,553c552,558
< if (utimes(path, tv))
< warn("%s: utimes()", path);
---
> if (tmppath != NULL ) {
> if (utimes(tmppath, tv))
> warn("%s: utimes()", tmppath);
> } else {
> if (utimes(path, tv))
> warn("%s: utimes()", path);
> }
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202160852.g1G8qIv90495>
