Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 02 May 2002 10:12:01 -0400
From:      Michael Adler <lists-ma@tapil.com>
To:        hackers@freebsd.org
Subject:   bin/37665: restore does not recover uid, gid, etc. of symbolic link
Message-ID:  <5.1.1.2.0.20020502100436.0292deb0@inside.tapil.com>

next in thread | raw e-mail | index | archive | help
/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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5.1.1.2.0.20020502100436.0292deb0>