TACC / Lmod

Lmod: An Environment Module System based on Lua, Reads TCL Modules, Supports a Software Hierarchy
http://lmod.readthedocs.org
Other
499 stars 128 forks source link

`isFile` returns True for a broken symlink #678

Closed ocaisa closed 8 months ago

ocaisa commented 11 months ago

Describe the bug Bug is a strong word, but it would be nice if isFile recognised when a link is broken and returned false in that case.

To Reproduce Use isFile on a broken symlink

Expected behavior Broken links not accepted as valid files.

Desktop (please complete the following information):

Modules based on Lua: Version 8.7.23 2023-03-29 17:19 -05:00 by Robert McLay mclay@tacc.utexas.edu

Changes from Default Configuration

Name Where Set Default Value


LFS_VERSION D 1.6.3 1.8.0 LMOD_CACHED_LOADS D no yes LMOD_CASE_INDEPENDENT_SORTING C no yes LMOD_HAVE_LUA_TERM C no yes LMOD_KSH_SUPPORT C no yes LMOD_PACKAGE_PATH D nil LMOD_PAGER C less /cvmfs/pilot.eessi-hpc.org/versions/2023.06/compat/linux/x86_64/usr/bin/less LMOD_RC E /cvmfs/pilot.eessi-hpc.org/versions/2023.06/software/linux/x86_64/intel/skylake_avx512/.lmod/lmodrc.lua LMOD_SITEPACKAGE_LOCATION Other /cvmfs/pilot.eessi-hpc.org/versions/2023.06/compat/linux/x86_64/usr/share/Lmod/libexec/SitePackage.lua LMOD_SITE_NAME C false Gentoo LMOD_SYSHOST C false Gentoo LMOD_SYSTEM_DEFAULT_MODULES D unknown LMOD_TCLSH C tclsh /cvmfs/pilot.eessi-hpc.org/versions/2023.06/compat/linux/x86_64/usr/bin/tclsh MODULEPATH_ROOT C /cvmfs/pilot.eessi-hpc.org/versions/2023.06/compat/linux/x86_64/etc/modulefiles PATH_TO_LUA C lua /cvmfs/pilot.eessi-hpc.org/versions/2023.06/compat/linux/x86_64/usr/bin/lua5.1 SITE_CONTROLLED_PREFIX C no yes

Where Set -> D: default, E: environment, C: configuration lmod_cfg: lmod_config.lua SitePkg: SitePackage StdPkg: StandardPackage Other: Set somewhere outside of normal locations



**Additional context**
The use case is making CUDA modules loadable only when symlinks to the drivers are resolved.
rtmclay commented 11 months ago

I have updated the testing branch for Lmod to make isFile return nil for a broken symlink. If you get the chance please try out the testing branch to see if it works for you.

rtmclay commented 8 months ago

O.K. to close this issue?