New comment by ahesford on void-packages repository https://github.com/void-linux/void-packages/pull/39264#issuecomment-1973016786 Comment: I think this is getting far too complicated for the simple intent of preserving variables that have already been set. I had to read that loop several times to figure out what it was doing even knowing your intent. It's also fragile. You're effectively just sourcing the file after wrapping all simple variable assignments in `: ${VAR=value}` to preserve variables already set by the environment while trying to honor existing workflows that might try to inject more complicated behavior into `locale.conf`, but there's no way to guarantee that these kinds of modifications to what's executed during the `eval` won't have all sorts of unintended consequences. I think there are four reasonable ways to solve your problem (with varying degrees of reasonability): 1. Leave the behavior as is and let users guard variables they might not want to overwrite, knowing that `locale.conf` is executed by the shell. 2. Gate the sourcing like in Arch, which you said people don't like. But do those people who objected really prefer writing trying to implement an even more complex shell parser in the shell itself? 3. Make backup copies of all relevant variables, just source the file as we already do, and restore the backup copies if they were nonempty before the source. I think you did this, in a couple of different ways, in an earlier proposal. 4. Properly validate that `locale.conf` contains nothing more than comments or simple `VAR=value` assignments. Reject it entirely if it does not conform, otherwise parse accordingly.