Date: Tue, 5 Nov 2024 17:55:38 +0100 From: Edgar =?iso-8859-1?B?RnXf?= <e...@math.uni-bonn.de> Message-ID: <zypocnqfvxwmt...@trav.math.uni-bonn.de>
| 1.40 tried to fix it, but probably | not for the command being exec'ed being exec. Yes, that is exactly the issue, we want exec 3>whatever to set close-on-exec (by default) as typically fds created that way are just for the script to use, and shouldn't be passed through to children. (This was needed as otherwise private fd's required for /etc/rc to work properly were being passed through to all the commands (daemons in particular) started by rc ... Now we'd probably just use fdflags to set close-on-exec on those fds rather than do it this way, but I don't think that existed yet when this was changed). So "exec" was given an exemption to the "no redirects on the command line have close-on-exec" rule (a redirect explicitly for a command clearly should be passed to that command). All the shell's private fd's (such as the one used to read a script file) get close-on-exec. But the case of exec cmd 3>whatever also got the exemption (because it is "exec"), even though that is really just sort of cmd 3>whatever exit (without the fork that would be needed to run cmd that way) The fix for this is a little bit ugly, but seems to work OK. Coming soon (but not to -8! Perhaps not -9 either, I'll need to check that one, -10 should be possible). kre