From nobody@FreeBSD.org  Sat Feb 16 00:52:23 2002
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id E352337B402
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 16 Feb 2002 00:52:18 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id g1G8qIv90495;
	Sat, 16 Feb 2002 00:52:18 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200202160852.g1G8qIv90495@freefall.freebsd.org>
Date: Sat, 16 Feb 2002 00:52:18 -0800 (PST)
From: Shunichiro Ariura <syun1rou@blackshell.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: fetch can not change timestamp when same name file is exist.
X-Send-Pr-Version: www-1.0

>Number:         34992
>Category:       bin
>Synopsis:       fetch can not change timestamp when same name file is exist.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    des
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 16 01:00:00 PST 2002
>Closed-Date:    Sat Feb 23 04:40:25 PST 2002
>Last-Modified:  Sat Feb 23 04:40:28 PST 2002
>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:
Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: cjc 
Responsible-Changed-When: Sat Feb 16 04:51:56 PST 2002 
Responsible-Changed-Why:  
Over to fetch(1) maintainer. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=34992 
State-Changed-From-To: open->feedback 
State-Changed-By: des 
State-Changed-When: Sat Feb 16 06:03:07 PST 2002 
State-Changed-Why:  
Fixed in -CURRENT, awaiting MFC. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=34992 
State-Changed-From-To: feedback->closed 
State-Changed-By: des 
State-Changed-When: Sat Feb 23 04:40:25 PST 2002 
State-Changed-Why:  
MFCed, thanks! 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=34992 
>Unformatted:
