Skip Menu |

This queue is for tickets about the File-Path CPAN distribution.

Report information
The Basics
Id: 121967
Status: open
Priority: 0/
Queue: File-Path

People
Owner: jkeenan [...] cpan.org
Requestors: zdm [...] softvisio.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Tests failed under docker container
Date: Fri, 2 Jun 2017 19:03:51 +0300
To: bug-File-Path [...] rt.cpan.org
From: "zdm [...] softvisio.net" <zdm [...] softvisio.net>
Not installed under linux docker container. Below you can see log and perl -V output. cpanm (App::cpanminus) 1.7043 on perl 5.026000 built for x86_64-linux-ld Work directory is /root/.cpanm/work/1496419259.317 You have make /usr/bin/make You have /usr/bin/wget You have /usr/bin/tar: tar (GNU tar) 1.26 Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by John Gilmore and Jay Fenlason. Searching File::Path () on metacpan ... --2017-06-02 16:00:59-- http://api.metacpan.org/v0/file/_search?source=%7B%22query%22%3A%7B%22filtered%22%3A%7B%22filter%22%3A%7B%22and%22%3A%5B%7B%22not%22%3A%7B%22term%22%3A%7B%22status%22%3A%22backpan%22%7D%7D%7D%2C%7B%22term%22%3A%7B%22maturity%22%3A%22released%22%7D%7D%5D%7D%2C%22query%22%3A%7B%22nested%22%3A%7B%22score_mode%22%3A%22max%22%2C%22path%22%3A%22module%22%2C%22query%22%3A%7B%22custom_score%22%3A%7B%22metacpan_script%22%3A%22score_version_numified%22%2C%22query%22%3A%7B%22constant_score%22%3A%7B%22filter%22%3A%7B%22and%22%3A%5B%7B%22term%22%3A%7B%22module.authorized%22%3Atrue%7D%7D%2C%7B%22term%22%3A%7B%22module.indexed%22%3Atrue%7D%7D%2C%7B%22term%22%3A%7B%22module.name%22%3A%22File%3A%3APath%22%7D%7D%2C%7B%22range%22%3A%7B%22module.version_numified%22%3A%7B%22gte%22%3A%220.000%22%7D%7D%7D%5D%7D%7D%7D%7D%7D%7D%7D%7D%7D%2C%22fields%22%3A%5B%22date%22%2C%22release%22%2C%22author%22%2C%22module%22%2C%22status%22%5D%7D Resolving api.metacpan.org (api.metacpan.org)... 151.101.12.129 Connecting to api.metacpan.org (api.metacpan.org)|151.101.12.129|:80... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [application/json] Saving to: ‘STDOUT’ 0K 22.6M=0s 2017-06-02 16:00:59 (22.6 MB/s) - written to stdout [963] --2017-06-02 16:00:59-- http://api.metacpan.org/v0/release/_search?source=%7B%22fields%22%3A%5B%22download_url%22%2C%22stat%22%2C%22status%22%5D%2C%22filter%22%3A%7B%22and%22%3A%5B%7B%22term%22%3A%7B%22release.name%22%3A%22File-Path-2.13%22%7D%7D%2C%7B%22term%22%3A%7B%22release.author%22%3A%22JKEENAN%22%7D%7D%5D%7D%7D Resolving api.metacpan.org (api.metacpan.org)... 151.101.12.129 Connecting to api.metacpan.org (api.metacpan.org)|151.101.12.129|:80... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [application/json] Saving to: ‘STDOUT’ 0K 21.0M=0s 2017-06-02 16:01:00 (21.0 MB/s) - written to stdout [800] --> Working on File::Path Fetching https://cpan.metacpan.org/authors/id/J/JK/JKEENAN/File-Path-2.13.tar.gz ... --2017-06-02 16:01:00-- https://cpan.metacpan.org/authors/id/J/JK/JKEENAN/File-Path-2.13.tar.gz Resolving cpan.metacpan.org (cpan.metacpan.org)... 151.101.0.249, 151.101.64.249, 151.101.128.249, ... Connecting to cpan.metacpan.org (cpan.metacpan.org)|151.101.0.249|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 31094 (30K) [application/x-gzip] Saving to: ‘File-Path-2.13.tar.gz’ 0K .......... .......... .......... 100% 599K=0.05s 2017-06-02 16:01:00 (599 KB/s) - ‘File-Path-2.13.tar.gz’ saved [31094/31094] Unpacking File-Path-2.13.tar.gz OK File-Path-2.13/ File-Path-2.13/META.yml File-Path-2.13/MANIFEST.SKIP File-Path-2.13/Changes File-Path-2.13/META.json File-Path-2.13/MANIFEST File-Path-2.13/xt/ File-Path-2.13/xt/extra.t File-Path-2.13/xt/setup_tests.pl File-Path-2.13/Makefile.PL File-Path-2.13/README File-Path-2.13/t/ File-Path-2.13/t/Path.t File-Path-2.13/t/Path-Class.t File-Path-2.13/t/Path_win32.t File-Path-2.13/t/taint.t File-Path-2.13/t/FilePathTest.pm File-Path-2.13/t/Path_root.t File-Path-2.13/lib/ File-Path-2.13/lib/File/ File-Path-2.13/lib/File/Path.pm Entering File-Path-2.13 Checking configure dependencies from META.json Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.28) Running Makefile.PL Configuring File-Path-2.13 ... Checking if your kit is complete... Looks good Generating a Unix-style Makefile Writing Makefile for File::Path Writing MYMETA.yml and MYMETA.json Checking dependencies from MYMETA.json ... Checking if you have File::Spec::Functions 0 ... Yes (3.67) Checking if you have Errno 0 ... Yes (1.28) Checking if you have File::Basename 0 ... Yes (2.85) Checking if you have Config 0 ... Yes (5.026000) Checking if you have Fcntl 0 ... Yes (1.13) Checking if you have Exporter 0 ... Yes (5.72) Checking if you have Cwd 0 ... Yes (3.67) Checking if you have SelectSaver 0 ... Yes (1.02) Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.28) Checking if you have Carp 0 ... Yes (1.42) Checking if you have Test::Simple 0.44 ... Yes (1.302085) Checking if you have File::Spec 0 ... Yes (3.67) OK Building and testing File-Path-2.13 ... cp lib/File/Path.pm blib/lib/File/Path.pm PERL_DL_NONLAZY=1 "/usr/local/perlbrew/perls/perl-5.26.0/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/Path-Class.t .. ok t/Path.t ........ ok # Failed test 'created a directory not owned by 1:inpuu...' # at t/Path_root.t line 77. # 'unable to map inpuu to a gid, group ownership not changed: at t/Path_root.t line 72. # ' # doesn't match '(?^s:unable to map 1 to a uid, ownership not changed:)' # Looks like you failed 1 test of 11. t/Path_root.t ... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/11 subtests t/Path_win32.t .. skipped: not win32 t/taint.t ....... ok Test Summary Report ------------------- t/Path_root.t (Wstat: 256 Tests: 11 Failed: 1) Failed test: 8 Non-zero exit status: 1 Files=5, Tests=216, 0 wallclock secs ( 0.05 usr 0.02 sys + 0.30 cusr 0.12 csys = 0.49 CPU) Result: FAIL Failed 1/5 test programs. 1/216 subtests failed. make: *** [test_dynamic] Error 255 ! Installing File::Path failed. See /root/.cpanm/work/1496419259.317/build.log for details. Retry with --force to force install it. FAIL Summary of my perl5 (revision 5 version 26 subversion 0) configuration: Platform: osname=linux osvers=4.4.0-78-generic archname=x86_64-linux-ld uname='linux dfa0e46aa7ac 4.4.0-78-generic #99-ubuntu smp thu apr 27 15:29:09 utc 2017 x86_64 x86_64 x86_64 gnulinux ' config_args='-de -Dprefix=/usr/local/perlbrew/perls/perl-5.26.0 -Dusemorebits -Duselargefiles -Dman1dir=none -Dman3dir=none -Aeval:scriptdir=/usr/local/perlbrew/perls/perl-5.26.0/bin' hint=recommended useposix=true d_sigaction=define useithreads=undef usemultiplicity=undef use64bitint=define use64bitall=define uselongdouble=define usemymalloc=n default_inc_excludes_dot=define bincompat5005=undef Compiler: cc='cc' ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2' optimize='-O2' cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include' ccversion='' gccversion='4.8.5 20150623 (Red Hat 4.8.5-11)' gccosandvers='' intsize=4 longsize=8 ptrsize=8 doublesize=8 byteorder=12345678 doublekind=3 d_longlong=define longlongsize=8 d_longdbl=define longdblsize=16 longdblkind=3 ivtype='long' ivsize=8 nvtype='long double' nvsize=16 Off_t='off_t' lseeksize=8 alignbytes=16 prototype=define Linker and Libraries: ld='cc' ldflags =' -fstack-protector-strong -L/usr/local/lib' libpth=/usr/local/lib /usr/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64 libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc libc=libc-2.17.so so=so useshrplib=false libperl=libperl.a gnulibc_version='2.17' Dynamic Linking: dlsrc=dl_dlopen.xs dlext=so d_dlsymun=undef ccdlflags='-Wl,-E' cccdlflags='-fPIC' lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP PERL_OP_PARENT PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_LONG_DOUBLE USE_PERLIO USE_PERL_ATOF Locally applied patches: Devel::PatchPerl 1.48 Built under linux Compiled at May 31 2017 08:21:39 %ENV: PERLBREW="command perlbrew" PERLBREW_BASHRC_VERSION="0.78" PERLBREW_HOME="/usr/local/perlbrew" PERLBREW_MANPATH="/usr/local/perlbrew/perls/perl-5.26.0/man" PERLBREW_PATH="/usr/local/perlbrew/bin:/usr/local/perlbrew/perls/perl-5.26.0/bin" PERLBREW_PERL="perl-5.26.0" PERLBREW_ROOT="/usr/local/perlbrew" PERLBREW_VERSION="0.78" PERL_CPANM_OPT="--metacpan --mirror https://cpan.metacpan.org/" PERL_VERSION="5.26.0" @INC: /usr/local/perlbrew/perls/perl-5.26.0/lib/site_perl/5.26.0/x86_64-linux-ld /usr/local/perlbrew/perls/perl-5.26.0/lib/site_perl/5.26.0 /usr/local/perlbrew/perls/perl-5.26.0/lib/5.26.0/x86_64-linux-ld /usr/local/perlbrew/perls/perl-5.26.0/lib/5.26.0
I see the same issue. It stems from the fact that the last user found is 'system-dbus-proxy' in my CentOS7 base. The code to generate a user name out of that using ++ returns 1 because it does math instead of incrementing characters... nicky@hoser:~$: 0s]$ perl -M5.14.1 -e 'my $a ="system-dbus-proxy"; ++$a; say $a;' 1 nicky@hoser:~$: 0s]$ perl -M5.14.1 -e 'my $a ="systemdbusproxy"; ++$a; say $a;' systemdbusproxz
On Thu Aug 17 12:01:40 2017, NICKY wrote: Show quoted text
> I see the same issue. It stems from the fact that the last user found > is 'system-dbus-proxy' in my CentOS7 base. The code to generate a user > name out of that using ++ returns 1 because it does math instead of > incrementing characters... > > > nicky@hoser:~$: 0s]$ perl -M5.14.1 -e 'my $a ="system-dbus-proxy"; > ++$a; say $a;' > 1 > nicky@hoser:~$: 0s]$ perl -M5.14.1 -e 'my $a ="systemdbusproxy"; ++$a; > say $a;' > systemdbusproxz
This worked for me. May not be elegant but the test passes: # invent a user and group that don't exist $max_user =~ s/[^a-zA-Z]//g; do { ++$max_user } while ( getpwnam( $max_user ) );
On Thu Aug 17 12:13:39 2017, NICKY wrote: Show quoted text
> On Thu Aug 17 12:01:40 2017, NICKY wrote:
> > I see the same issue. It stems from the fact that the last user found > > is 'system-dbus-proxy' in my CentOS7 base. The code to generate a user > > name out of that using ++ returns 1 because it does math instead of > > incrementing characters... > > > > > > nicky@hoser:~$: 0s]$ perl -M5.14.1 -e 'my $a ="system-dbus-proxy"; > > ++$a; say $a;' > > 1 > > nicky@hoser:~$: 0s]$ perl -M5.14.1 -e 'my $a ="systemdbusproxy"; ++$a; > > say $a;' > > systemdbusproxz
> > This worked for me. May not be elegant but the test passes: > > # invent a user and group that don't exist > $max_user =~ s/[^a-zA-Z]//g; > do { ++$max_user } while ( getpwnam( $max_user ) ); >
Thank you for that information. I have to admit that, when I read the original post in this RT and saw the word "docker" in ths Subject line, I deferred thinking about the problem because I have little experience with Docker and because File::Path has much bigger problems. However, your report eventually made me realize that this problem has nothing whatsoever to do with Docker. It has to do with some magic in Perl's autoincrement operator. See 'perldoc perlvar'. Can you either: * Try out the patch to t/Path_root.t attached. or * Clone https://github.com/jkeenan/File-Path/, checkout the rt121967-20170817 branch, and run all tests both as a regular user and as root and, apropos the original post, inside a docker environment? Thank you very much. Jim Keenan
Subject: 0001-Change-method-of-generating-names-for-non-existent-u.patch
From 73052d85fc35d8753511805a1c914de94008b005 Mon Sep 17 00:00:00 2001 From: James E Keenan <jkeenan@cpan.org> Date: Thu, 17 Aug 2017 14:12:32 -0400 Subject: [PATCH] Change method of generating names for non-existent user and group. We issue a warning when a directory is created owned by a non-existent user or group. To test that that feature works, we have to create names for a phony user and a phony group. Until now, the method used to use getpwnam() to search for the name of the user with the highest UID and to use getgrnam() to search for the name of the group with the highest GID. Then, that name would be autoincremented like this: ++$max_user; ... where the intent is, e.g., to take the string 'nobody' and change it to 'nobodz'. But if, say, the user with the highest UID is 'system-dbus-proxy', that won't work because it runs afoul of this provision described in 'perldoc perlop' ("Auto-increment and Auto-decrement"): "The auto-increment operator has a little extra builtin magic to it. If you increment a variable that is numeric, or that has ever been used in a numeric context, you get a normal increment. If, however, the variable has been used in only string contexts since it was set, and has a value that is not the empty string and matches the pattern "/^[a-zA-Z]*[0-9]*\z/", the increment is done as a string, preserving each character within its range, with carry[.]" A string like 'system-dbus-proxy' -- which in certain environments is a plausible user name -- does not match that pattern and the autoincrement statement ends up returning 1, which causes tests in t/Path_root.t to fail. So we have to devise a new way of generating names for a phony user and phony group. For: https://rt.cpan.org/Ticket/Display.html?id=121967 Thanks to zdm and NICKY for reporting this problem. --- t/Path_root.t | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/t/Path_root.t b/t/Path_root.t index 2647b7f..8af39f7 100644 --- a/t/Path_root.t +++ b/t/Path_root.t @@ -64,23 +64,23 @@ is($dir_gid, $max_gid, "... owned by group $max_gid"); { # invent a user and group that don't exist - do { ++$max_user } while ( getpwnam( $max_user ) ); - do { ++$max_group } while ( getgrnam( $max_group ) ); + my $phony_user = get_phony_user(); + my $phony_group = get_phony_group(); $dir = catdir($dir_stem, 'aad'); my $rv = _run_for_warning( sub { make_path( $dir, - { user => $max_user, group => $max_group } + { user => $phony_user, group => $phony_group } ) } ); like( $rv, - qr{unable to map $max_user to a uid, ownership not changed:}s, - "created a directory not owned by $max_user:$max_group...", + qr{unable to map $phony_user to a uid, ownership not changed:}s, + "created a directory not owned by $phony_user:$phony_group...", ); like( $rv, - qr{unable to map $max_group to a gid, group ownership not changed:}s, - "created a directory not owned by $max_user:$max_group...", + qr{unable to map $phony_group to a gid, group ownership not changed:}s, + "created a directory not owned by $phony_user:$phony_group...", ); } @@ -137,3 +137,30 @@ sub prereq { return "getgrent() appears to be insane" unless $max_gid > 0; return undef; } + +sub get_phony_user { + return "getpwent() not implemented on $^O" unless $Config{d_getpwent}; + return "not running as root" unless $< == 0; + my %real_users = (); + while(my @a=getpwent()) { + $real_users{$a[0]}++; + } + my $phony_stem = 'phonyuser'; + my $phony = ''; + do { $phony = $phony_stem . int(rand(10000)); } until (! $real_users{$phony}); + return $phony; +} + +sub get_phony_group { + return "getgrent() not implemented on $^O" unless $Config{d_getgrent}; + return "not running as root" unless $< == 0; + my %real_groups = (); + while(my @a=getgrent()) { + $real_groups{$a[0]}++; + } + my $phony_stem = 'phonygroup'; + my $phony = ''; + do { $phony = $phony_stem . int(rand(10000)); } until (! $real_groups{$phony}); + return $phony; +} + -- 2.9.0
This patch fixes it for me when building on 5.28.0
On Fri Aug 31 01:18:12 2018, TODDR wrote: Show quoted text
> This patch fixes it for me when building on 5.28.0
I was getting this: $>LD_LIBRARY_PATH=/root/rpmbuild/BUILD/perl-5.28.0 ./TEST -v ../cpan/File-Path/t/Path_root.t t/../cpan/File-Path/t/Path_root ... 1..11 ok 1 - created a directory owned by cpanelcabcache... ok 2 - ... owned by 1045 ok 3 - created a directory owned by group a.b_ct8yanamecon... ok 4 - ... owned by group 1146 ok 5 - created a directory owned by cpanelcabcache:a.b_ct8yanamecon... ok 6 - ... owned by 1045 ok 7 - ... owned by group 1146 ok 8 - created a directory not owned by cpanelcabcachf:1... not ok 9 - created a directory not owned by cpanelcabcachf:1... # Failed test 'created a directory not owned by cpanelcabcachf:1...' # at t/Path_root.t line 81. # 'unable to map cpanelcabcachf to a uid, ownership not changed: at t/Path_root.t line 72. # ' # doesn't match '(?^s:unable to map 1 to a gid, group ownership not changed:)' # Looks like you failed 1 test of 11. FAILED at test 9 Failed 1 test out of 1, 0.00% okay. ../cpan/File-Path/t/Path_root.t ### 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 may have to set your dynamic library search path, ### LD_LIBRARY_PATH, to point to the build directory: ### setenv LD_LIBRARY_PATH `pwd`:$LD_LIBRARY_PATH; cd t; ./perl harness ### LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd t; ./perl harness ### export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH; cd t; ./perl harness ### for csh-style shells, like tcsh; or for traditional/modern ### Bourne-style shells, like bash, ksh, and zsh, respectively. Elapsed: 0 sec u=0.02 s=0.00 cu=0.10 cs=0.01 scripts=1 tests=11
On Fri Aug 31 01:19:26 2018, TODDR wrote: Show quoted text
> On Fri Aug 31 01:18:12 2018, TODDR wrote:
> > This patch fixes it for me when building on 5.28.0
> > I was getting this: > > $>LD_LIBRARY_PATH=/root/rpmbuild/BUILD/perl-5.28.0 ./TEST -v > ../cpan/File-Path/t/Path_root.t > t/../cpan/File-Path/t/Path_root ... 1..11 > ok 1 - created a directory owned by cpanelcabcache... > ok 2 - ... owned by 1045 > ok 3 - created a directory owned by group a.b_ct8yanamecon... > ok 4 - ... owned by group 1146 > ok 5 - created a directory owned by cpanelcabcache:a.b_ct8yanamecon... > ok 6 - ... owned by 1045 > ok 7 - ... owned by group 1146 > ok 8 - created a directory not owned by cpanelcabcachf:1... > not ok 9 - created a directory not owned by cpanelcabcachf:1... > # Failed test 'created a directory not owned by cpanelcabcachf:1...' > # at t/Path_root.t line 81. > # 'unable to map cpanelcabcachf to a uid, ownership > not changed: at t/Path_root.t line 72. > # ' > # doesn't match '(?^s:unable to map 1 to a gid, group ownership > not changed:)' > # Looks like you failed 1 test of 11. > FAILED at test 9 > Failed 1 test out of 1, 0.00% okay. > ../cpan/File-Path/t/Path_root.t > ### 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 may have to set your dynamic library search path, > ### LD_LIBRARY_PATH, to point to the build directory: > ### setenv LD_LIBRARY_PATH `pwd`:$LD_LIBRARY_PATH; cd t; ./perl > harness > ### LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; > cd t; ./perl harness > ### export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH; cd t; ./perl > harness > ### for csh-style shells, like tcsh; or for traditional/modern > ### Bourne-style shells, like bash, ksh, and zsh, respectively. > Elapsed: 0 sec > u=0.02 s=0.00 cu=0.10 cs=0.01 scripts=1 tests=11
Thanks for the feedback. Please try CPAN version 2.16, released within the past hour.