From owner-freebsd-hackers Thu May 2 7:12:10 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from tapil.com (dsl092-068-186.bos1.dsl.speakeasy.net [66.92.68.186]) by hub.freebsd.org (Postfix) with ESMTP id ACA4137B419 for ; Thu, 2 May 2002 07:12:04 -0700 (PDT) Received: from mulva.tapil.com (mulva.tapil.com [192.168.64.10]) by tapil.com (8.11.6/8.11.6) with ESMTP id g42EC4116132 for ; Thu, 2 May 2002 10:12:04 -0400 (EDT) (envelope-from lists-ma@tapil.com) Message-Id: <5.1.1.2.0.20020502100436.0292deb0@inside.tapil.com> X-Sender: madler@inside.tapil.com (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 5.1.1.3 (Beta) Date: Thu, 02 May 2002 10:12:01 -0400 To: hackers@freebsd.org From: Michael Adler Subject: bin/37665: restore does not recover uid, gid, etc. of symbolic link Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG /sbin/restore currently does not set the uid, gid, mode or times of symbolic links. In particular, the owner of the link is left as the owner of the restore process. Would someone consider checking in the patch I supplied in: http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/37665 The patch is a corrected version of one that has been floating around Usenet and the mailing list for some time. I verified it by dumping /usr to a new partition and comparing metadata and contents of the entire file system. --- tape.c.~1~ Wed Aug 1 05:00:28 2001 +++ tape.c Thu May 2 09:28:19 2002 @@ -559,6 +559,14 @@ return (genliteraldir(name, curfile.ino)); case IFLNK: + { + uid_t uid; + gid_t gid; + int ret; + + uid = curfile.dip->di_uid; + gid = curfile.dip->di_gid; + lnkbuf[0] = '\0'; pathlen = 0; getfile(xtrlnkfile, xtrlnkskip); @@ -567,7 +575,17 @@ "%s: zero length symbolic link (ignored)\n", name); return (GOOD); } - return (linkit(lnkbuf, name, SYMLINK)); + ret = linkit(lnkbuf, name, SYMLINK); + if (ret == GOOD) { + if (lchown(name, uid, gid)) + perror(name); + if (lchmod(name, mode)) + perror(name); + lutimes(name, timep); + } + /* symbolic link doesn't have any flags */ + return (ret); + } case IFIFO: vprintf(stdout, "extract fifo %s\n", name); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message