From owner-freebsd-bugs Wed Oct 6 15: 2:29 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 003BF1576C for ; Wed, 6 Oct 1999 15:02:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id PAA61600; Wed, 6 Oct 1999 15:00:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from internal.mail.demon.net (internal.mail.demon.net [193.195.224.3]) by hub.freebsd.org (Postfix) with ESMTP id 51091152B5 for ; Wed, 6 Oct 1999 14:56:26 -0700 (PDT) (envelope-from fanf@demon.net) Received: from fanf.eng.demon.net (fanf.eng.demon.net [195.11.55.89]) by internal.mail.demon.net with ESMTP id WAA06083; Wed, 6 Oct 1999 22:55:19 +0100 (BST) Received: from fanf by fanf.eng.demon.net with local (Exim 3.03 #2) id 11Yz1M-000MdD-00 for FreeBSD-gnats-submit@freebsd.org; Wed, 06 Oct 1999 22:54:48 +0100 Message-Id: Date: Wed, 06 Oct 1999 22:54:48 +0100 From: Tony Finch Reply-To: fanf@demon.net To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/14171: [PATCH] create symbolic links using mtree Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 14171 >Category: bin >Synopsis: [PATCH] create symbolic links using mtree >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Oct 6 15:00:01 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Tony Finch >Release: FreeBSD 3.3-STABLE-19990927 i386 >Organization: Demon Internet Ltd >Environment: >Description: It would be useful to be able to create hierarchies containing symbolic links using mtree, so I implemented this patch. >How-To-Repeat: >Fix: --- /usr/src/usr.sbin/mtree/verify.c Wed Sep 1 17:24:19 1999 +++ /usr/src/usr.sbin/mtree/verify.c Wed Oct 6 22:45:47 1999 @@ -160,6 +160,7 @@ { register int create; register char *tp; + const char *type; for (; p; p = p->next) { if (p->type != F_DIR && (dflag || p->flags & F_VISIT)) @@ -167,18 +168,32 @@ (void)strcpy(tail, p->name); if (!(p->flags & F_VISIT)) (void)printf("missing: %s", path); - if (p->type != F_DIR) { + if (p->type != F_DIR && p->type != F_LINK) { putchar('\n'); continue; } create = 0; + if (p->type == F_LINK) + type = "symlink"; + else + type = "directory"; if (!(p->flags & F_VISIT) && uflag) if (!(p->flags & (F_UID | F_UNAME))) - (void)printf(" (directory not created: user not specified)"); + (void)printf(" (%s not created: user not specified)", type); else if (!(p->flags & (F_GID | F_GNAME))) - (void)printf(" (directory not created: group not specified)"); - else if (!(p->flags & F_MODE)) + (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", + strerror(errno)); + else + (void)printf(" (created)\n"); + if (lchown(path, p->st_uid, p->st_gid)) + (void)printf("%s: user/group not modified: %s\n", + path, strerror(errno)); + continue; + } else if (!(p->flags & F_MODE)) (void)printf(" (directory not created: mode not specified)"); else if (mkdir(path, S_IRWXU)) (void)printf(" (directory not created: %s)", >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message