[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Perl postinst script running external commands



Hi,

Russell Coker:
> > More specifically, it has something to do with using backticks to start an
> > external command, and open file descriptors. You don't KNOW which
> > descriptor DebConf uses.
> 
> This is a good reason for not using debconf.
> 
IMHO it's a good reason for not mixing configuration with execution,
and it's an even better reason for fixing a bug in DebConf. Specifically,
setting the Close-On-Exec flag on the file descriptor(s) which represent
the DebConf protocol will prevent all these problems from occurring.

> The interface between a program and libraries it uses should be defined, and 
> it should be designed in a way to minimise harm to other programs.
> 
Easily done -- see above.

> > You should (a) issue the STOP command (see "man 7 debconf-devel"), and
> > (b) use fork+execve to restart apache instead of backticks.
> 
> Which of course would not work well if you have to run a script to get 
> information needed for the next debconf question...
> 
So ask your questions before executing stuff... what's the problem?
Besides, (b) would work in that situation (you still need to use STOP, but
at the end of your script it can't hurt any). It'll run Apache with a
half-closed file descriptor or two (the bidirectional pipe to debconf),
but that's not a problem in practice. Anyway, that Close-On-Exec flag would 
prevent the problem from occurring in the first place.

-- 
Matthias Urlichs     |     noris network AG     |     http://smurf.noris.de/



Reply to: