Repository navigation
Conversation
|
IIUC this is to support very old UNIX systems whose shells don't handle empty strings
correctly. curl's configure seems to use the x style of test fairly
consistently (outside nettle detection) from what I see, so this will likely
have an impact on those systems. I have no idea if any such system is still a
viable curl target (e.g. it has 64-bit int support, etc.) and therefore whether
this could cause configure failure there.
|
|
I wonder if it was used consistently? The impression I got was that it was accidental, at best incomplete. The internet says this hack was necessary for systems where a edit: historical reason for the x-hack explained via this shellcheck comment: |
|
What's the reason for removing them?
|
shellcheck now warns about this, and this hack has been deleted from Aside from that, they make the source code difficult to read, grep or edit. The simplest boolean comparisons are living in the code in dozens of slightly different variations. Without a particular reason or consistency. Mixed with modern/normal syntax, which would have failed on such very old system anyway. edit: more info: Excerpt: |
|
I removed them from curl-config (because they made red CI jobs). But I think shellcheck shouldn't complain about them because they are not errors. |
|
They do add friction to maintaining autotools scripts. I agree with shellcheck flagging it. It seems unlikely that an ancient/old shell combined with rare/crafted input would pass Which would be another option to improve this, but that'd assume those ancient systems Is there a known env or system that requires this? Has there been a report about a missing |
|
Has there been a report about a missing x-hack?
We'll find out once this is submitted!
|
|
The |
|
Detailed write-up, with systems and versions and case descriptions: |
83f5ef6 to
12fc7dd
Compare
695299e to
f80cb2e
Compare
e3efbdb to
837de4c
Compare
if expressions
acinclude.m4 drop x
configure.ac drop x
remaining
m4 drop x
docs drop x
configure.ac fixup quotes
m4 fixup quotes
configure.ac add missing quotes
libcurl.m4 add missing quotes
xc-val-flgs.m4 add missing quotes
configure.ac add missing quotes to numeric comparisons
libcurl.m4 add missing quotes to numeric comparisons
m4 add missing quotes to numeric comparisons
use -n/-z instead of `(!=|=) (""|)`
`test ! -z` -> `test -n`
unfold if
replace -a -o with `&&/|| test`
curl-config.in: replace `-a` with `&& test`
double quote all string literals in comparisons
formatting
double quote all string literals in comparisons 2
sp
quote `if` literals on the left side
configure.ac move `if` literals to right side
These are env that are expected to contain yes/no/empty, but just in case
|
Reworked this to keep the x-hacks for cases where the value is coming |
Reported-by: Michael Hendricks Fixes curl#20889 Regression from 8db0e28 curl#18189
Configure LibreSSL autotools job with `--with-ngtcp=<path>` instead of adding ngtcp2 to `PKG_CONFIG_PATH`. To test this way of configuration in CI and test for the regression reported in #20889. Turns out this way of configuration isn't affected by the detection issue in this particular case. It also works for other backends except for these two, subject to separate fixes: - BoringSSL fix: ngtcp2/ngtcp2#2070 - GnuTLS fix and BoringSSL workaround: #20920 Follow-up to 666db80 #20891 Follow-up to 8db0e28 #18189 Follow-up to 9950066 #18028 #18022 Closes #20926
Regression since curl 8.18.0. Reported-by: Michael Hendricks Fixes curl#20889 Regression from 8db0e28 curl#18189 Closes curl#20891
Configure LibreSSL autotools job with `--with-ngtcp=<path>` instead of adding ngtcp2 to `PKG_CONFIG_PATH`. To test this way of configuration in CI and test for the regression reported in curl#20889. Turns out this way of configuration isn't affected by the detection issue in this particular case. It also works for other backends except for these two, subject to separate fixes: - BoringSSL fix: ngtcp2/ngtcp2#2070 - GnuTLS fix and BoringSSL workaround: curl#20920 Follow-up to 666db80 curl#20891 Follow-up to 8db0e28 curl#18189 Follow-up to 9950066 curl#18028 curl#18022 Closes curl#20926
that do not hold custom values.
"x$var" = "xval"style.values.
-zand-nto test empty/non-empty.This also makes some x-hacks unnecessary.
-zand-noptions.&&and||over-aand-o.For better POSIX compatibility:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
test, where missing.Note that a few
casestatements also use the x-hack, which looksunnecessary. This patch does not change them.
Verified by comparing feature detection results with a reference CI run
from before this patch (PR #19922).
Refs:
https://www.shellcheck.net/wiki/SC2268
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
https://www.vidarholen.net/contents/blog/?p=1035
https://mywiki.wooledge.org/BashPitfalls#A.5B_.24foo_.3D_.22bar.22_.5D
https://github.com/curl/curl/pull/18189/files?w=1
tests where possible. → [NO,-aand-oare POSIX extension, deprecated and have limitations]ifs to use a common style? (how to quote the literal value)-aand-oin favor of multipletests?test -nandtest -z.Both already used in configure scripts.
Originally meant to delete the x-hack from
ifs, subsequently toneddown to a tidy-up, and keeping them for values coming from the outside,
also adding them in a few places, not to make shell script Gods angry.
Though, its use had already been applied fairly accidentally. Some
places still miss them, and by most accounts the issues have been fixed
either very long ago, or years ago in remaining niche cases. Also to hit
it, a custom value needs to be intentionally skewed, meaning it seems
unlikely to happen with well-formed inputs. curl keeps rolling the
x,except for a few places that seemed internal. Some of them may be
possible to override externally, but with IMO an even lower risk.