Removed the use of error() in spawn-pipe

On Wed, Aug 28, 2013 at 7:53 PM, Eric Blake <ebl...@redhat.com> wrote:

> On 08/28/2013 08:19 AM, Or Goshen wrote:
> > This patch will make the module usable from a library context, it will
> not
> > call error() unless specifically asked to.
> > Can you please apply it to the trunk
>
> That depends on whether the patch is deemed reasonable; and if
> non-trivial, you may also need to file copyright assignment with FSF.
>
> > and ask the maintainer to relicense to
> > LGPL ?
>
> You already have.  But if Bruno doesn't reply, then we have to escalate
> the matter to the FSF, supposing we can even come to an agreement on how
> to accomplish it technically.
>
> >
> >
> > call error() only if exit_on_error is set on all occations.patch
>
> s/occations/occasions/
>
> >
> >
> > diff -Naur lib/spawn-pipe.c lib.new/spawn-pipe.c
> > --- lib/spawn-pipe.c  2013-08-21 18:47:16.645245700 +0300
> > +++ lib.new/spawn-pipe.c      2013-08-28 17:11:49.769651100 +0300
> > @@ -137,10 +137,12 @@
> >
> >    if (pipe_stdout)
> >      if (pipe2_safer (ifd, O_BINARY | O_CLOEXEC) < 0)
> > -      error (EXIT_FAILURE, errno, _("cannot create pipe"));
> > +      if (exit_on_error) error (EXIT_FAILURE, errno, _("cannot create
> pipe"));
> > +      else return -1;
>
> This is not the preferred formatting style, which would look more like:
>
>   if (pipe2_safer...)
>     {
>       if (exit_on_error)
>         error (EXIT_FAILURE, errno, _("cannot create pipe"));
>       return -1;
>     }
>
> Unfortunately, this patch still has a link-time dependency on error,
> which means that gnulib-tool will still try to unconditionally pull in
> the error module, which is incompatible with LGPLv2+.  To make this work
> properly, you'd have to make the usage of error be conditional on a
> pre-processor check of whether the module is in use, as well as modify
> modules/spawn-pipe to no longer have a hard-coded dependency on the
> error module.
>
> On the other hand, since the code _already_ has instances of returning
> -1 on failure, with errno set, it may just be simpler to blindly follow
> that paradigm everywhere and just ditch the use of error() altogether
> (rather than trying to make it conditional).
>
> Next, note that it is not just the use of error() that makes the current
> spawn-pipe.c code GPL; there is also a dependency on the fatal-signal
> and wait-process modules, which in turn are using xalloc and error
> modules.  Scrubbing this module to be clean from exit is a lot less
> trivial than your initial attempt.
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>

Attachment: Remove error().patch
Description: Binary data

Reply via email to