Porting/sync-with-cpan: Changing permissions can lead to test failures

Here is a little quirk in the working of Porting/sync-with-cpan which I 
discovered tonight.

I called:

#####
$ perl Porting/sync-with-cpan Test::Harness
#####

Here is trimmed output:

#####
Fetching 
http://search.cpan.org/CPAN/authors/id/L/LE/LEONT/Test-Harness-3.38.tar.gz
Cleaning out old directory
Unpacking Test-Harness-3.38.tar.gz
Renaming directories
Creating new package directory
Populating new package directory
....
chmod a-x Test-Harness/t/proveversion.t
chmod a-x Test-Harness/t/state.t
....
chmod a-x Test-Harness/t/source_tests/psql.bat
chmod a-x Test-Harness/t/source_tests/source.bat
chmod a-x Test-Harness/t/source_tests/source.t
chmod a-x Test-Harness/t/source_tests/harness_directives
chmod a-x Test-Harness/t/source_tests/harness
chmod a-x Test-Harness/t/source_tests/harness_badtap
chmod a-x Test-Harness/t/source_tests/source.tap
chmod a-x Test-Harness/t/source_tests/source.sh
chmod a-x Test-Harness/t/source_tests/source.pl
chmod a-x Test-Harness/t/source_tests/source.1
chmod a-x Test-Harness/t/source_tests/harness_failure
chmod a-x Test-Harness/t/source_tests/harness_complain
chmod a-x Test-Harness/t/source_tests/source_args.sh
....
#####

The program proceeded to the stage where it runs the tests for the 
distribution being synched.  I got this result:

#####
Running module tests
#   Failed test 'Executable->make_iterator( t/source_tests/source.sh ) 
threw an unexpected error'
#   at t/source_handler.t line 377.
# Could not execute (t/source_tests/source.sh): open3: exec of 
t/source_tests/source.sh failed: Permission denied at 
.../../lib/TAP/Parser/Iterator/Process.pm line 165.
#   Failed test 'Executable->make_iterator( 
t/source_tests/source_args.sh ) threw an unexpected error'
#   at t/source_handler.t line 377.
# Could not execute (t/source_tests/source_args.sh foo): open3: exec of 
t/source_tests/source_args.sh foo failed: Permission denied at 
.../../lib/TAP/Parser/Iterator/Process.pm line 165.
# Looks like you planned 79 tests but ran 73.
# Looks like you failed 2 tests of 73 run.
Failed 1 test out of 55, 98.18% okay.
### Since not all tests were successful, you may want to run some of
### them individually and examine any diagnostic messages they produce.
### See the INSTALL document's section on "make test".
### You have a good chance to get more information by running
###   ./perl harness
### in the 't' directory since most (>=80%) of the tests succeeded.
### You may have to set your dynamic library search path,
### LD_LIBRARY_PATH, to point to the build directory:
###   setenv LD_LIBRARY_PATH `pwd`; cd t; ./perl harness
###   LD_LIBRARY_PATH=`pwd`; export LD_LIBRARY_PATH; cd t; ./perl harness
###   export LD_LIBRARY_PATH=`pwd`; cd t; ./perl harness
### for csh-style shells, like tcsh; or for traditional/modern
### Bourne-style shells, like bash, ksh, and zsh, respectively.
#####

When I ran the failing test file by itself, I got this output (trimmed):

#####
$ cd t; ./perl harness -v ../cpan/Test-Harness/t/source_handler.t; cd -

ok 1 - TAP::Parser::SourceHandler->can('can_handle')
ok 2 - ... with an appropriate error message
....
ok 17 - Executable->make_iterator( non-existent source->raw ) threw 
expected error

not ok 18 - Executable->make_iterator( t/source_tests/source.sh ) threw 
an unexpected error
#   Failed test 'Executable->make_iterator( t/source_tests/source.sh ) 
threw an unexpected error'
#   at t/source_handler.t line 377.
# Could not execute (t/source_tests/source.sh): open3: exec of 
t/source_tests/source.sh failed: Permission denied at 
.../../lib/TAP/Parser/Iterator/Process.pm line 165.

not ok 19 - Executable->make_iterator( t/source_tests/source_args.sh ) 
threw an unexpected error
#   Failed test 'Executable->make_iterator( 
t/source_tests/source_args.sh ) threw an unexpected error'
#   at t/source_handler.t line 377.
# Could not execute (t/source_tests/source_args.sh foo): open3: exec of 
t/source_tests/source_args.sh foo failed: Permission denied at 
.../../lib/TAP/Parser/Iterator/Process.pm line 165.
ok 20 # skip not running Win32

,,,
ok 73 - ... and we should have no more results
# Looks like you planned 79 tests but ran 73.
# Looks like you failed 2 tests of 73 run.
Dubious, test returned 2 (wstat 512, 0x200)
Failed 8/79 subtests
	(less 4 skipped subtests: 67 okay)

Test Summary Report
-------------------
.../cpan/Test-Harness/t/source_handler.t (Wstat: 512 Tests: 73 Failed: 2)
   Failed tests:  18-19
   Non-zero exit status: 2
   Parse errors: Bad plan.  You planned 79 tests but ran 73.
Files=1, Tests=73,  0 wallclock secs ( 0.02 usr  0.00 sys +  0.11 cusr 
0.01 csys =  0.14 CPU)
Result: FAIL
#####

I downloaded the Test-Harness-3.38 tarball from CPAN and unpacked it.  I 
noticed that 3 files in t/source_tests are executable:

#####
[source_tests] 564 $ ls -l
total 56
....
-rwxr-xr-x 1 jkeenan jkeenan 443 Sep 11  2016 psql.bat
-rw-r--r-- 1 jkeenan jkeenan 149 Jul  7  2013 source
-rw-r--r-- 1 jkeenan jkeenan  21 Jul  7  2013 source.1
-rwxr-xr-x 1 jkeenan jkeenan  54 Sep 11  2016 source_args.sh
-rw-r--r-- 1 jkeenan jkeenan 103 Jul  7  2013 source.bat
-rw-r--r-- 1 jkeenan jkeenan  70 Jul  7  2013 source.pl
-rwxr-xr-x 1 jkeenan jkeenan  46 Sep 11  2016 source.sh
....
#####

However, Porting/sync-with-cpan applieds 'chmod a-x' to these three 
files, as it does to all others in this directory (see above).

I called 'chmod 0775 source_args.sh source.sh'.  (I did not do so for 
psql.bat as I suspected that's only needed on Windows.)  After I did so, 
all of the tests under cpan/Test-Harness now PASSed.

Perhaps we need to make some provision for files in a CPAN distro which 
should remain executable?

Thank you very much.
Jim Keenan
0
jkeen
3/19/2017 1:10:18 AM
perl.perl5.porters 46408 articles. 0 followers. Follow

1 Replies
36 Views

Similar Articles

[PageSpeed] 13

James E Keenan <jkeen@verizon.net> wrote:
> Perhaps we need to make some provision for files in a CPAN distro which
> should remain executable?

I've just pushed e42bf9ad925e88cba25f703da37689d11bdf6cad which makes
Porting/sync-with-cpan honour the data file in Porting/exec-bit.txt:
it skips the "chmod a-x" step on files named there.

-- 
Aaron Crane ** http://aaroncrane.co.uk/
0
arc
3/19/2017 10:15:44 AM
Reply: