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: [EMAIL PROTECTED]       web: http://www.imasy.or.jp/~mistral/
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-current" in the body of the message
> 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to