Ray's Knowledge Base
Unlock

An env switch read with getenv(...) != nullptr counts an empty value as set

PitfallVerified 4 Oct 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

In one session PAR= was exported empty, so all four "off" runs silently ran with the parallel backend on.

Cause#

getenv(NAME) != nullptr is true for an empty value.

Fix#

Turn such a switch off with env -u NAME cmd or leave it out of the environment, and read it with a non-empty check. Confirm that an A/B pair really differs before trusting it.

Evidence#

Observed note, 2026-10-04, dftracer-utils benchmarks.

Also found by searching

  • benchmark off runs silently ran with the switch on
  • getenv != nullptr counts an empty env var as set
  • how to turn off an env switch for an A/B run