shell commands in unix (and unix_g, unix_w, unix_x) silently fail because of the LD_LIBRARY_PATH variable
Reported by Antoine Monmayrant
BUG DESCRIPTION:
----------------
On Linux, a command launched using unix_g can silently fail because of library version mismatch between what's in the /usr/lib/ folder and what is in the SCIHOME/lib/thirdparty/.
It seems that the LD_LIBRARY_PATH of the shell launched by unix_g first refer to the library provided with Scilab and not the OS libraries, leading to weird error messages.
Moreover, no error appears in Scilab.
Not tested under Windows.
ERROR LOG:
----------
None, it's part of the bug!
HOW TO REPRODUCE THE BUG:
-------------------------
// The harminv package has to be installed beforehand
[rep,stat,err]=unix_g("harminv -h") // it fails, but err is empty
[rep,stat,err]=unix_g("harminv -h 2> failed.log") // Fails again but now failed.log gives some info on why it fails
// failed.log contains: harminv: /home/myhome/softs/scilab-5.5.1/lib/thirdparty/libgfortran.so.3: version `GFORTRAN_1.4' not found (required by /usr/lib/liblapack.so.3)
[rep,stat,err]=unix_g("LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH ; harminv -h") // it works as expected
// Output of the last command:
-->[rep,stat,err]=unix_g("LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH ; harminv -h")
err =
stat =
0.
rep =
!Usage: harminv [options] <freq-min>-<freq-max>... !
! !
!Options: !
! !
! -h : this help message !
! !
! -V : print version number and copyright !
! !
! -v : verbose output !
! !
! -T : specify periods instead of frequencies !
! !
! -w : specify/output angular frequency, not frequency !
! !
! -n : flip the sign of the frequency convention !
! !
! -t <dt> : specify sampling interval dt [default: 1] !
! !
! -d <d> : specify spectral density [default: 0] !
! !
! -f <nf> : use at least <nf> basis functions [default: 0] !
! !
! -s <sort> : sort by <sort> = freq/err/decay/amp [default: freq] !
! !
! -F : discard frequencies outside of specified range !
! !
! -a <a> : discard amplitudes < max * <a> [default: -1.000000e+00] !
! !
! -A <A> : discard amplitudes < <A> [default: 0.1] !
! !
! -e <e> : discard relative errors > min * <e> [default: inf] !
! !
! -E <E> : discard relative errors > <E> [default: 1.000000e+01] !
! !
! -Q <Q> : discard Q > <E> [default: 1] !
OTHER INFORMATION:
------------------
I think it affects every command that requires a different version of libraries that are in the SCIHOME/lib/thirdparty/