From owner-freebsd-current Fri Apr 20 8:57: 7 2001 Delivered-To: freebsd-current@freebsd.org Received: from feral.com (feral.com [192.67.166.1]) by hub.freebsd.org (Postfix) with ESMTP id 3757A37B424 for ; Fri, 20 Apr 2001 08:56:59 -0700 (PDT) (envelope-from mjacob@feral.com) Received: from beppo (beppo [192.67.166.79]) by feral.com (8.9.3/8.9.3) with ESMTP id IAA15003; Fri, 20 Apr 2001 08:56:38 -0700 Date: Fri, 20 Apr 2001 08:56:37 -0700 (PDT) From: Matthew Jacob Reply-To: mjacob@feral.com To: Yoshihiko SARUMARU Cc: freebsd-current@FreeBSD.ORG, dyama@bres.tsukuba.ac.jp, ush@netlab.is.tsukuba.ac.jp Subject: Re: restore doesn't restore ownership of symbolic link In-Reply-To: <010420232946.M0200857@mistral.imasy.or.jp> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG It seems good, but shouldn't it be: ret = linkit(lnkbuf, name, SYMLINK); if (ret == 0) { 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); On Fri, 20 Apr 2001, Yoshihiko SARUMARU wrote: > 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 > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message