From owner-freebsd-current Fri Apr 20 7:30: 0 2001 Delivered-To: freebsd-current@freebsd.org Received: from mistral.imasy.or.jp (mistral.imasy.or.jp [202.227.24.84]) by hub.freebsd.org (Postfix) with ESMTP id 7E95C37B423 for ; Fri, 20 Apr 2001 07:29:53 -0700 (PDT) (envelope-from mistral@imasy.or.jp) Received: (from yohta@localhost) by mistral.imasy.or.jp (8.11.3/3.7Wpl2-010215) id f3KETm601670; Fri, 20 Apr 2001 23:29:48 +0900 (JST) From: mistral@imasy.or.jp (Yoshihiko SARUMARU) To: freebsd-current@FreeBSD.org Cc: dyama@bres.tsukuba.ac.jp, ush@netlab.is.tsukuba.ac.jp Subject: restore doesn't restore ownership of symbolic link Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Mailer: mnews [version 1.22PL5] 2001-02/07(Wed) Date: Fri, 20 Apr 2001 23:29:46 +0900 Message-ID: <010420232946.M0200857@mistral.imasy.or.jp> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hello all, I will report to all that restore command doesn't restore the property of symbolic link at all, that is owner, group, permissions and utime. Yamazaki-san first reported this issue on USENET at fj.os.bsd.freebsd. So I'm Cc'ing he and thread participater. I will propose below quick patch. How do you feel ? My environment is FreeBSD 4.3RC (today). Sorry I don't have current environment. Thanks ! before dump: mistral# ls -l /mnt4 total 1 -rw-r--r-- 1 root wheel 5 1/ 3 17:33 foo lrwxr-xr-x 1 yohta wheel 3 3/19 13:17 foos -> foo restore with 4.3-RC restore: mistral# dump 0f - /mnt4 | ( cd /tmp/tmp ; restore rf - ) ... mistral# ls -l /tmp/tmp total 53 -rw-r--r-- 1 root wheel 5 1/ 3 17:33 foo lrwx------ 1 root wheel 3 4/20 23:17 foos -> foo -rw------- 1 root wheel 52580 4/20 23:17 restoresymtable restore with patch'ed restore: mistral# dump 0f - /mnt4 | ( cd /tmp/tmp ; /home/yohta/restore/restore rf - ) ... mistral# ls -l total 53 -rw-r--r-- 1 root wheel 5 1/ 3 17:33 foo lrwxr-xr-x 1 yohta wheel 3 3/19 13:17 foos -> foo -rw------- 1 root wheel 52580 4/20 23:18 restoresymtable Here is sample patch: --- tape.c.orig Fri Apr 20 22:25:10 2001 +++ tape.c Fri Apr 20 23:12:07 2001 @@ -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,13 @@ "%s: zero length symbolic link (ignored)\n", name); return (GOOD); } - return (linkit(lnkbuf, name, SYMLINK)); + ret = linkit(lnkbuf, name, SYMLINK); + (void) lchown(name, uid, gid); + (void) lchmod(name, mode); + lutimes(name, timep); + /* symbolic link doesn't have any flags */ + return (ret); + } case IFIFO: vprintf(stdout, "extract fifo %s\n", name); -- Yoshihiko SARUMARU mail: mistral@imasy.or.jp web: http://www.imasy.or.jp/~mistral/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message