Sorry for the supplemental. I've been reading that using process substitution
with sudo causes breakage. I'm just unclear if it's causing _my_ breakage.
Returning to my original command:$ sudo cryptsetup luksAddKey --key-file=<(gpg
--decrypt "$EXISTING_KEY")Â
--new-keyfile=<(gpg --decrypt "$NEW_KEYFILE") "$DEVICE"Â
According to sudo, "By default, sudo will close all open file descriptors other
than standard input, standard output, and standard error when executing a
command." So even if cryptsetup accepts file descriptors, sudo's probably
closed them before cryptsetup gets to them. It's also not clear how global sudo
is with its culling, as I find it hard to believe that it would break file
descriptors that completely unrelated processes are using.
The file descriptor issue has a workaround that sets closefrom_override in
/etc/sudoers, but the Internet is unclear how this creates an exploitable
weakness. I know this isn't bash's fault and I don't expect anyone here to have
the answer unless my syntax or logic are fundamentally wrong.
Again, I'm mostly trying to understand how these pieces fit together - I long
ago solved my problem with a temporary file. I also don't expect the Bash
Manual to cover sudo and every other command. The documentation (not
necessarily Bash Manual) just isn't obvious where the problem is. That's what
I'm mostly trying to troubleshoot.