From owner-freebsd-bugs@FreeBSD.ORG Mon Oct 23 07:30:13 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AA25516A407 for ; Mon, 23 Oct 2006 07:30:13 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1910843D45 for ; Mon, 23 Oct 2006 07:30:13 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k9N7UCjl006834 for ; Mon, 23 Oct 2006 07:30:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k9N7UCKh006831; Mon, 23 Oct 2006 07:30:12 GMT (envelope-from gnats) Resent-Date: Mon, 23 Oct 2006 07:30:12 GMT Resent-Message-Id: <200610230730.k9N7UCKh006831@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Kevin Day Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DC86416A412 for ; 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 ; 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 ; 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 ; 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 To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/104702: [patch] Make fetch(1) preserve permissions when overwriting a file X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Kevin Day List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2006 07:30:13 -0000 >Number: 104702 >Category: bin >Synopsis: [patch] Make fetch(1) preserve permissions when overwriting a file >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: Mon Oct 23 07:30:11 GMT 2006 >Closed-Date: >Last-Modified: >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: >Unformatted: