The curious case of shell commands, or how "this bug is required by POSIX"

https://news.ycombinator.com/rss Hits: 16
Summary

Some context(For those interested only in the glibc and POSIX issues, see at the end.)I use Linux almost everywhere, from laptops and desktops to servers and routers, and over the course of many years I've written quite a few bash scripts that ease my interaction with all of these.The usual "stack" that ties all of these together is composed of:bash, obviously for scripting;ssh, for remote execution;i3, the window manager for desktop environments;screen, for terminal multiplexing;tmux, for terminal multiplexing;dtach, for launching processes in background while still being able to access them if needed;(among many other tools like coreutils and friends, grep, sed, sort, find, xargs, rsync, plus other smaller C, Go or Rust based tools; but all of these are not the subject of this article;)What do all of the former have in common? They all provide some sort of functionality, but by themselves they don't actually do anything; they are meant to delegate the actual work to other tools.So what is the problem you ask? Nothing really... Everything is fine... No planes are falling from the sky... Nobody is running around screaming while on fire... Everything is business as usual, unless you want to write some wrapper scripts that takes arbitrary user input and delegates that to one of these, and many other, broken tools...And just for completeness I'll throw in some other tools that fit the bill:make (and any other variant or derivate), for build systems;ninja, my favorite build system, and lightweight DAG job scheduler and executer;Root of all evilAs many of you have guessed, because we live in a UNIX world, many of these tools delegate the actual tool execution to the glibc system(3) function, which ends-up calling sh(1p) (most likely bash) with the -c argument. As opposed to doing the correct thing and just calling execve(2)...BTW, this is not something Linux specific. Unfortunately it is a trait inherited from the UNIX ancestry by almost all operating systems, including ...

First seen: 2025-06-10 15:23

Last seen: 2025-06-12 14:49