Re: Bugs in config.guess

2019-12-21 Thread Torbjörn Granlund
Ben Elliston  writes:

  Fixed. Nice catch, thanks!

I found a million cghGhrTd files in /tmp on several test machines here.
Then I added "set -x" tp config.guess and then the error was glaring in
my face.  :-)

Thanks for fixing, your fix is very similar to what I did locally.

-- 
Torbjörn
Please encrypt, key id 0xC8601622



Re: Bugs in config.guess

2019-12-20 Thread Ben Elliston
On Sat, Dec 21, 2019 at 01:42:05AM +0100, Torbjörn Granlund wrote:

> BUG 1. Temp files/directories left behind due to repeated
> set_cc_for_build

Fixed. Nice catch, thanks!

commit c542caa003ff36a87393435756bb7764f9d723aa
Author: Ben Elliston 
Date:   Sat Dec 21 13:01:01 2019 +1100

* config.guess (set_cc_for_build): Prevent multiple calls by
chechking if $tmp is already set. We can't check CC_FOR_BUILD as
the user may set it externally. Thanks to Torbjörn Granlund for
the bug report.

Cheers,
Ben


signature.asc
Description: PGP signature


Re: Bugs in config.guess

2019-12-20 Thread Ben Elliston
On Sat, Dec 21, 2019 at 01:42:05AM +0100, Torbjörn Granlund wrote:

> BUG 2. Missing /proc/cpuinfo results is garbage printout.
> Please use
> 
> alpha:Linux:*:*)
>   case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 
> 2>/dev/null` in
> 
> instead.

Fixed:

commit 6f5b719255e306a37c9feb4ae649044db4ca7cf4
Author: Torbjörn Granlund 
Date:   Sat Dec 21 12:01:43 2019 +1100

* config.guess (alpha:Linux:*:*): Guard against missing
/proc/cpuinfo by redirecting standard error to /dev/null.

Signed-off-by: Ben Elliston 

I will work on the other bug now.

Cheers,
Ben

signature.asc
Description: PGP signature


Bugs in config.guess

2019-12-20 Thread Torbjörn Granlund
BUG 1. Temp files/directories left behind due to repeated
set_cc_for_build

This code invokes set_cc_for_build:

case "$UNAME_SYSTEM" in
Linux|GNU|GNU/*)
# If the system lacks a compiler, then just pick glibc.
# We could probably try harder.
LIBC=gnu

set_cc_for_build

Then, the larger case ... esac statement re-invokes set_cc_for_build for
a lot of different systems.

Why is this a problem?  Because set_cc_for_build set the variable "tmp"
to a temporary directory which is also creates, and which it then relies
on a trap function to delete.

When set_cc_for_build is re-invoked tmp is reassigned, and the old
directory is forgotten.

This can be fixed in a lot of ways.  Perhaps set_cc_for_build should set
a flag (set_cc_for_build_invoked=true) when invoked and not do anything
when re-invoked?




BUG 2. Missing /proc/cpuinfo results is garbage printout.

The code

alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in

is not good.  Please use

alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 
2>/dev/null` in

instead.  (Indeed, at least one place in config.guess already does
that.)

-- 
Torbjörn
Please encrypt, key id 0xC8601622