NOAA-GFDL/SHiELD_build

portability bug - pushd is bash specific

Closed this issue · 2 comments

building in ubuntu docker container, gnu, arm64...

I get this error when building incrementally:

root@bd9eb8ef3929:/SHiELD_SRC/SHiELD_build/Build# mk_scripts/mk_paths shield gnu
/opt/mkmf/bin:/opt/netcdf/bin:/opt/openmpi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
mk_scripts/mk_paths: 50: pushd: not found

I found some guidance that said this is a bash command, but it's being called with "#!/bin/sh" as the header:
https://stackoverflow.com/questions/5193048/bin-sh-pushd-not-found

I think this can be quick-fixed by changing the header of the makefile(s) to "#!/bin/bash"

At the moment, I'm resolving this with:
RUN cd ${SHiELD_SRC}/SHiELD_build/Build
&& sed -i '1s|^#! */bin/sh|#!/bin/bash|' mk_scripts/mk_paths
&& sed -i '1s|^#! */bin/sh|#!/bin/bash|' mk_scripts/mk_makefile
&& sed -i '1s|^#! */bin/sh|#!/bin/bash|' mk_scripts/mk_make

@StevePny - Please put in a PR with the shell changes. Otherwise, we'll fix this in a future update.

Thanks for addressing this. In the future, we'll be more cognizant of the symlinks in /bin/ for the various distros.