>socket-helper { name1 /run/name1.socket name2 /run/name2.socket } prog
>
>Currently socket-helper is a shell script, as I haven't found a way to
>generate the unknown number of `s6-ipcserver-socketbinder /path/sock
>fdmove N 0` using just execline. Is this socket-helper (or an
>easier-to-implement analogue of it) possible in execline? I know
>`getpid` allows a one-line implementation of the first environment
>variable, but I'm at a loss on how to implement the last two.
Do you mean you have a variable number of (name, socket) pairs?
In any case, it is certainly *possible* to implement something like
this in execline, because execline is Turing-complete, but it doesn't
mean that it's easy or even a good idea. To handle a variable number
of arguments, you need to iterate over them, and maintaining a state
is difficult in execline, so it would very likely be more complicated
than is worth.
I'd advise you to stick with your shell script. To be honest, if I were
writing such a helper, I'd make it a small C program.
The best course of action would naturally be to convince the gpg-agent
authors that socket pre-opening (for which LISTEN_FDS is a terrible
interface but that's not our concern here) has nothing to do with
foregrounding, and they should entirely decouple these.
--
Laurent
Received on Thu Oct 28 2021 - 17:46:16 CEST