Post AwlLl0ED5hTaXfnIQ4 by playit@fediverse.dotslashplay.it
(DIR) More posts by playit@fediverse.dotslashplay.it
(DIR) Post #AwlLl0ED5hTaXfnIQ4 by playit@fediverse.dotslashplay.it
2025-08-02T14:50:42Z
1 likes, 1 repeats
Working with POSIX shell is not always easy… Here comes a locale-specific bug we just found in ./play.it (that is going to be fixed in the upcoming 2.33.0 release), that took several steps to mutate from a small typo into a critical error. At the time it became critical, the original error had been in the codebase for 4 years already, still unnoticed, mostly harmless.That was a tricky one, only happening on systems that have a locale set neither in English, nor in French: https://git.dotslashplay.it/play.it/commit/?id=85c6e6a5aAnd the commit that turned what looked like a harmless oversight into a critical bug: https://git.dotslashplay.it/play.it/commit/?id=389aa7dfcA small illustration of the underlying cause, beware that it can trigger rage outbursts amongst programmers:$ test=$(false) || true$ echo $?0$ test=$(false || true)$ echo $?0$ set -o nounset$ test=$(echo "$unset") || truesh: 2: unset: parameter not set$ echo $?0$ test=$(echo "$unset" || true)sh: 4: unset: parameter not set$ echo $?2
(DIR) Post #AwlN6Kw7OS94nq4J4y by lanodan@queer.hacktivis.me
2025-08-02T15:14:48.957636Z
0 likes, 0 repeats
@playit Way I see how that works is set -o nounset (aka set -u) makes the shell exit due to expansion error rather than making the command it's related to fail.cf. the -u option of the set utility and Consequences of Shell Errors it links to for it's kind of failure mode