bin/145230: mtree(8) -P is broken because l* functions aren't being used

Garrett Cooper gcooper at
Wed Mar 31 07:20:08 UTC 2010

>Number:         145230
>Category:       bin
>Synopsis:       mtree(8) -P is broken because l* functions aren't being used
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 31 07:20:07 UTC 2010
>Originator:     Garrett Cooper
>Release:        9-CURRENT
Cisco Systems, Inc.
FreeBSD bayonetta.local 9.0-CURRENT FreeBSD 9.0-CURRENT #5 r205310: Sat Mar 20 01:32:51 PDT 2010     gcooper at bayonetta.local:/usr/obj/usr/src/sys/BAYONETTA  amd64
As discovered when reviewing mtree(8) as part of bin/144411, there are a number of items with -P that doesn't work... all chown, chmod, and stat calls for instance are the non-l variety, which means that unfortunately the file information for symlinks isn't being properly recorded.

Furthermore, in verify.c where lchown is used:

                        if (!(p->flags & (F_UID | F_UNAME)))
                                (void)printf(" (%s not created: user not specified)", type);
                        else if (!(p->flags & (F_GID | F_GNAME)))
                                (void)printf(" (%s not created: group not specified)", type);
                        else if (p->type == F_LINK) {
                                if (symlink(p->slink, path))
                                        (void)printf(" (symlink not created: %s)\n",
                                        (void)printf(" (created)\n");
                                if (lchown(path, p->st_uid, p->st_gid) == -1) {

the symlink data isn't being properly recorded; it's resolving the file instead, which may store incorrect data, or may have incorrect permissions.



More information about the freebsd-bugs mailing list