Changeset View
Standalone View
Mk/Scripts/qa.sh
Context not available. | |||||
return $rc | return $rc | ||||
} | } | ||||
badlibmix() { | |||||
local file dep_file rc | |||||
local base_ssl_libs port_ssl_libs | |||||
local base_gcc_libs port_gcc_libs | |||||
rc=0 | |||||
# Check all dynamicaly linked ELF files | |||||
# Some .so are not executable, but we want to check them too. | |||||
while read file; do | |||||
# No results presents a blank line from heredoc. | |||||
[ -z "${file}" ] && continue | |||||
base_ssl_libs="" | |||||
port_ssl_libs="" | |||||
base_gcc_libs="" | |||||
port_gcc_libs="" | |||||
while read dep_file; do | |||||
case "${dep_file}" in | |||||
# openssl | |||||
/usr/lib/libssl.so*|/lib/libcrypto.so*) | |||||
base_ssl_libs="${base_ssl_libs:+${base_ssl_libs} }${dep_file}" | |||||
;; | |||||
${PREFIX}/lib/libssl.so*|${PREFIX}/lib/libcrypto.so*|${LOCALBASE}/lib/libssl.so*|${LOCALBASE}/lib/libcrypto.so*) | |||||
mat: Unless you are building openssl and friends, you will not have a `PREFIX/lib/libssl.so` and… | |||||
yuri_rawbw.comAuthorUnsubmitted Done Inline ActionsIsn't it better to be general and always include both no matter what? yuri_rawbw.com: Isn't it better to be general and always include both no matter what? | |||||
matUnsubmitted Done Inline ActionsIt is better to not do things that make no sense, in this case, there will never be a PREFIX/lib/libssl.so, so don't add it. mat: It is better to not do things that make no sense, in this case, there will never be a… | |||||
port_ssl_libs="${port_ssl_libs:+${port_ssl_libs} }${dep_file}" | |||||
;; | |||||
# libgcc_s.so | |||||
/usr/lib/libgcc_s.so*) | |||||
base_gcc_libs="${base_gcc_libs:+${base_gcc_libs} }${dep_file}" | |||||
;; | |||||
${PREFIX}/lib/*/libgcc_s.so*|${LOCALBASE}/lib/*/libgcc_s.so*) | |||||
port_gcc_libs="${port_gcc_libs:+${port_gcc_libs} }${dep_file}" | |||||
Done Inline ActionsAll these should probably be replaced by things like: case "${dep_file}" (/usr/lib/libssl|/lib/libcrypto).so) base_ssl_libs="${base_ssl_libs} ${dep_file}" esac saving us many forks mat: All these should probably be replaced by things like:
```
case "${dep_file}"… | |||||
Done Inline ActionsOk, will modify the patch. yuri_rawbw.com: Ok, will modify the patch. | |||||
;; | |||||
esac | |||||
Done Inline ActionsYou should probably run ldd -a and only use the first block. mat: You should probably run `ldd -a` and only use the first block. | |||||
Not Done Inline ActionsNo, lack of -a is by design. You want to check the whole dependency set, not only an immediate subset. yuri_rawbw.com: No, lack of -a is by design. You want to check the whole dependency set, not only an immediate… | |||||
Done Inline ActionsNo, the lack of -a is by design. You want to check the whole dependency set, not only the immediate subset. yuri_rawbw.com: No, the lack of -a is by design. You want to check the whole dependency set, not only the… | |||||
done <<-EOT | |||||
$(LD_LIBRARY_PATH=${STAGEDIR}${PREFIX}/lib ldd "${STAGEDIR}${file}" | \ | |||||
Done Inline Actionsuseless use of grep awk '/=>/ {print $3}' mat: useless use of grep
```
awk '/=>/ {print $3}'
``` | |||||
Done Inline ActionsIt removes the first line which is an elf name. yuri_rawbw.com: It removes the first line which is an elf name.
| |||||
Done Inline Actionsgrep 'foo' | awk '{bar}' is equivalent to awk '/foo/ {bar}'. Please remove the grep. mat: `grep 'foo' | awk '{bar}'` is equivalent to `awk '/foo/ {bar}'`. Please remove the grep. | |||||
awk '/=>/ {print $3}') | |||||
EOT | |||||
if [ -n "${base_ssl_libs}" -a -n "${port_ssl_libs}" ]; then | |||||
Done Inline Actions
This should also work. "${file} is linked to both base and port SSL libraries: ${base_ssl_libs} and ${port_ssl_libs}" mat: 1) never, ever, use ```, always use `$()`
2) I am not sure I see the point of using echo to add… | |||||
Done Inline Actions
yuri_rawbw.com: 1. Ok, will modify the patch.
2. `echo ${str}` strips the leading space. Otherwise, this space… | |||||
Done Inline ActionsIf a single space throws you off, then change the code up there to, for example: port_ssl_libs="${port_ssl_libs:+${port_ssl_libs} }${dep_file}" or, if it does not work, the more ugly: port_ssl_libs="${port_ssl_libs}${port_ssl_libs:+ }${dep_file}" mat: If a single space throws you off, then change the code up there to, for example:
```… | |||||
Done Inline ActionsFYI: The same file contains backquotes in several other places. yuri_rawbw.com: FYI: The same file contains backquotes in several other places.
| |||||
Done Inline ActionsYes, and because I have not had time to fix them does not mean you should use them :-) mat: Yes, and because I have not had time to fix them does not mean you should use them :-) | |||||
Done Inline ActionsOut of curiosity, why do you oppose backticks? They are a valid Bourne shell syntax feature. Do you find them aesthetically unappealing? Making code harder to read? Easy to confuse with regular quotes? yuri_rawbw.com: Out of curiosity, why do you oppose backticks? They are a valid Bourne shell syntax feature. Do… | |||||
Done Inline ActionsSee [[ https://github.com/koalaman/shellcheck/wiki/SC2006 |
mat: See [[ https://github.com/koalaman/shellcheck/wiki/SC2006 |
Use $(STATEMENT) instead of legacy… | |||||
Done Inline ActionsThanks! yuri_rawbw.com: Thanks! | |||||
err "${file} is linked to both base and port SSL libraries: ${base_ssl_libs} and ${port_ssl_libs}" | |||||
rc=1 | |||||
fi | |||||
if [ -n "${base_gcc_libs}" -a -n "${port_gcc_libs}" ]; then | |||||
err "${file} is linked to both base and port gcc_s libraries: ${base_gcc_libs} and ${port_gcc_libs}" | |||||
matUnsubmitted Done Inline ActionsThe message is slightly wrong, it may not really be linked with both, as we are checking recursive linking. But I am not sure how it could be changed. mat: The message is slightly wrong, it may not really be linked with both, as we are checking… | |||||
yuri_rawbw.comAuthorUnsubmitted Done Inline ActionsEven only recursive presence of both base and port libgcc_s.so is bad, because libgcc_s.so contains exception processing. libgcc_s.so is primarily, if not solely used for exceptions in various languages. Exception objects tend to go through libraries in arbitrary order. They can't be touched by procedures from different versions of libgcc_s.so. This causes crashes because different libgcc_s.so assume differently structured exception objects. For the purposes of this check it's right to be conservative, and only consider the whole set of linked libraries. yuri_rawbw.com: Even only recursive presence of both base and port libgcc_s.so is bad, because libgcc_s.so… | |||||
rc=1 | |||||
fi | |||||
done <<-EOT | |||||
$(list_stagedir_elfs | \ | |||||
file -F $'\1' -f - | \ | |||||
grep -a 'ELF.*FreeBSD.*dynamically linked' | \ | |||||
cut -f 1 -d $'\1'| \ | |||||
sed -e 's/^\.//') | |||||
EOT | |||||
return ${rc} | |||||
} | |||||
checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo" | checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo" | ||||
checks="$checks suidfiles libtool libperl prefixvar baselibs terminfo" | checks="$checks suidfiles libtool libperl prefixvar baselibs terminfo" | ||||
checks="$checks proxydeps sonames perlcore no_arch" | checks="$checks proxydeps sonames perlcore no_arch badlibmix" | ||||
ret=0 | ret=0 | ||||
cd ${STAGEDIR} | cd ${STAGEDIR} | ||||
Context not available. |
Unless you are building openssl and friends, you will not have a PREFIX/lib/libssl.so and such, so you can remove the ones with PREFIX here and below for libgcc_s.