cvs commit: src/etc/mtree BSD.local.dist BSD.usr.dist

Brian F. Feldman green at FreeBSD.ORG
Tue Mar 30 08:28:03 PST 2004


Andrey Chernov <ache at nagual.pp.ru> wrote:
> On Tue, Mar 30, 2004 at 10:33:13AM -0500, Brian F. Feldman wrote:
> The situation is not so easy, it depends on which mtree mode you use (-P
> or -L). I'll try to be short. Imagine, say, you have /var/mail linked to
> /disk1/mail. To enforce correct permissions on /disk1/mail you need to use
> 
> MTREE_FOLLOWS_SYMLINKS= -L
> 
> in your /etc/make.conf (or set it in the env. etc). At least in the past 
> some ports try to change /var/mail permission, so it is real life example.
> 
> But, once you use -L, all symlinks in the BSD.*.dist becomes 
> just directories and mtree will reports mismatch.

Okay, now I understand what the situation is that would make this not work 
well.  Why not just warn and ignore it, then?  The proper fix would be to 
resolve, at the end of reading the mtree spec file, any type=link (when -L) 
and fail if they cannot be dereferenced internally.

--- spec.c      19 Nov 2003 15:28:21 -0000      1.21
+++ spec.c      30 Mar 2004 16:27:35 -0000
@@ -147,7 +147,10 @@
                        errx(1, "filename %s is ill-encoded", p);
                set(NULL, centry);
 
-               if (!root) {
+               if (ftsoptions & FTS_LOGICAL && centry->type == F_LINK) {
+                       warnx("line %d: symbolic link %s ignored in -L mode",
+                           lineno, centry->name);
+               } else if (!root) {
                        last = root = centry;
                        root->parent = root;
                } else if (last->type == F_DIR && !(last->flags & F_DONE)) {


-- 
Brian Fundakowski Feldman                           \'[ FreeBSD ]''''''''''\
  <> green at FreeBSD.org                               \  The Power to Serve! \
 Opinions expressed are my own.                       \,,,,,,,,,,,,,,,,,,,,,,\




More information about the cvs-src mailing list