Fix fakeroot build by using od(1) to check 64-bit ELFs#943
Fix fakeroot build by using od(1) to check 64-bit ELFs#943
Conversation
bin/package: - Use od(1) to check the ELF header if the file command fails. This allows ksh to build and install correctly in fakeroot environments without encountering bogus seccomp restrictions. Fixes ksh93#919
- Check the first five bytes to guarantee it's actually an ELF binary.
- Return 'Unknown bits' if it's neither a 64-bit ELF nor 32-bit ELF
(i.e. it could be anything). This isn't functionally different but is
better for clarity.
- Pass '-A n' to od(1) rather than '-An' for what should be better
portability.
- locale.sh: Also apply that change here since a quick grep showed
this file was also passing -An to od.
|
How is Option grouping is part of the POSIX Utility Syntax Guidelines (Guideline 5), which |
|
Also, why use If so, the following should be enough, shouldn't it? diff --git a/bin/package b/bin/package
index a40139161..149e31025 100755
--- a/bin/package
+++ b/bin/package
@@ -1523,7 +1523,9 @@ int b(void) { return 0; }
echo 'int main(void) { return 0; }' > $tmp.a.c
checkcc
$cc $CCFLAGS -o $tmp.a.exe $tmp.a.c </dev/null >/dev/null 2>&1
- file $tmp.a.exe 2>/dev/null | sed "s/$tmp\.a\.exe//g" )
+ {
+ file $tmp.a.exe || file --no-sandbox $tmp.a.exe
+ } 2>/dev/null | sed "s/$tmp\.a\.exe//g" )
case $bits in
*\ 64-bit* | *\ 64\ bit* | *\ 64bit*)
bits=64 ;; |
The use of |
I'm seeing it on macOS and FreeBSD as well. In any case, since we're trying |
You're apparently correct, the option is available (I should have checked). However, I don't think it does anything there; the |
|
Alright then, in it goes, for more resilience against potential other forms of file(1) breakage. |
bin/package:
- Use od(1) to check the ELF header if the file command fails.
This allows ksh to build and install correctly in fakeroot
environments without encountering bogus seccomp restrictions.
- Check the first five bytes to guarantee it's actually an ELF
binary.
- Return 'Unknown bits' if it's neither a 64-bit ELF nor 32-bit
ELF (i.e. it could be anything). This isn't functionally
different but is better for clarity.
Resolves: #919
bin/package:
odto check the ELF header iffilefails with an error. This allows ksh to build and install correctly infakerootenvironments without encountering bogus seccomp restrictions.Fixes #919