Bug#700470: libmouse-perl: lack of error handling in the build can lead to broken packages.

Dominic Hargreaves dom at earth.li
Wed Feb 13 19:03:49 UTC 2013


tags 700470 +confirmed
found 700470 1.02-1
thanks

On Tue, Feb 12, 2013 at 11:25:58PM +0000, peter green wrote:
> Package: libmouse-perl
> Version: 0.99-1
> Severity: normal
> 
> http://snapshot.raspbian.org/201302121719/raspbian/logs/main/libm/libmouse-perl.log
> 
>   dh_auto_configure -a
> Mouse configured with XS.
> This distribution requires a C compiler, but it's not available, stopped.
>   dh_auto_build -a
> <--snip-->
>   dh_builddeb -a
> dpkg-deb: building package `libmouse-perl' in
> `../libmouse-perl_0.99-1_armhf.deb'.
> 
> The reason it failed to find the compiler was raspbian specific and has
> now been dealt with. However when packages need something to build and
> don't find it they should fail to build with an error, not carry on
> regardless and build a broken package.

Agreed. I can reproduce this with 1.02-1 using

dpkg-buildpackage -us -uc -d

having removed gcc (and thus build-essential) but installed all other
package build-dependencies.

I think the build should have stopped at this point:

   dh_auto_configure
sh: 1: gcc: not found
dpkg-architecture: warning: Couldn't determine gcc system type, falling back to default (native compilation)
Mouse configured with XS.
This distribution requires a C compiler, but it's not available, stopped.

Running this manually gives:

$ dh_auto_configure 
sh: 1: gcc: not found
dh_auto_configure: warning: Couldn't determine gcc system type, falling back to default (native compilation)
sh: 1: gcc: not found
dpkg-architecture: warning: Couldn't determine gcc system type, falling back to default (native compilation)
Mouse configured with XS.
This distribution requires a C compiler, but it's not available, stopped.
$ echo $?
0
$ perl Makefile.PL 
Mouse configured with XS.
This distribution requires a C compiler, but it's not available, stopped.
$ echo $?
0

So the bug is in the upstream package build system; specifically
_xs_initialize() in inc/Module/Install/XSUtil.pm (requires_c99 and
requires_cplusplus also appear equally problematic).

http://search.cpan.org/~gfuji/Module-Install-XSUtil-0.43/lib/Module/Install/XSUtil.pm

says:

"[...]  it will be called for you when this module is initialized, and your Makefile.PL process will exit with 0 status."

so this seems to be deliberate, but it seems wrong to me. However, no
Makefile is produced at this point, so what does dh_auto_build do?

$ dh_auto_build --verbose
sh: 1: gcc: not found
dh_auto_build: warning: Couldn't determine gcc system type, falling back to default (native compilation)
sh: 1: gcc: not found
dpkg-architecture: warning: Couldn't determine gcc system type, falling back to default (native compilation)
$ echo $?
0

Nothing very much. And because of the way the dh automatic stuff works,
it's not obvious that it should do anything different.

The most obvious fix would be for those XSUtil.pm functions to return
non-zero, but what other options do we have? dh_auto_configure could
be paranoid, and, when run in Makefile.PL mode, look to see whether
there is a Makefile itself and exit non-zero if there isn't.

I will start by filing a bug upstream and seeing what the author thinks,
so we at least understand why the exist 0 is apparently deliberate.

-- 
Dominic Hargreaves | http://www.larted.org.uk/~dom/
PGP key 5178E2A5 from the.earth.li (keyserver,web,email)



More information about the pkg-perl-maintainers mailing list