autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] modernize AS_UNSET a bit


From: Paolo Bonzini
Subject: Re: [PATCH] modernize AS_UNSET a bit
Date: Tue, 14 Oct 2008 08:45:57 +0200
User-agent: Thunderbird 2.0.0.17 (Macintosh/20080914)

Ralf Wildenhues wrote:
> Hi Paolo,
> 
> * Paolo Bonzini wrote on Tue, Oct 14, 2008 at 07:16:48AM CEST:
>> This patch modernizes a bit what we assume about unset.  In particular,
>> we assume that unset exists but might fail if the variable is not present.
>> We also assume that the user won't unset MAIL and MAILCHECK; we do that
>> in m4sh's initialization in a way that won't upset Bash 2.01 (did not
>> test it though, I don't have that shell).
>>
>> This in turn removes the need for _AS_UNSET_PREPARE.
> 
> Unfortunately, Libtool uses $as_unset, and I guess some other packages
> do, too.  :-/

No problem, I can leave _AS_UNSET_PREPARE in place and mark it as
deprecated.  Or it could make an as_func_unset shell function, and just
point $as_unset to that one (my preferred choice).

> And I'm not *that* much of an old shell expert.  But
> <http://www.in-ulm.de/~mascheck/bourne/> states that Version 7 sh didn't
> have unset at all.

But it didn't have "#" as a comment character either...  We could worry
about the System III shell not having unset, but since we use shell
functions, we're effectively not caring about anything earlier than SVR2.

We should indeed make sure that the prolog (the part "looking for a
better shell" is super-portable, but once we're past that we only have
to cater for bugs (such as errors when unsetting a variable that is not
set), rather than worry about unsupported features.

In particular, the only occurrences of "unset" in the prolog are

for as_var in ENV MAIL MAILPATH
do ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done

  --> workarounds for bugs in a shell with unset, no problem if <SVR2

{ unset CDPATH >/dev/null 2>&1 || :;}

  --> CDPATH not supported in shells with unset, no problem if <SVR2

for as_var in BASH_ENV ENV
      do { unset $as_var >/dev/null 2>&1 || :;}
      done

  --> suspicious?  Could do eval \$as_var=/dev/null before the unset

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]