lalsuite_old_exec_name_stubs.am: fall back to exec in same path as stub
Description
gnuscripts/lalsuite_old_exec_name_stubs.am
generates stub executables for LALSuite applications which have been moved/renamed, e.g. !1901 (merged) moved lalapps_tconvert
to LAL and renamed it lal_tconvert
, but LALApps still provides a stub lalapps_tconvert
which calls lal_tconvert
.
lalsuite_old_exec_name_stubs.am
was calling the fallback executable using an absolute path to the installation directory $(bindir)
. This was to avoid using PATH
, which would then depend on the local user's setup; it's not inconceivable that a weird PATH
setup could lead to an old version of the fallback executable being called, with potentially unintended/hard-to-debug consequences. Using $(bindir)
however doesn't work with the wheels/conda packages where the installation directory may be relocated anywhere.
This MR instead tries to find the fallback executable in the same path as the stub itself. This is done using Bash parameter expansions to strip off the stub name from $0
and then add the fallback name, e.g. for lalapps_tconvert
:
newexec="${0%/lalapps_tconvert}/lal_tconvert"
The stub now also prints the explicit path of the fallback executable being called for extra clarity, e.g.:
$ ./_inst/bin/lalapps_tconvert
WARNING: 'lalapps_tconvert' has been renamed to 'lal_tconvert'
WARNING: please update your scripts
WARNING: now running './_inst/bin/lal_tconvert' ...
1341611405
API Changes and Justification
Backwards Compatible Changes
-
This change does not modify any class/function/struct/type definitions in a public C header file or any Python class/function definitions -
This change adds new classes/functions/structs/types to a public C header file or Python module
Backwards Incompatible Changes
-
This change modifies an existing class/function/struct/type definition in a public C header file or Python module -
This change removes an existing class/function/struct/type from a public C header file or Python module
Review Status
Closes #555 (closed)