From toasty@server28.stileproject.com  Mon Oct 23 07:22:56 2006
Return-Path: <toasty@server28.stileproject.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id DC86416A412
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 23 Oct 2006 07:22:56 +0000 (UTC)
	(envelope-from toasty@server28.stileproject.com)
Received: from tokyo01.jp.mail.your.org (tokyo01.jp.mail.your.org [204.9.54.5])
	by mx1.FreeBSD.org (Postfix) with ESMTP id EF8FF43D58
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 23 Oct 2006 07:22:55 +0000 (GMT)
	(envelope-from toasty@server28.stileproject.com)
Received: from mail.your.org (server3-a.your.org [64.202.112.67])
	by tokyo01.jp.mail.your.org (Postfix) with ESMTP id 5AB432AD5497
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 23 Oct 2006 07:22:53 +0000 (UTC)
Received: from server28.stileproject.com (server28-a.stileproject.com [64.202.112.28])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.your.org (Postfix) with ESMTP id ADA55A0A44E
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 23 Oct 2006 07:22:52 +0000 (UTC)
Received: (from root@localhost)
	by server28.stileproject.com (8.13.6/8.13.6/Submit) id k9N7Mpqm042609;
	Mon, 23 Oct 2006 02:22:51 -0500 (CDT)
	(envelope-from toasty)
Message-Id: <200610230722.k9N7Mpqm042609@server28.stileproject.com>
Date: Mon, 23 Oct 2006 02:22:51 -0500 (CDT)
From: Kevin Day <toasty@dragondata.com>
Reply-To: Kevin Day <toasty@dragondata.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] Make fetch(1) preserve permissions when overwriting a file
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         104702
>Category:       bin
>Synopsis:       [patch] Make fetch(1) preserve permissions when overwriting a file
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    des
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 23 07:30:11 GMT 2006
>Closed-Date:    Sun Jun 01 13:03:51 UTC 2008
>Last-Modified:  Sun Jun 01 13:03:51 UTC 2008
>Originator:     Kevin Day
>Release:        FreeBSD 6.1-RELEASE amd64
>Organization:
Your.Org, Inc.
>Environment:
System: FreeBSD server28 6.1-RELEASE FreeBSD 6.1-RELEASE #1: Sat Jul 29 06:31:24 UTC 2006 toasty@server28:/usr/src/sys/amd64/compile/SERVER amd64


>Description:

In FreeBSD 4.x, fetch(1) would preserve file permissions when overwriting a file.

Starting in 5.x, fetch applies inconsistent permissions when creating or overwriting an existing file.

New files are given 0644, but overwritten files are given  0600. Not only is this inconsistent, but I believe fetch should preserve permissions when overwriting a file.

>How-To-Repeat:

server29# uname -r
6.1-RELEASE
server29# fetch -o testfile http://www.freebsd.org
testfile                                      100% of   18 kB  128 kBps
server29# ls -l testfile
-rw-r--r--  1 root  wheel  19135 Oct 19 14:37 testfile
server29# chmod 664 testfile
server29# ls -l testfile
-rw-rw-r--  1 root  wheel  19135 Oct 19 14:37 testfile
server29# fetch -o testfile http://www.freebsd.org
testfile                                      100% of   18 kB  128 kBps
server29# ls -l testfile
-rw-------  1 root  wheel  19135 Oct 19 14:37 testfile

>Fix:

--- fetch.c~       Mon Oct 23 02:13:44 2006
+++ fetch.c     Fri Jul 28 23:40:48 2006
@@ -569,6 +569,8 @@
                        if (tmppath != NULL) {
                                mkstemps(tmppath, strlen(slash) + 1);
                                of = fopen(tmppath, "w");
+                               chown(tmppath, sb.st_uid, sb.st_gid);
+                               chmod(tmppath, sb.st_mode & 07777);
                        }
                }
                if (of == NULL)

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: keramida 
Responsible-Changed-When: Fri Nov 10 21:48:55 UTC 2006 
Responsible-Changed-Why:  
des@ is the right kind of guy to deal with this.  He knows 
libfetch and if there was a reason for the permissions change, 
he's the one who knows why it was done :) 


http://www.freebsd.org/cgi/query-pr.cgi?pr=104702 
State-Changed-From-To: open->patched 
State-Changed-By: des 
State-Changed-When: Fri Nov 10 22:09:23 UTC 2006 
State-Changed-Why:  
Fixed in -CURRENT, awaiting MFC 

http://www.freebsd.org/cgi/query-pr.cgi?pr=104702 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/104702: commit references a PR
Date: Fri, 10 Nov 2006 22:05:50 +0000 (UTC)

 des         2006-11-10 22:05:41 UTC
 
   FreeBSD src repository
 
   Modified files:
     usr.bin/fetch        fetch.c 
   Log:
   Try to preserve ownership and permissions when replacing an existing file.
   
   PR:             bin/104702
   Submitted by:   Kevin Day <toasty@dragondata.com>
   MFC after:      1 week
   
   Revision  Changes    Path
   1.78      +2 -0      src/usr.bin/fetch/fetch.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/104702: commit references a PR
Date: Tue, 21 Nov 2006 09:39:28 +0000 (UTC)

 des         2006-11-21 09:39:12 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     usr.bin/fetch        fetch.c 
   Log:
   MFC: (1.78) preserve ownership and permissions when replacing an existing file
   
   PR:             bin/104702
   
   Revision  Changes    Path
   1.75.2.2  +2 -0      src/usr.bin/fetch/fetch.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: gavin 
State-Changed-When: Sun Jun 1 13:02:09 UTC 2008 
State-Changed-Why:  
THis was fixed in HEAD and MFC'd to RELENG_6 some time ago. 
Thanks for your bug report! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=104702 
>Unformatted:
