From owner-freebsd-bugs@FreeBSD.ORG Thu May 24 12:20:09 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C0ACF16A469 for ; Thu, 24 May 2007 12:20:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 9A69A13C44B for ; Thu, 24 May 2007 12:20:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l4OCK9VB060376 for ; Thu, 24 May 2007 12:20:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l4OCK9i3060375; Thu, 24 May 2007 12:20:09 GMT (envelope-from gnats) Date: Thu, 24 May 2007 12:20:09 GMT Message-Id: <200705241220.l4OCK9i3060375@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: "Ighighi Ighighi" Cc: Subject: Re: bin/112920: [PATCH]: wrong realpath(1) behaviour X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Ighighi Ighighi List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2007 12:20:09 -0000 The following reply was made to PR bin/112920; it has been noted by GNATS. From: "Ighighi Ighighi" To: bug-followup@freebsd.org Cc: "Mark Linimon" Subject: Re: bin/112920: [PATCH]: wrong realpath(1) behaviour Date: Thu, 24 May 2007 07:46:58 -0400 ------=_Part_105313_23976923.1180007218246 Content-Type: multipart/alternative; boundary="----=_Part_105314_24976938.1180007218246" ------=_Part_105314_24976938.1180007218246 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 5/23/07, Mark Linimon wrote: > > it looks like the patch got trimmed. Please reply with a followup. > > mcl > At the last moment I decided against submitting it because it is far too trivial and because the CVS log available at http://www.FreeBSD.org/cgi/cvsweb.cgi/src/bin/realpath/realpath.c clearly shows that in version 1.3 the change was made to make it what it is today but without the rationale to justify the use of realpath(3) in such non-standard way. The CVS log (between double quotes): "use the problematic part of the path, instead of the argument, when reporting an error". Can anybody explain to me the usefulness of this from within a shell script (other than debugging realpath(3)) and provide real world examples ? If the need exists for this, why not use another name or create an option in realpath(1) for it ? It's completely useless in shell scripts when printing to stderr anyway, so we're left with interactive shells where these errors may be misleading. The attached patch also adds preliminary getopt() support for invocations using "--" as in "realpath -- /path/file". A nice option to implement would be "-q" to turn off those error messages. The POSIX page on realpath(3): http://www.opengroup.org/onlinepubs/000095399/functions/realpath.html ------=_Part_105314_24976938.1180007218246 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
On 5/23/07, Mark Linimon <linimon@lonesome.com> wrote:
it looks like the patch got trimmed.  Please reply with a followup.

mcl

At the last moment I decided against submitting it because it is far too trivial and
because the CVS log available at
http://www.FreeBSD.org/cgi/cvsweb.cgi/src/bin/realpath/realpath.c
clearly shows that in version 1.3 the change was made to make it what it is today
but without the rationale to justify the use of realpath(3) in such non-standard way.
The CVS log (between double quotes):
"use the problematic part of the path, instead of the argument, when reporting an error".

Can anybody explain to me the usefulness of this from within a shell script (other than
debugging realpath(3)) and provide real world examples ?  If the need exists for this,
why not use another name or create an option in realpath(1) for it ?  It's completely
useless in shell scripts when printing to stderr anyway, so we're left with interactive
shells where these errors may be misleading.

The attached patch also adds preliminary getopt() support for invocations using "--" as
in "realpath -- /path/file".  A nice option to implement would be "-q" to turn off those
error messages.

The POSIX page on realpath(3):
http://www.opengroup.org/onlinepubs/000095399/functions/realpath.html

------=_Part_105314_24976938.1180007218246-- ------=_Part_105313_23976923.1180007218246 Content-Type: text/x-patch; name=realpath.c.patch; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: base64 X-Attachment-Id: f_f235rif5 Content-Disposition: attachment; filename="realpath.c.patch" LS0tIHJlYWxwYXRoLmMub3JpZwlUdWUgQXByICA2IDE2OjA2OjUwIDIwMDQKKysrIHJlYWxwYXRo LmMJVGh1IE1heSAyNCAwNzowNToyNSAyMDA3CkBAIC00NCwxMyArNDQsMjQgQEAKIHsKIAljaGFy IGJ1ZltQQVRIX01BWF07CiAJY2hhciAqcDsKKwlpbnQgY2g7CiAKLQlpZiAoYXJnYyA9PSAyKSB7 Ci0JCWlmICgocCA9IHJlYWxwYXRoKGFyZ3ZbMV0sIGJ1ZikpID09IE5VTEwpCi0JCQllcnIoMSwg IiVzIiwgYnVmKTsKLQl9IGVsc2UKKwl3aGlsZSAoKGNoID0gZ2V0b3B0KGFyZ2MsIGFyZ3YsICIi KSkgIT0gLTEpCisJCXN3aXRjaChjaCkgeworCQljYXNlICc/JzoKKwkJZGVmYXVsdDoKKwkJCXVz YWdlKCk7CisJCX0KKwlhcmdjIC09IG9wdGluZDsKKwlhcmd2ICs9IG9wdGluZDsKKworCWlmIChh cmdjICE9IDEpCiAJCXVzYWdlKCk7Ci0JKHZvaWQpcHJpbnRmKCIlc1xuIiwgcCk7CisKKwlpZiAo KHAgPSByZWFscGF0aCgqYXJndiwgYnVmKSkgPT0gTlVMTCkKKwkJZXJyKDEsICIlcyIsICphcmd2 KTsKKwllbHNlCisJCSh2b2lkKXByaW50ZigiJXNcbiIsIHApOwogCWV4aXQoMCk7CiB9CiAK ------=_Part_105313_23976923.1180007218246--