Hi,

Ben Armstrong wrote:

> Today, we were assisting a user on #debian at irc.oftc.net. He had
> installed a package from a third-party source that included a bad
> .postrm maintainer script. The script was executable, yet completely
> empty.

This seems suspicious.  Perhaps the postrm file had been truncated at
some point (e.g., sudden system failure while installing with an older
version of dpkg?).

> Please ensure dpkg can handle such broken maintainer scripts (either
> upon removal, or even better, upon installation so the problem is
> noticed and addressed earlier) as a user attempting to remove such a
> broken package will be unable to do so without expert intervention.

Do you mean something like a new "dpkg --force-failing-maintainer-scripts"?

In the general case, such a thing would be a very easy way to end up
with a broken system.  I'm not sure there's any reasonable thing to do
other than finding an expert to intervene.

That said, in the specific case you mentioned, the following (which
would be a good idea for other reasons otherwise) seems to work.  What
do you think?

-- 8< --
Subject: libdpkg: Use execvp unconditionally in command_exec

execvp already checks if its file argument contains a '/'; simplify by
not checking again for the same thing.

The real motivation is to avoid confusing behavior in an edge case:
when execve fails with ENOEXEC, execvp will run the script using the
system shell but execv will error out.

Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
---
 lib/dpkg/command.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/lib/dpkg/command.c b/lib/dpkg/command.c
index 5e7cd05..a711bfa 100644
--- a/lib/dpkg/command.c
+++ b/lib/dpkg/command.c
@@ -175,10 +175,7 @@ command_add_args(struct command *cmd, ...)
 void
 command_exec(struct command *cmd)
 {
-       if (strchr(cmd->filename, '/'))
-               execv(cmd->filename, (char * const *)cmd->argv);
-       else
-               execvp(cmd->filename, (char * const *)cmd->argv);
+       execvp(cmd->filename, (char * const *)cmd->argv);
        ohshite(_("unable to execute %s (%s)"), cmd->name, cmd->filename);
 }
 
-- 
1.7.5.rc0




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to