Skip to content
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: fix broken bashisms resulting in logic failure #229

Merged
merged 1 commit into from
Nov 3, 2024

Conversation

eli-schwartz
Copy link
Contributor

Some code which was only valid using GNU bash was included. Detected in Gentoo packaging via:

 * QA Notice: Abnormal configure code
 *
 * ./configure: 17292: test: unexpected operator

Bash provides the standard test XXX = YYY or [ XXX = YYY ] utilities. It also provides the ability to spell the equals sign as a double equals. This does nothing whatsoever -- it adds no new functionality to bash, it forbids nothing, it is literally an exact alias.

It should never be used under any circumstances. All developers must immediately forget that it exists. Using it is non-portable and does not work in /bin/sh scripts such as configure scripts, and it results in dangerous muscle memory when used in bash scripts because it makes people unthinkingly use the double equals even in /bin/sh scripts. To add insult to injury, it makes scripts take up more disk space (by a whole byte! and sometimes even a few bytes...)

Delete this accidental bashism, and restore the ability to get correct ./configure behavior on systems where /bin/sh is something other than a symlink to GNU bash.

Some code which was only valid using GNU bash was included. Detected in
Gentoo packaging via:

```
 * QA Notice: Abnormal configure code
 *
 * ./configure: 17292: test: unexpected operator
```

Bash provides the standard `test XXX = YYY` or `[ XXX = YYY ]`
utilities. It also provides the ability to spell the equals sign as a
double equals. This does nothing whatsoever -- it adds no new
functionality to bash, it forbids nothing, it is *literally* an exact
alias.

It should never be used under any circumstances. All developers must
immediately forget that it exists. Using it is non-portable and does not
work in /bin/sh scripts such as configure scripts, and it results in
dangerous muscle memory when used in bash scripts because it makes
people unthinkingly use the double equals even in /bin/sh scripts. To
add insult to injury, it makes scripts take up more disk space (by a
whole byte! and sometimes even a few bytes...)

Delete this accidental bashism, and restore the ability to get correct
./configure behavior on systems where /bin/sh is something other than a
symlink to GNU bash.
@hpjansson hpjansson merged commit add7cd4 into hpjansson:master Nov 3, 2024
1 check passed
@hpjansson
Copy link
Owner

Harsh but fair.

@eli-schwartz
Copy link
Contributor Author

It's one of the most common mistakes out there :) and honestly I don't blame anyone other than a certain GNU Bash maintainer who introduced this footgun...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants