From: Jarkko Hietaniemi Date: Mon, 11 Mar 2002 03:36:32 +0000 (+0000) Subject: Re: [PATCH] for broken /proc/curproc/file on FreeBSD X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d103ec31e7c314096b02a22c4f9c43a9788a0d37;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH] for broken /proc/curproc/file on FreeBSD From: Nicholas Clark Date: Sun, 10 Mar 2002 18:17:50 +0000 Message-ID: <20020310181749.GC317@Bagpuss.unfortu.net> Subject: Re: [PATCH] for broken /proc/curproc/file on FreeBSD From: sthoenna@efn.org (Yitzchak Scott-Thoennes) Date: Sun, 10 Mar 2002 13:53:34 -0800 Message-ID: (and reenable the feature in freebsd, and move the freebsd pr url to perl.c) p4raw-id: //depot/perl@15160 --- diff --git a/hints/freebsd.sh b/hints/freebsd.sh index a553633..41fe55f 100644 --- a/hints/freebsd.sh +++ b/hints/freebsd.sh @@ -233,6 +233,3 @@ EOM esac EOCBU -# /proc/.../file is broken on FreeBSD -# see http://www.freebsd.org/cgi/query-pr.cgi?pr=35703 -d_procselfexe='undef' diff --git a/perl.c b/perl.c index 70ace15..4138e1b 100644 --- a/perl.c +++ b/perl.c @@ -3441,7 +3441,13 @@ S_procself_val(pTHX_ SV *sv, char *arg0) { char buf[MAXPATHLEN]; int len = readlink(PROCSELFEXE_PATH, buf, sizeof(buf) - 1); - if (len > 0) { + /* FreeBSD's implementation is acknowledged to be imperfect, sometimes + returning the text "unknown" from the readlink rather than the path + to the exacutable (or returing an error from the readlink). Any valid + path has a '/' in it somewhere, so use that to validate the result. + See http://www.freebsd.org/cgi/query-pr.cgi?pr=35703 + */ + if (len > 0 && memchr (buf, '/', len)) { sv_setpvn(sv,buf,len); } else { diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 65e7fcf..77056e4 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -2566,19 +2566,6 @@ known but the current suspect is the F library. Don't panic. Read INSTALL 'make test' section instead. -=head2 FreeBSD 4.3, 4.4, 4.5 fail lib/File/Spec/t/rel2abs2rel.t - -F tests that "`` works" by running a a perl 1 -liner in backticks, using "$^X" as the path to perl. It is known to be -failing on FreeBSD 4.3, 4.4 and 4.5, but only when run as part of make test. -This seems to be a kernel problem rather than perl - reading the symlink -F returns "unknown" rather than the path to perl, and a -kernel debugger reveals that variable C in -F is being incremented whenever -F fails to return the perl executable's path. -[If you find that if fails on other versions of FreeBSD, please use perlbug -to report them to us. If you are able to fix the bug, even better.] - =head2 HP-UX lib/posix Subtest 9 Fails When LP64-Configured If perl is configured with -Duse64bitall, the successful result of the