From owner-freebsd-bugs@FreeBSD.ORG Wed Mar 5 11:20:03 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 558111065670 for ; Wed, 5 Mar 2008 11:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 243F08FC14 for ; Wed, 5 Mar 2008 11:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m25BK2sP059801 for ; Wed, 5 Mar 2008 11:20:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m25BK2PX059800; Wed, 5 Mar 2008 11:20:02 GMT (envelope-from gnats) Date: Wed, 5 Mar 2008 11:20:02 GMT Message-Id: <200803051120.m25BK2PX059800@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Jaakko Heinonen Cc: Subject: Re: bin/91316: pax(1): pax -pe does not preserve times on symlinks X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jaakko Heinonen List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Mar 2008 11:20:03 -0000 The following reply was made to PR bin/91316; it has been noted by GNATS. From: Jaakko Heinonen To: bug-followup@FreeBSD.org, fbsd@opal.com Cc: Subject: Re: bin/91316: pax(1): pax -pe does not preserve times on symlinks Date: Wed, 5 Mar 2008 13:12:13 +0200 --5vNYLRcllDrimb99 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, Here's a patch for the problem. pax(1) doesn't restore symbolic link modes either. The patch fixes that too. NetBSD has similar fixes. -- Jaakko --5vNYLRcllDrimb99 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="pax-symlink-times-mode.diff" Index: file_subs.c =================================================================== RCS file: /home/ncvs/src/bin/pax/file_subs.c,v retrieving revision 1.22 diff -p -u -r1.22 file_subs.c --- file_subs.c 24 May 2007 06:44:37 -0000 1.22 +++ file_subs.c 5 Mar 2008 09:31:41 -0000 @@ -432,12 +432,6 @@ node_creat(ARCHD *arcn) res = 0; /* - * symlinks are done now. - */ - if (arcn->type == PAX_SLK) - return(0); - - /* * IMPORTANT SECURITY NOTE: * if not preserving mode or we cannot set uid/gid, then PROHIBIT any * set uid/gid bits @@ -632,7 +626,7 @@ chk_path( char *name, uid_t st_uid, gid_ * used by -t to reset access times). * When ign is zero, only those times the user has asked for are set, the * other ones are left alone. We do not assume the un-documented feature - * of many utimes() implementations that consider a 0 time value as a do + * of many lutimes() implementations that consider a 0 time value as a do * not set request. */ @@ -661,7 +655,7 @@ set_ftime(char *fnm, time_t mtime, time_ /* * set the times */ - if (utimes(fnm, tv) < 0) + if (lutimes(fnm, tv) < 0) syswarn(1, errno, "Access/modification time set failed on: %s", fnm); return; @@ -724,7 +718,7 @@ void set_pmode(char *fnm, mode_t mode) { mode &= ABITS; - if (chmod(fnm, mode) < 0) + if (lchmod(fnm, mode) < 0) syswarn(1, errno, "Could not set permissions on %s", fnm); return; } --5vNYLRcllDrimb99--