bin/112920: [PATCH]: wrong realpath(1) behaviour
Ighighi Ighighi
ighighi at gmail.com
Thu May 24 12:20:09 UTC 2007
The following reply was made to PR bin/112920; it has been noted by GNATS.
From: "Ighighi Ighighi" <ighighi at gmail.com>
To: bug-followup at freebsd.org
Cc: "Mark Linimon" <linimon at lonesome.com>
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 <linimon at 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
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
<br><div><span class="gmail_quote">On 5/23/07, <b class="gmail_sendername">Mark Linimon</b> <<a href="mailto:linimon at lonesome.com">linimon at lonesome.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
it looks like the patch got trimmed. Please reply with a followup.<br><br>mcl<br></blockquote></div><br>At the last moment I decided against submitting it because it is far too trivial and<br>because the CVS log available at
<br><a href="http://www.FreeBSD.org/cgi/cvsweb.cgi/src/bin/realpath/realpath.c">http://www.FreeBSD.org/cgi/cvsweb.cgi/src/bin/realpath/realpath.c</a><br>clearly shows that in version 1.3 the change was made to make it what it is today
<br>but without the rationale to justify the use of realpath(3) in such non-standard way.<br>The CVS log (between double quotes):<br>"use the problematic part of the path, instead of the argument, when reporting an error".
<br><br>Can anybody explain to me the usefulness of this from within a shell script (other than<br>debugging realpath(3)) and provide real world examples ? If the need exists for this,<br>why not use another name or create an option in realpath(1) for it ? It's completely
<br>useless in shell scripts when printing to stderr anyway, so we're left with interactive<br>shells where these errors may be misleading. <br><br>The attached patch also adds preliminary getopt() support for invocations using "--" as
<br>in "realpath -- /path/file". A nice option to implement would be "-q" to turn off those<br>error messages.<br><br>The POSIX page on realpath(3):<br>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/realpath.html">http://www.opengroup.org/onlinepubs/000095399/functions/realpath.html</a><br>
<br>
------=_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--
More information about the freebsd-bugs
mailing list