You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(might want to make sure /bin/sh is not symlinked to bash)
run ./configure
checking for python module libxml2... found
checking that generated files are newer than configure... Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'libxml2'
done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating itstool
config.status: creating itstool.1
config.status: creating its/Makefile
config.status: creating setup.py
As you can see, configure falsely claims it found libxml2 even though it's absent.
The next error is ignored.
The rest of the build proceeds with success, but itstool fails to run giving an import error on libxml2.
root cause:
bash versus sh semantics for &>.
The line to test for libxml2 is the following: echo "import $py_module" | $PYTHON - &>/dev/null
Then the exit-code $? is checked for success.
In bash &> is shorthand for redirect stdout +stderr
/bin/sh interprets &> as & (run in background) > (redirect output)
When running in background the exit-code is always 0 (success) and thus the test for libxml2 always succeeds
./configure explicitly states #!/bin/sh in the shebang so /bin/sh semantics should be observed.
Fix:
replace &>/dev/null with >/dev/null 2>&1 in ./configure
This expression is valid for both bash and sh. patch_itstool_libxml2_detect.txt
The text was updated successfully, but these errors were encountered:
Today I learned a bashism I was unaware of. Thanks. I think I'm going to switch entirely to setuptools for the next version, which will make this issue go away. But I'll keep this issue open for now.
How to reproduce:
As you can see, configure falsely claims it found libxml2 even though it's absent.
The next error is ignored.
The rest of the build proceeds with success, but itstool fails to run giving an import error on libxml2.
root cause:
bash versus sh semantics for
&>
.The line to test for libxml2 is the following:
echo "import $py_module" | $PYTHON - &>/dev/null
Then the exit-code
$?
is checked for success.In bash
&>
is shorthand for redirect stdout +stderr/bin/sh interprets
&>
as&
(run in background)>
(redirect output)When running in background the exit-code is always 0 (success) and thus the test for libxml2 always succeeds
./configure explicitly states #!/bin/sh in the shebang so /bin/sh semantics should be observed.
Fix:
replace
&>/dev/null
with>/dev/null 2>&1
in ./configureThis expression is valid for both bash and sh.
patch_itstool_libxml2_detect.txt
The text was updated successfully, but these errors were encountered: