Bug 5278

Summary: Solaris fixes are not portable
Product: pkg-config Reporter: Daniel Macks <dmacks>
Component: srcAssignee: Tollef Fog Heen <tfheen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high CC: alan.coopersmith
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Make Solaris fixes more portable

Description Daniel Macks 2005-12-08 09:10:46 UTC
The check scripts all begin:

#! /bin/sh

# Do the Solaris Dance:
if [ ! -d ~root ]  ; then
    exec /usr/xpg4/bin/sh $0 "$@" 
fi

The condition being fixed is "non-POSIX shell" (according to ChangeLog), the fix
is specific to Solaris in its standard installation, and the test is "does user
'root' exist and does its home directory exist". Why not test for the problem
itself or for the platform where the problem is known? I have reports from users
who have no ~root (for various reasons) on machines that are not Solaris and
that do not have xpg4.

./configure should check $host for being solaris and either write the check
scripts directly or pass a token to check/Makefile that sets and env var that
the check scripts check to determine whether to relauch. Even better would be to
have ./configure check /bin/sh itself, and then fall through to an alternate
shell if needed, checking that it exists. That way any user who has non-POSIX
/bin/sh benefits, and such a person could use a flag to pass the correct shell path.
Comment 1 Alan Coopersmith 2008-08-04 19:35:10 UTC
That check actually seems to be attempting to test "Is this shell advanced
enough to translate ~root into root's home directory?"   (The Solaris /bin/sh
does not, and few sites have a directory literally named ~root.)

It would seem a safer check would be 
 if [ ! -d ~root -a -x /usr/xpg4/bin/sh ] ; then
Comment 2 Tim Rice 2008-09-01 14:01:30 UTC
Created attachment 18619 [details] [review]
Make Solaris fixes more portable

I've changed the Hardware & OS to all because it is not OSX specific and
there isn't a catagory for bash pretending to be /bin/sh.

The attached patch should make the fix much more portable.
Comment 3 Tollef Fog Heen 2009-12-06 13:23:30 UTC
I have changed this to use getconf PATH instead, which is the POSIX way of going about this.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.