New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
configure fails when run with a posix shell supporting $LINENO (e.g. dash 0.5.9 and many others) #23448
Comments
comment:1
After much suffering, I found out the code at fault in
introduced by e03f296. I guess the idea is to re-run configure ( When using debian's dash, it turns out that before reaching this code configure decides to rerun itself and for that reason it sets Hence, the test above is wrong (IMO it should only test |
New commits:
|
Commit: |
Branch: u/tornaria/23448 |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:4
The first patch makes This happens because |
comment:7
I'm a bit lost here. I think I understood the problem, and I understand what your patch does. However, I don't see how that actually fixes the problem. |
This comment has been minimized.
This comment has been minimized.
comment:8
General side comment: when fixing a bug, three things have to be asked: (1) what is the problem? (2) what does the patch do? (3) how does (2) actually fix (1)? In this case, I am missing (3). |
comment:9
Thanks, I tried to explain it above, but I will be more detailed: (1) by the time configure reaches the line (2) the patch 60ac900 moves the block of code to before calling other tests. (3) this fixes (1) for recent dash because now |
comment:10
It remains to explain e77704b. I'm actually confused as to the intent of doing But the problem is that for some older versions of dash the variable Maybe it's better to change 60ac900 so that the code in question is run even earlier, before |
comment:11
I understand better now. The first thing When we run configure on debian, When I run configure on my system, As to e77704b, it is necessary when the following conditions are met:
What happens in this case is that configure decides that the current shell (old version of dash) is not good, so it looks for a better one. It decides The only way to fix this I could find is to change the test to The suggestion of moving the test earlier is not possible: if placed before the line
it is too early and it won't be included in But after this line it is already too late ( [1] to be explicit, the first problem is the substitution |
Author: tornaria |
comment:13
Author name |
comment:14
Wouldn't it make sense to move the block
even higher in the file, as early as possible? |
Changed branch from u/tornaria/23448 to u/tornaria/23448-v2 |
comment:15
I've changed the patch so that this is done immediately after AC_INIT, as per this paragraph in autoconf documentation: I put the new patch as a single commit in a new branch, I'm not sure if that's proper etiquette, please let me know otherwise. New commits:
|
Changed author from tornaria to Gonzalo Tornaría |
Changed branch from u/tornaria/23448-v2 to u/tornaria/23448-v3 |
Replying to @tornaria:
Simple proposal: change the I think that is a much simpler solution which would also solve your problem. Comments? |
comment:21
Replying to @jdemeyer:
I wouldn't say the current proposal is not simple, in fact my current patch has this in
while for your proposal it would be:
So it's essentially the same except the first one will try to find bash and reexec instead, we avoid tracking all the paths that lead to running configure. Note that I didn't write the code above, it was already written and the only problem was that it was moved to run too late. With the warning I added (needs to be immediately after calling AC_INIT) it should be safe. |
comment:22
Replying to @jdemeyer:
Another comment: it just happens that I'm running a new version of This will be a problem for everybody once the main distros pick up a new version of dash, so fixing this now is investing for the future :-) (same applies to #23451) |
comment:23
Replying to @tornaria:
"apples and oranges are essentially the same except they are different" :-) As this ticket shows, it's precisely the reexec part which is fragile, so I suggest just dropping that. |
comment:24
Replying to @jdemeyer:
Not quite, the "fragile" part is using the positional parameters "$0" and "$@", but that's very clearly documented in the autoconf manual that the parameters must be used immediately after calling AC_INIT since other macros will change their value. I would argue that if configure requires The standard way to instal a random program from source is to run
which won't work in your proposal. |
Reviewer: Dima Pasechnik |
comment:25
I am seeing a similar problem on FreeBSD, where My current workaround is to simply edit The branch on this ticket does not work for me, as I think we should give up on even trying to run configure with |
comment:27
Would it be acceptable to simply add to |
comment:28
If my solution doesn't fix your bug, then it may be different bug. Can you please document clearly what fails before/after this patches? I suggest that you include detailed information of the exact shell with version and where to get it / how to build it, as I did in my report. AFAICT the behaviour with any posix-compatible shell would be to run configure under bash. This was broken before, and it should be fixed after. Did you remember to run I just tried to run configure with the three BSD shells that I have available in my distro:
I can tell you that those three exhibit the same behaviour as dash 0.5.9.1, namely configure fails in the same way before my patch, and works after my patch. While I was at it, I also tried all the other posix shells I have available in my distro:
with the same result (configure is broken before, works after). Note that I am NOT claiming one can build the whole of sage with those shells, but only that configure can be run successfully. In fact, #23451 reports and fixes two issues down the line. Also note that this works by switching to bash, so it's still a requirement, but it will pick bash from your PATH so you don't need to put it in The patch I proposed fixes the issue I reported in a reasonable way without breaking anything that already works. It is really simple, just changing the order of some lines to match what is required explicitly by autoconf documentation, and some little details. I explained and documented everything that's going on. I documented above 8 different shells for which configure is broken and fixed by this. The fact that there may be OTHER bugs that my patch won't fix is a non sequitur for rejecting it, and I even reported at least one more (#23451). I spent a fair number of hours back in SD87 to understand and diagnose this and the other bug, fix it and document the reasons for the bug and the fix, and the situation is that 6 months after I still cannot build Sage in void linux. More important, as I argued above, is that is only matter of time until "more mainstream" distros pick the new version of dash that will break sage building. Let me summarise the situation. Before the patch: After the patch: Can we please:
Fixing other steps of the build is a non-goal of the current ticket. |
Changed reviewer from Dima Pasechnik to Jeroen Demeyer, Dima Pasechnik |
comment:29
OK, sorry for noise. It looks good. |
comment:30
Replying to @dimpase:
Thanks, let me know if I can help you diagnosing the issue you have with FreeBSD. |
Changed reviewer from Jeroen Demeyer, Dima Pasechnik to Dima Pasechnik |
comment:31
I never said that I agreed with the current branch. |
comment:32
Replying to @jdemeyer:
I take "reviewer" in sense of publishing, not as "signed off by". This patch is an improvement for freebsd and other non-*ash shells too. |
Changed branch from u/tornaria/23448-v3 to |
When using an unpatched recent version of dash to run configure, this happens:
My
/bin/sh
happens to be this shell, so just runningmake
is broken in my system.After much suffering, I found out the code at fault in
configure.ac
:introduced by e03f296.
I guess the idea is to re-run configure ($0) with the same arguments ($ @) but using bash. However, by the time we reach the line
exec $CONFIG_SHELL $0 "$@"
, the positional parameters have been obliterated by previous tests. Indeed, in the example above it happens to runbash ./configure x make
which produces the error.When using debian's dash, it turns out that before reaching this code configure decides to rerun itself and for that reason it sets
CONFIG_SHELL=/bin/sh
(to avoid a recursion).Hence, the test above is wrong (IMO it should only test
$BASH_VERSION
).CC: @jdemeyer
Component: build: configure
Keywords: sd87
Author: Gonzalo Tornaría
Branch/Commit:
89212b4
Reviewer: Dima Pasechnik
Issue created by migration from https://trac.sagemath.org/ticket/23448
The text was updated successfully, but these errors were encountered: