Lmod icon indicating copy to clipboard operation
Lmod copied to clipboard

spider json fails to mark modules as hidden

Open simonLeary42 opened this issue 1 year ago • 9 comments

Consider the following module tree:

├── newdir
│   └── foobar
│       ├── .modulerc.lua
│       └── 1.2.3.lua
├── root
│   └── newdir
│       └── 1.0.lua

with the following contents:

$ cat root/newdir/1.0.lua
prepend_path("MODULEPATH", "/home/simon/lmod-bug-test/newdir")

$cat newdir/foobar/1.2.3.lua
prepend_path("PATH", "/opt/foobar")

$ cat newdir/foobar/.modulerc.lua
hide_version("foobar/1.2.3")

module avail shows foobar/1.2.3 as hidden:

$ ml av

----------- /home/simon/lmod-bug-test/root -----------
   newdir/1.0

$ ml newdir/1.0
$ ml av

----------- /home/simon/lmod-bug-test/root -----------
   newdir/1.0 (L)

$ ml --show_hidden av

----------- /home/simon/lmod-bug-test/newdir -----------
   foobar/1.2.3 (H)

----------- /home/simon/lmod-bug-test/root -----------
   newdir/1.0 (L)

spiderT also shows foobar/1.2.3 as hidden:

$ /opt/lmod/lmod/lmod/libexec/spider -o spiderT /home/simon/lmod-bug-test/root

timestampFn = {
  false,
}
mrcT = {
  alias2modT = {},
  hiddenT = {},
  version2modT = {},
}

mrcMpathT = {
  ["/home/simon/lmod-bug-test/newdir"] = {
    hiddenT = {
      ["foobar/1.2.3"] = true, <===================== HERE
    },
  },
}
spiderT = {
  ["/home/simon/lmod-bug-test/newdir"] = {
    foobar = {
      defaultA = {
        {
          barefn = ".modulerc.lua",
          defaultIdx = 2,
          fn = "/home/simon/lmod-bug-test/newdir/foobar/.modulerc.lua",
          fullName = "foobar/.modulerc",
          luaExt = 10,
          mpath = "/home/simon/lmod-bug-test/newdir",
          value = false,
        },
      },
      defaultT = {
        barefn = ".modulerc.lua",
        defaultIdx = 2,
        fn = "/home/simon/lmod-bug-test/newdir/foobar/.modulerc.lua",
        fullName = "foobar/.modulerc",
        luaExt = 10,
        mpath = "/home/simon/lmod-bug-test/newdir",
        value = false,
      },
      dirT = {},
      fileT = {
        ["foobar/1.2.3"] = {
          Version = "1.2.3",
          canonical = "1.2.3",
          fn = "/home/simon/lmod-bug-test/newdir/foobar/1.2.3.lua",
          luaExt = 6,
          mpath = "/home/simon/lmod-bug-test/newdir",
          pV = "000000001.000000002.000000003.*zfinal",
          pathA = {
            ["/opt/foobar"] = 1,
          },
          wV = "000000001.000000002.000000003.*zfinal",
        },
      },
    },
  },
  ["/home/simon/lmod-bug-test/root"] = {
    newdir = {
      defaultA = {},
      defaultT = {},
      dirT = {},
      fileT = {
        ["newdir/1.0"] = {
          Version = "1.0",
          canonical = "1.0",
          changeMPATH = true,
          fn = "/home/simon/lmod-bug-test/root/newdir/1.0.lua",
          luaExt = 4,
          mpath = "/home/simon/lmod-bug-test/root",
          pV = "000000001.*zfinal",
          wV = "000000001.*zfinal",
        },
      },
    },
  },
  version = 5,
}
mpathMapT = {
  ["/home/simon/lmod-bug-test/newdir"] = {
    ["newdir/1.0"] = "/home/simon/lmod-bug-test/root",
  },
}

but strangely, json spider cache does not mark foobar/1.2.3 as hidden:

$ /opt/lmod/lmod/lmod/libexec/spider -o spider-json /home/simon/lmod-bug-test/root | python -m json.tool

{
    "newdir": {
        "/home/simon/lmod-bug-test/root/newdir/1.0.lua": {
            "hidden": false,
            "fullName": "newdir/1.0",
            "pV": "000000001.*zfinal",
            "wV": "000000001.*zfinal",
            "mpath": "/home/simon/lmod-bug-test/root",
            "Version": "1.0"
        }
    },
    "foobar": {
        "/home/simon/lmod-bug-test/newdir/foobar/1.2.3.lua": {
            "hidden": false, <=========================== HERE
            "fullName": "foobar/1.2.3",
            "parentAA": [
                [
                    "newdir/1.0"
                ]
            ],
            "pathA": {
                "/opt/foobar": 1
            },
            "pV": "000000001.000000002.000000003.*zfinal",
            "wV": "000000001.000000002.000000003.*zfinal",
            "mpath": "/home/simon/lmod-bug-test/newdir",
            "Version": "1.2.3"
        }
    }
}

I thought spiderT and spider-json stored all the same information, just in a different layout. Is that not true?

$ module --version
Modules based on Lua: Version 8.7.34  2024-01-05 19:34 -07:00
    by Robert McLay [email protected]

simonLeary42 avatar Jan 15 '24 18:01 simonLeary42