commit: 7aa3a581c47230c4df31588134acd090b67cc984 Author: Eli Schwartz <eschwartz93 <AT> gmail <DOT> com> AuthorDate: Wed May 29 23:34:59 2024 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Wed May 29 23:46:07 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7aa3a581
sci-libs/netcdf: fix bad bash scripting leading to failed tests If USE=-mpi, a file in src_test is NOT sedded to fix a bug in the file, because the file does not exist. But this condition was incorrectly coded. In bash: ``` cmd1 && cmd2 || cmd3 ``` is a code smell. If either of the first two commands fails, the third command is run -- in this case, die. In other words, the first two commands were *supposed* to be "only run cmd2 if it makes sense to". Instead, if it "doesn't make sense to" run cmd2, the die was triggered. A more general solution is to spec the build format to require all commands to pass without manually `die`ing (leading to the use of && ceasing in general), but that is not how portage works. Either way, the solution is using `if` as intended. ref. https://mywiki.wooledge.org/BashGuide/TestsAndConditionals Closes: https://bugs.gentoo.org/933136 Signed-off-by: Eli Schwartz <eschwartz93 <AT> gmail.com> Signed-off-by: Sam James <sam <AT> gentoo.org> sci-libs/netcdf/netcdf-4.9.2-r1.ebuild | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sci-libs/netcdf/netcdf-4.9.2-r1.ebuild b/sci-libs/netcdf/netcdf-4.9.2-r1.ebuild index 458001188497..a751713a52c2 100644 --- a/sci-libs/netcdf/netcdf-4.9.2-r1.ebuild +++ b/sci-libs/netcdf/netcdf-4.9.2-r1.ebuild @@ -89,8 +89,9 @@ src_configure() { } src_test() { - [[ -f "${BUILD_DIR}/nc_test4/run_par_test.sh" ]] && \ - sed -e 's/mpiexec/mpiexec --use-hwthread-cpus/g' -i "${BUILD_DIR}/nc_test4/run_par_test.sh" || die + if [[ -f "${BUILD_DIR}/nc_test4/run_par_test.sh" ]]; then + sed -e 's/mpiexec/mpiexec --use-hwthread-cpus/g' -i "${BUILD_DIR}/nc_test4/run_par_test.sh" || die + fi cmake_src_test }
