mainAutoconf - Support: sr #110656, On AT&T UnixPC (3b1),...

 
 

sr #110656: On AT&T UnixPC (3b1), parameter $3 gets overwritten (cleared) by call to subfunction.

Submitter:  Alain Knaff <alainknaff>
Submitted:  Sun 15 May 2022 05:55:22 PM UTC
   
 
Priority:  * 5 - Unprioritized Severity:  3 - Normal
Status:  Wont Do Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 29 May 2022 12:01:43 AM UTC, comment #6: 


> dash is much less portable than bash, due to its very incomplete autoconf script

Oh, I meant only that dash once working should be a better shell to use for running 'configure' and similar shell scripts on the 3b1, since dash should use less memory and CPU than bash.

If dash's Autoconf script is incomplete for the 3b1, perhaps you can contact dash's maintainers and see if they'd be willing to accept patches that would port dash to the 3b1.

Another possibility is to tune Bash so that it uses less memory. This could be something as simple as running its configure script with --disable-nls CFLAGS='-O2' etc., or by having a new compile-time option that you invent that makes tables smaller or omits other Bash features.

Either of these approaches might mean less work for you in the long run (it depends on how long-run your needs are).

Paul Eggert <eggert>
Group administrator
Fri 27 May 2022 09:00:43 PM UTC, comment #5: 


comment #4:

> > Only snag was that it failed to write out confcache and Cache variables to config.log due to out of memory condition.
> I suggest using dash instead of bash for this sort of thing.


Thanks for the suggestion

> The 'configure' script should be portable to any POSIX-compatible shell, and dash should be POSIX-compatible and should require fewer resources than bash.


I would have thought so too about portability, but actually it turns out that dash is much less portable than bash, due to its very incomplete autoconf script. Compiling it for UnixPC requires many more custom adaptions with just as much opportunities for errors.
Unless I maybe got the wrong version, I've got here 0.5.11.5 fetched via apt source. Unfortunately, I couldn't find a plain ftp or http download location.

Alain Knaff <alainknaff>
Fri 27 May 2022 07:38:42 PM UTC, comment #4: 


> Only snag was that it failed to write out confcache and Cache variables to config.log due to out of memory condition.

I suggest using dash instead of bash for this sort of thing. The 'configure' script should be portable to any POSIX-compatible shell, and dash should be POSIX-compatible and should require fewer resources than bash.

Paul Eggert <eggert>
Group administrator
Fri 27 May 2022 08:38:00 AM UTC, comment #3: 

comment #2:

> For this one I think we'll also suggest getting a working shell. The 3b1 is a museum piece and it's not reasonable to expect Autoconf to make nontrivial changes to run on a 35-year-old operating system.
>
> > configure prints out "positional parameters were not saved." early on the the configure process, so it seems to notice the problem, but then fails to act on it
>
> This is part of its attempt to find a working shell. If you provide one it should work. If not, I expect it goes ahead anyway (and obviously fails).


Indeed, after getting bash (which proved to be not so easy, eventually I had to set up a cross-compiler...), I got it to run  till the end, and it made the needed Makefile and config.h all right.
Only snag was that it failed to write out confcache and Cache variables to config.log due to out of memory condition.

Possibly this is due to creating too many subshells due to the following construct:

 for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do ...

Backquotes create a subshell, parenthesis around "set" create another, and probably pipe another as well. This is not a problem on modern machines which have enough memory and support copy-on-write. However, it was enough to push the UnixPC over the limit.

Fortunately, as said, these errors didn't prevent creation of Makefile and config.h

Another weird thing is that right after start it says:

as_fn_failure succeeded

However, this message doesn't seem to prevent the rest of the script to run.

Alain Knaff <alainknaff>
Mon 16 May 2022 05:37:32 AM UTC, comment #2: 

For this one I think we'll also suggest getting a working shell. The 3b1 is a museum piece and it's not reasonable to expect Autoconf to make nontrivial changes to run on a 35-year-old operating system.

> configure prints out "positional parameters were not saved." early on the the configure process, so it seems to notice the problem, but then fails to act on it


This is part of its attempt to find a working shell. If you provide one it should work. If not, I expect it goes ahead anyway (and obviously fails).

Paul Eggert <eggert>
Group administrator
Sun 15 May 2022 06:18:24 PM UTC, comment #1: 

I just noticed: this obviously affects other positional parameters too, such as $2 used for name of object to test for (#include file, etc.)

Fix would be in same vain.

Alain Knaff <alainknaff>
Sun 15 May 2022 05:55:22 PM UTC, original submission:  

In many tests in autoconf generated configure scripts we have the following pattern:

ac_fn_c_check_header_compile ()
{
   ...
   do preparatory work
   ...
if ac_fn_c_try_compile "$LINENO"; then :
  eval "$3=yes"
else
  eval "$3=no"
fi
 ...
}


On entry to ac_fn_c_check_header_compile, positional parameter 3 contains the name of the variable where to put the test result.
However, on AT&T UnixPC, this is cleared by any call to another function (such as ac_fn_c_try_compile in this case), leading to an eval that does just "=yes", which obviously fails, as it will try to look for a command named "=yes"

Solution: store $3 in a variable:

ac_fn_c_check_header_compile ()
{
   result_var=$3
   ...
   do preparatory work
   ...
if ac_fn_c_try_compile "$LINENO"; then :
  eval "$result_var=yes"
else
  eval "$result_var=no"
fi
 ...
}

Interestingly enough, configure prints out "positional parameters were not saved." early on the the configure process, so it seems to notice the problem, but then fails to act on it.

Alain Knaff <alainknaff>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by eggert (Posted a comment)
  • -email is unavailable- added by alainknaff (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-05-16 eggert StatusNone Wont Do
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code