From owner-freebsd-bugs Mon Nov 18 1:10: 5 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6CA8D37B401 for ; Mon, 18 Nov 2002 01:10:03 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2495643E4A for ; Mon, 18 Nov 2002 01:10:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gAI9A2x3002612 for ; Mon, 18 Nov 2002 01:10:02 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gAI9A2Z5002611; Mon, 18 Nov 2002 01:10:02 -0800 (PST) Date: Mon, 18 Nov 2002 01:10:02 -0800 (PST) Message-Id: <200211180910.gAI9A2Z5002611@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Peter Pentchev Subject: Re: bin/45333: [PATCH] New option -r for chown and chgrp Reply-To: Peter Pentchev Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/45333; it has been noted by GNATS. From: Peter Pentchev To: Oliver Fromme Cc: bug-followup@FreeBSD.org, Oliver Fromme Subject: Re: bin/45333: [PATCH] New option -r for chown and chgrp Date: Mon, 18 Nov 2002 11:03:30 +0200 On Sat, Nov 16, 2002 at 11:56:37AM +0100, Oliver Fromme wrote: > > >Number: 45333 > >Category: bin > >Synopsis: [PATCH] New option -r for chown and chgrp > >Originator: Oliver Fromme > >Release: FreeBSD -stable and -current > >Organization: > secnetix GmbH & Co KG, Munich, http://www.secnetix.de/ > >Environment: > > The patch presented applies both to -stable and -current > as of the date of submission (2002-11-16). > > >Description: > > The existing utilities touch(1) and truncate(1) support > an -r option to specify a reference file from which > information is to be taken (the time stamp in the case > of touch(1) and the file size in the case of truncate(1)). > > However, the utilities chown and chgrp (actually hardlinks > to the same binary) do not support such an option yet. > In shell scripts it is sometimes useful to copy ownership > and/or group membership from another file. Ordinarily, > you would have to use ls -l and parse the owner/group > columns, which is awkward, error-prone and inefficient. For the record, a cleaner way to do this would be to use the stat(1) utility, which is only available in -current for the present. [roam@ref5 ~]$ stat -f '%Su:%Sg' /etc/passwd root:wheel [roam@ref5 ~]$ Thus, something like "chown `stat -f '%Su:%Sg' $reffile` $file" would probably do what you need. Of course, a command-line option might be a bit easier to use :) G'luck, Peter -- Peter Pentchev roam@ringlet.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 This sentence contains exactly threee erors. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message