develooper Front page | perl.perl5.porters | Postings from July 2019

[perl #134259] Faulty detection of macOS version in perl5.28

Thread Previous
From:
Tony Cook via RT
Date:
July 3, 2019 05:54
Subject:
[perl #134259] Faulty detection of macOS version in perl5.28
Message ID:
rt-4.0.24-1672-1562133282-1031.134259-15-0@perl.org
On Tue, 02 Jul 2019 16:40:36 -0700, mojca@macports.org wrote:
> According to one of our users the platform version detection on Darwin
> is not reliable.
> 
> The log
>     https://trac.macports.org/attachment/ticket/58572/main.log
> seems to report
>     Operating system version? [pro]
> which is likely due to some space in "uname -a" which usually reads
> something like
>     darwin mynames-macbook-pro.local 17.7.0 darwin kernel version
> 17.7.0: wed feb 27 00:43:23 pst 2019;
> root:xnu-4570.71.35~1release_x86_64 x86_64

A space in the host name seems kind of broken.  The code that extracts the version starts with:

	if $test -f $uname; then
		set X $myuname
		shift

The value of $uname is from uname -a lowercased by tr.  The set X ... and shift set $1 etc to the space separated values from that (shift removed the "X")

The code that I think ends up extracting the version on darwin is this fallback code:

		*)	case "$osname" in
			'') : Still unknown.  Probably a generic BSD.
				osname="$1"
				osvers="$3"
				;;
			esac
			;;

For my system uname -a | tr 'A-Z' 'a-z' is:

darwin pallas.tony.develop-help.com 17.7.0 darwin kernel version 17.7.0: wed apr 24 21:17:24 pdt 2019; root:xnu-4570.71.45~1/release_x86_64 x86_64

so $1 is "darwin" and $3 is 17.7.0

Maybe we'll need to add an extra guess to the list starting at

	: Half the following guesses are probably wrong... If you have better

though I'm not sure what filename we'd check.

Tony

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=134259

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About