Bug#689412: perl-base: Doesn't throw an error if first parameter is a directory
Axel Beckert
abe at debian.org
Tue Oct 2 10:59:29 UTC 2012
Package: perl-base
Version: 5.10.1-17squeeze3
Version: 5.14.2-13
Severity: minor
Hi,
"perl /tmp/" does nothing (that's still fine), throws no error message
and returns zero as exit code. This is non-intuitive and can cause false
negatives in testsuites (i.e. make them pass when they should fail).
Background and reasoning why calling perl that way should fail with a
non-zero exit code:
We ran into this with an autotools based Perl project using test driven
developement.
Main script: projectname/projectname
Test template: projectname/t/foobar.t.in
Configured test: projectname/t/foobar.t
projectname/t/foobar.t.in contains beyond others the following
Test::More test:
ok( system('perl', "@srcdir@/projectname", '--help') == 0, 'option --help should be allowed' );
autotools replaced "@srcdir@" with ".." in this case, i.e. after running
configure, in projectname/t/foobar.t it looked like this:
ok( system('perl', "../projectname", '--help') == 0, 'option --help should be allowed' );
Calling "./foobar.t" from the "projectname/t" directory level works as
expected, but calling "t/foobar.t" from the "projectname" directory
level did unexpectedly pass the test, too, because
"projectname/../projectname" is the project's base directory.
Our workaround is now to write the test like this:
ok( system('perl', "@srcdir@/t/../projectname", '--help') == 0, 'option --help should be allowed' );
But this seems ugly, non-straight-forward and not obvious.
-- System Information:
Debian Release: 6.0.6
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages perl-base depends on:
ii dpkg 1.15.8.13 Debian package management system
ii libc6 2.11.3-4 Embedded GNU C Library: Shared lib
perl-base recommends no packages.
Versions of packages perl-base suggests:
ii perl 5.10.1-17squeeze3 Larry Wall's Practical Extraction
-- no debconf information
More information about the Perl-maintainers
mailing list