cygwin build_alias issue (and a possible workaround...)
Bogdan Vacaliuc
bvacaliuc at ngit.com
Sat Sep 4 17:46:25 UTC 2004
Scott,
> >Oops, I was sloppy. I should have written (binary) 240; I
> just get so
> >used to that hex prefix...
>
> Or maybe (decimal) 240... ;-)
I need to get some sleep...
> It builds. Twice now, on this (my work) machine. I'll have
> to test on my home machine too.
This is one of those ugly workarounds we hate using because its not based on
a sound understanding and trap of the problem...
> I tried to configure and make all BSPs, just for fun:
> ../rtems-4.6.1/configure --target=m68k-rtems --disable-posix
> --disable-networking --disable-cxx 2>&1 | tee -a log.txt
>
> gmake all 2>&1 | tee -a log.txt
>
> And here comes the error (from gmake all):
>
> configure: configuring in libcsupport
> configure: running /bin/bash
So its only reducing the probability of occurrence by some (clearly)
measurable degree. The good thing is that we can get some more info from
the build system by playing with some of the script's internals.
I'm going to send this post out now (though it is really unfinished) since
I've been working on it off-and-on for the last couple of hours. I'm going
to follow up to Scott's last post shortly.
-bogdan
For those that are interested, here is more info which will hopefully lead
us to the real problem:
//
// regarding strace
//
strace cannot simply be used in situations where the exit code is meaningful
to a script:
[/tmp] expr xbuild_alias : '.*[^_xbuildas]'
0
[/tmp] echo $status
1
[/tmp] strace -f -o /tmp/strace.log expr xbuild_alias : '.*[^_xbuildas]'
0
[/tmp] echo $status
0
However, the exit status *is* captured in the strace output:
[cygwin:/tmp] grep do_exit /tmp/strace.log
285 37317 [main] expr 2624 do_exit: do_exit (1), exit_state 0
^^^
Correspondingly:
[/tmp] expr xbuild_alias : '.'
1
[/tmp] echo $status
0
[/tmp] strace -f -o /tmp/strace.log expr xbuild_alias : '.'
1
[/tmp] echo $status
0
[/tmp] grep do_exit /tmp/strace.log
287 31780 [main] expr 1872 do_exit: do_exit (0), exit_state 0
^^^
However, we can use another script to run strace in a wrapper:
(reference: http://linuxgazette.net/issue75/lg_answer.html)
[/tmp] cat /usr/local/bin/strace.sh
#!/bin/sh
tmp=/tmp/$$.strace
cmd="$1"
shift
strace -f -o $tmp "$cmd" "$@"
# NOTE: cygwin-specific parsing, YMMV
exit `grep do_exit $tmp | tail -1 | cut -d' ' -f12 | cut -c2`
And now:
[/tmp] strace.sh expr xbuild_alias : '.*[^_xbuildas]'
0
[/tmp] echo $status
1
Unfortunately, the script is OS-specific (rather, strace implementation
specific) and is quite likely to be fragile (the cut -d' ' -f12,
expecially). Still it may take us at least some of the way by allowing us
to strace the offending expr commands.
//
// regarding bash/expr
//
So, it would appear as if executing expr in a subshell with some disk
logging hides the problem. I started experimenting with not logging (yet
still using the script - seemed ok), and finally with just:
[/opt/rtems-4.6/bin] cat expr
#!/bin/sh
/usr/bin/expr "$@"
Using the above, allowed the error to occur after 4 successful passes.
SO. Were not out of the woods yet.
More information about the users
mailing list