Bug 5237: "make check" fails when ${TRUE} is a multicall binary#2442
Bug 5237: "make check" fails when ${TRUE} is a multicall binary#2442renanrodrigo wants to merge 2 commits into
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
Polished the description to fit Anubis requirements. No Substantive change. |
b564217 to
612cb57
Compare
yadij
left a comment
There was a problem hiding this comment.
Okay, the ':' command redirection support checks out as good for bash, dash, ksh and csh (for Linux, BSD, and ARM devices). I am not able to test MinGW, Cygwin or MacOS shells specifically for redirection but they should also be okay since we already know they support the command itself.
kinkie
left a comment
There was a problem hiding this comment.
output redirection is done by the calling shell, there's no reason it shouldn't work.
MacOs' shell is either bash or zsh, also not concerned about it.
Good catch!
| else break; fi; \ | ||
| done; \ | ||
| if test "$$failed" -eq 0; then cp $(TRUE) $@ ; else exit 1; fi | ||
| if test "$$failed" -eq 0; then : > $@ && chmod +x $@ ; else exit 1; fi |
There was a problem hiding this comment.
Do we need to make $@ (i.e. squid-conf-tests) executable? Sorry, I cannot easily check this myself right now.
If the answer is "no", then should we switch from rather unusual/obscure redirection code that creates an empty executable file to simple and well-known touch that we already use in, for example, errors/Makefile.am?
There was a problem hiding this comment.
We do, because it is executed by other parts of automake. That is why it is true in the first place instead of just a touch (been there tried that years ago).
There was a problem hiding this comment.
How about using install -m 775 /dev/null $@ to avoid the unusual redirection then? Assuming true is around, install should also be since it is part of coreutils as well.
There was a problem hiding this comment.
i.e., s;cp $(TRUE);install -m 775 /dev/null/; instead of : > $@ && chmod +x
There was a problem hiding this comment.
We do, because it is executed by other parts of automake.
Which one? AFAICT, no part requires that squid-conf-tests file is executable, and no part executes that file. Replacing our cp with touch worked in my quick-and-dirty test.
(been there tried that years ago).
Can you give a specific reference? FWIW, there are other use cases where we do execute the copied binary (e.g., testHeaders), but this question is specific to squid-conf-tests.
There was a problem hiding this comment.
It seems @rousskov is right. This specific line is not building a target listed in TESTS, so it specifically does not need to be executable.
I have now run a complete re-test and the below change works well and simpler:
| if test "$$failed" -eq 0; then : > $@ && chmod +x $@ ; else exit 1; fi | |
| test "$$failed" -eq 0 && touch $@ || exit 1 |
There was a problem hiding this comment.
Please keep if...else structure instead of switching to an a && b || c puzzle.
There was a problem hiding this comment.
Off topic: @rousskov if that is such a "puzzle" why have you repeatedly asked me to implement it in other scripts instead of allowing if..else I design?
There was a problem hiding this comment.
FWIW I have tested it too, and from my results and at least the testHeaders file needs to be executable.
Just touching the file I get:
FAIL: testHeaders
=================
../cfgaux/test-driver: line 119: ./testHeaders: Permission denied
FAIL testHeaders (exit status: 126)
There was a problem hiding this comment.
Amos: Off topic: @rousskov if that is such a "puzzle" why have you repeatedly asked me to implement it in other scripts instead of allowing
if..elseI design?
I have not.
@renanrodrigo: FWIW I have tested it too, and from my results and at least the testHeaders file needs to be executable.
I am sorry you had wasted your time on this. My change request is about squid-conf-tests. It is not (and has never been) about testHeaders.
AFAICT, the minimal fix that would address this change request is the following (untested by me) change:
| if test "$$failed" -eq 0; then : > $@ && chmod +x $@ ; else exit 1; fi | |
| if test "$$failed" -eq 0; then touch $@ ; else exit 1; fi |
FWIW, we already use the same approach for two similar errors/Makefile.am targets: translate-warn and .po.lang.
Thanks for that info. I have now also tested zsh - it does work as needed. |
| else break; fi; \ | ||
| done; \ | ||
| if test "$$failed" -eq 0; then cp $(TRUE) $@ ; else exit 1; fi | ||
| if test "$$failed" -eq 0; then : > $@ && chmod +x $@ ; else exit 1; fi |
There was a problem hiding this comment.
Amos: Off topic: @rousskov if that is such a "puzzle" why have you repeatedly asked me to implement it in other scripts instead of allowing
if..elseI design?
I have not.
@renanrodrigo: FWIW I have tested it too, and from my results and at least the testHeaders file needs to be executable.
I am sorry you had wasted your time on this. My change request is about squid-conf-tests. It is not (and has never been) about testHeaders.
AFAICT, the minimal fix that would address this change request is the following (untested by me) change:
| if test "$$failed" -eq 0; then : > $@ && chmod +x $@ ; else exit 1; fi | |
| if test "$$failed" -eq 0; then touch $@ ; else exit 1; fi |
FWIW, we already use the same approach for two similar errors/Makefile.am targets: translate-warn and .po.lang.
|
@rousskov not a waste of time at all, just a double check (part of $dayjob anyway) I will apply your suggested change both to this PR and to the Ubuntu patch. Thanks for the review! |
rousskov
left a comment
There was a problem hiding this comment.
Please add your entry to CONTRIBUTORS. See the diff inside the failed CI test log for the right place to insert that entry.
|
|
||
| testHeaders: $(SOURCES) $(noinst_HEADERS) $(EXTRA_DIST) $(top_srcdir)/test-suite/testHeader.cc.in | ||
| $(MAKE) $(^:.h=.hdrtest) && cp $(TRUE) $@ | ||
| $(MAKE) $(^:.h=.hdrtest) && : > $@ && chmod +x $@ |
There was a problem hiding this comment.
@kinkie, will executing an empty file fail on native Windows builds? A "yes" answer is not necessarily a showstopper for this PR, especially if this testHeaders target is currently broken on native Windows builds for other reasons. Is it currently broken?
|
|
||
| testHeaders: $(SOURCES) $(noinst_HEADERS) $(EXTRA_DIST) $(top_srcdir)/test-suite/testHeader.cc.in | ||
| $(MAKE) $(^:.h=.hdrtest) && cp $(TRUE) $@ | ||
| $(MAKE) $(^:.h=.hdrtest) && : > $@ && chmod +x $@ |
There was a problem hiding this comment.
Should we use the chmod command found by AC_PATH_PROG in our ./configure?
| $(MAKE) $(^:.h=.hdrtest) && : > $@ && chmod +x $@ | |
| $(MAKE) $(^:.h=.hdrtest) && : > $@ && $(CHMOD) +x $@ |
or, if we also prefer to use touch for file creation:
| $(MAKE) $(^:.h=.hdrtest) && : > $@ && chmod +x $@ | |
| $(MAKE) $(^:.h=.hdrtest) && touch $@ && $(CHMOD) +x $@ |
FWIW, I recommend the latter because we use touch for similar purposes elsewhere and because many readers will find it easier to grok than the : redirection trick.
Thank you. I adjusted PR description to explain |
612cb57 to
85d9a57
Compare
testHeaders copies the 'true' binary to a file named testHeaders relying on the fact that GNU's true always exits 0. When 'true' implementation is a multicall binary (e.g., in rust-coreutils and on Alpine Linux), it cannot be called by other name. Create an empty executable file instead. squid-conf-tests also copied the 'true' binary, but that Makefile target is never executed and, hence, should not create an executable file.
85d9a57 to
ec1e2f8
Compare
|
Just updated the changeset - please let me know if this is good now ! |
rousskov
left a comment
There was a problem hiding this comment.
Thank you for polishing this up!
ec1e2f8 to
1f1a494
Compare
testHeaders copies the 'true' binary to a file named testHeaders relying on the fact that GNU's true always exits 0. When 'true' implementation is a multicall binary (e.g., in rust-coreutils and on Alpine Linux), it cannot be called by other name. Create an empty executable file instead. squid-conf-tests also copied the 'true' binary, but that Makefile target is never executed and, hence, should not create an executable file.
|
queued for backport to v7 |
Authored-by: Renan Rodrigo rr@ubuntu.com
testHeaders copies the 'true' binary to a file named testHeaders relying
on the fact that GNU's true always exits 0. When 'true' implementation
is a multicall binary (e.g., in rust-coreutils and on Alpine Linux), it
cannot be called by other name. Create an empty executable file instead.
squid-conf-tests also copied the 'true' binary, but that Makefile target
is never executed and, hence, should not create an executable file.