New Issue: glitches in output of --help-env and --help-settings

20780, "vasslitvinov", "glitches in output of --help-env and --help-settings", "2022-10-06T05:44:44Z"

Somewhat related: #10981 #12296

  • Running 'chpl --help-env' reports env var: (not set) instead of env var: <none> for --help-env and --help-settings.

  • Running 'chpl --help-env' reports "not set" for all "compiler configuration" CHPL_ variables even though I have some of them set in my environment, ex.:

      --home <path>                   Path to Chapel's home directory
          env var:   CHPL_HOME (not set)
      --comm <comm-impl>              Specify communication implementation
          env var:   CHPL_COMM (not set)
  • Running 'chpl --help-settings' reports currently: '' for all "compiler configuration" options, even though all their values are known during the compilation, coming either from the environment or from the output of printchplenv:
      --home <path>                   Path to Chapel's home directory
          currently: ''
      --atomics <atomics-impl>        Specify atomics implementation
          currently: ''
      --comm <comm-impl>              Specify communication implementation
          currently: ''

The first issue arises because the respective ArgumentDescriptions have "" instead of NULL for the environment name. Easy to fix.

The second issue is due to ArgumentDescriptions prepending _ to the name of all the environment variables handled by printchplenv, e.x.:

{"home", ' ', "<path>", "Path to Chapel's home directory", "S", NULL, "_CHPL_HOME", setHome}

There is an explanation text in compiler/main/driver.cpp:

// The setEnv args use _ variable prefix (_CHPL_HOME) to ensure that setEnv is
// only called when a flag is passed - otherwise arg functions are  called if
// their environment variable is set

To fix this issue, we could add an explicit flag to ArgumentDescription to cause this behavior.

Not sure about the third issue. In any case --help-settings should execute after printchplenv is invoked. See also setChapelEnvs().