Hi!

On Sun, 2011-04-10 at 04:06:56 -0500, Jonathan Nieder wrote:
> Ben Armstrong wrote:
> > 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.

Right, also in most cases the correct way to fix such situations is to
upgrade to a fixed package (and not remove the old one) which handles
the error on the new maintainer scripts.

That's also one of the reasons I've been quite reluctant to add such
an option, because it's the easy way out for those kind of errors which
should instead be properly fixed, and I can unfortunately see these
being spread around in forums and blog posts as “the solution” for
those errors.

> 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);
>  }

Yeah, good idea! It will make the behaviour consistent. Queued for my
next push.

thanks,
guillem



--
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