-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
curl-config assumes that bc is present #3143
Comments
Brought in commit 6ca627a, May 2006 and this is the first time someone has an issue with it... We could replace the |
One does not need any external tools here. Indeed, the 1st line using
Similarly if you don't use If you'd care to take a pull request fixing this, I can do it... |
Yes please. Just make sure you're also not doing any bash'isms as I believe |
Using only Bourne sh, expr and sed: checknum=`expr $cmajor \* 256 \* 256 + $cminor \* 256 + ${cpatch:-0}`
numdigits=`echo @VERSIONNUM@ | sed -e 'y/abcdef/ABCDEF/; s/0x//; s/./ &/g; s/[ABCDEF]/1&/g; y/ABCDEF/012345/'`
nownum=0
for d in $numdigits; do nownum=`expr $nownum \* 16 + $d`; done
|
Anyway, I do not understand why one needs to do the arithmetic of this sort, as you can start by comparing major versions, if they are equal move to the minor ones, and finally, if needed, to the patch level... Yes it would be few lines longer, but much less cryptic. |
expr is typically part of a coreutils package and available on any sensible distro. But I think you're right about unnecessary arithmetic. Just unpick @CURLVERSION@ in the same way as $checkfor, rather than unhexifying @VERSIONNUM@. |
Would testing with FreeBSDs |
Yes, I think that would be a good test. Or 'dash' on a Linux system. |
The challenge is to make a conversion from or a comparison with a hexadecimal number without using a separate tool. I don't think that's possible. Then the question is really which separate tool that is most likely to be around and thus least troublesome to depend on... Contenders include |
I don't understand why you insist on having to deal with that hexadecimal number --- as instead you can using the normal split version format right away. |
Oh yes, you can indeed. I was just too stuck in the same mindset that code is currently written! The solution could be to simply use Alternatively, we remove all dependencies (even on sh) and go with #3154 |
We can indeed use |
Thanks! |
bc
might not be installed on the box (typical for VMs, e.g. if you use a default Debian install on a Google Compute node). Thencurl-config --checkfor
reports nonsense.not sure what the right fix is.
A platform-specific fix for Debian would add
bc
to pre-reqs for libcurl, but well, perhaps it can be improved generically.The text was updated successfully, but these errors were encountered: