Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Time-HiRes CPAN distribution.

Report information
The Basics
Id:
114809
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
andrew [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
Normal
Broken in:
1.9733
Fixed in:
(no value)



Subject: Time::HiRes should override `utime` to allow setting hires access and modification times
This patch adds support for setting higher-precision timestamps via `utime` using futimens for file descriptors and utimensat for files. Tests pass on OpenBSD-current under both perl 5.20.2 and perl 5.22.2. I look forward to critiques as I am my XS skills are pretty new. http://man.openbsd.org/futimens.2
Subject: Time-HiRes-utime-1.9733.patch
diff -Nru ../Time-HiRes-1.9733.orig/HiRes.pm ./HiRes.pm --- ../Time-HiRes-1.9733.orig/HiRes.pm Sun May 29 12:14:27 2016 +++ ./HiRes.pm Sun May 29 12:14:32 2016 @@ -23,9 +23,9 @@ ITIMER_REAL ITIMER_VIRTUAL ITIMER_PROF ITIMER_REALPROF TIMER_ABSTIME d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer - d_nanosleep d_clock_gettime d_clock_getres + d_nanosleep d_clock_gettime d_clock_getres d_hires_utime d_clock d_clock_nanosleep - stat lstat + stat lstat utime ); our $VERSION = '1.9733'; @@ -60,6 +60,7 @@ ($i eq 'clock' && !&d_clock) || ($i eq 'nanosleep' && !&d_nanosleep) || ($i eq 'usleep' && !&d_usleep) || + ($i eq 'utime' && !&d_hires_utime) || ($i eq 'ualarm' && !&d_ualarm)) { require Carp; Carp::croak("Time::HiRes::$i(): unimplemented in this platform"); @@ -92,7 +93,7 @@ use Time::HiRes qw( usleep ualarm gettimeofday tv_interval nanosleep clock_gettime clock_getres clock_nanosleep clock - stat lstat ); + stat lstat utime); usleep ($microseconds); nanosleep ($nanoseconds); @@ -137,6 +138,9 @@ my @stat = stat(FH); my @stat = lstat("file"); + use Time::HiRes qw( utime ); + utime $floating_seconds, $floating_seconds, file...; + =head1 DESCRIPTION The C<Time::HiRes> module implements a Perl interface to the @@ -445,6 +449,23 @@ the access time stamp from t2 need not be greater-than the modify time stamp from t1: it may be equal or I<less>. + +=item utime LIST + +As L<perlfunc/utime> +but with the ability to set the access/modify file timestamps +in subsecond resolution, if the operating system and the filesystem +both support such timestamps. To override the standard utime(): + + use Time::HiRes qw(utime); + +Test for the value of &Time::HiRes::d_hires_utime to find out whether +the operating system supports setting subsecond file timestamps. + +As with CORE::utime(), passing undef as both the atime and mtime will +call the syscall with a NULL argument. + +Returns the number of files successfully changed. =back diff -Nru ../Time-HiRes-1.9733.orig/HiRes.xs ./HiRes.xs --- ../Time-HiRes-1.9733.orig/HiRes.xs Sun May 29 12:14:27 2016 +++ ./HiRes.xs Sun May 29 12:31:58 2016 @@ -1317,6 +1317,84 @@ #endif /* #if defined(HAS_GETITIMER) && defined(HAS_SETITIMER) */ +#if defined(TIME_HIRES_UTIME) + +I32 +utime(accessed, modified, ...) +PROTOTYPE: $$@ + PREINIT: + SV* accessed; + SV* modified; + SV* file; + + struct timespec utbuf[2]; + struct timespec *utbufp = utbuf; + int tot; + + CODE: + dXSARGS; + accessed = ST(0); + modified = ST(1); + items -= 2; + tot = 0; + + if ( accessed == &PL_sv_undef && modified == &PL_sv_undef ) + utbufp = NULL; + else { + if (SvNV(accessed) < 0.0 || SvNV(modified) < 0.0) + croak("Time::HiRes::utime(%"NVgf", %"NVgf"): negative time not invented yet", SvNV(accessed), SvNV(modified)); + Zero(&utbuf, sizeof utbuf, char); + utbuf[0].tv_sec = (Time_t)SvNV(accessed); /* time accessed */ + utbuf[0].tv_nsec = (long)( ( SvNV(accessed) - utbuf[0].tv_sec ) * 1e9 ); + utbuf[1].tv_sec = (Time_t)SvNV(modified); /* time modified */ + utbuf[1].tv_nsec = (long)( ( SvNV(modified) - utbuf[1].tv_sec ) * 1e9 ); + } + + while (items > 0) { + file = POPs; items--; + + if (SvROK(file) && GvIO(SvRV(file)) && IoIFP(sv_2io(SvRV(file)))) { + int fd = PerlIO_fileno(IoIFP(sv_2io(file))); + if (fd < 0) + SETERRNO(EBADF,RMS_IFI); + else +#ifdef HAS_FUTIMENS + if (futimens(fd, utbufp) == 0) + tot++; +#else /* HAS_FUTIMES */ + croak("futimens unimplemented in this platform"); +#endif /* HAS_FUTIMES */ + } + else { +#ifdef HAS_UTIMENSAT + STRLEN len; + char * name = SvPV(file, len); + if (IS_SAFE_PATHNAME(name, len, "utime") && + utimensat(AT_FDCWD, name, utbufp, 0) == 0) + tot++; +#else /* HAS_UTIMENSAT */ + croak("utimensat unimplemented in this platform"); +#endif /* HAS_UTIMENSAT */ + } + } /* while items */ + RETVAL = tot; + + OUTPUT: + RETVAL + +#else /* #if defined(TIME_HIRES_UTIME) */ + +I32 +utime(accessed, modified, ...) + NV nsec + CODE: + croak("Time::HiRes::utime(): unimplemented in this platform"); + RETVAL = 0; + OUTPUT: + RETVAL + +#endif /* #if defined(TIME_HIRES_UTIME) */ + #if defined(TIME_HIRES_CLOCK_GETTIME) NV diff -Nru ../Time-HiRes-1.9733.orig/Makefile.PL ./Makefile.PL --- ../Time-HiRes-1.9733.orig/Makefile.PL Sun May 29 12:14:27 2016 +++ ./Makefile.PL Sun May 29 12:30:27 2016 @@ -354,6 +354,41 @@ EOM } +sub has_futimens { + return 1 if + try_compile_and_link(<<EOM); +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" +#include <sys/time.h> +int main(int argc, char** argv) +{ + int ret; + struct timespec ts[2]; + ret = futimens(0, ts); + ret == 0 ? exit(0) : exit(errno ? errno : -1); +} +EOM +} + +sub has_utimensat{ + return 1 if + try_compile_and_link(<<EOM); +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" +#include <sys/time.h> +#include <fcntl.h> +int main(int argc, char** argv) +{ + int ret; + struct timespec ts[2]; + ret = utimensat(AT_FDCWD, 0, ts, 0); + ret == 0 ? exit(0) : exit(errno ? errno : -1); +} +EOM +} + sub DEFINE { my ($def, $val) = @_; my $define = defined $val ? "$def=$val" : $def ; @@ -631,6 +666,40 @@ print "NOT found.\n"; } + print "Looking for futimens()... "; + my $has_futimens; + if (exists $Config{d_hires_utime}) { + $has_futimens++ if $Config{d_hires_utime}; # Unlikely... + } else { + $has_futimens++ if has_futimens(); + $DEFINE .= ' -DHAS_FUTIMENS'; + } + + if ($has_futimens) { + print "found.\n"; + } else { + print "NOT found.\n"; + } + + print "Looking for utimensat()... "; + my $has_utimensat; + if (exists $Config{d_hires_utime}) { + $has_utimensat++ if $Config{d_hires_utime}; # Unlikely... + } else { + $has_utimensat++ if has_utimensat(); + $DEFINE .= ' -DHAS_UTIMENSAT'; + } + + if ($has_utimensat) { + print "found.\n"; + } else { + print "NOT found.\n"; + } + + if ($has_futimens or $has_utimensat) { + $DEFINE .= ' -DTIME_HIRES_UTIME'; + } + print "Looking for stat() subsecond timestamps...\n"; print "Trying struct stat st_atimespec.tv_nsec..."; @@ -869,7 +938,7 @@ ); foreach (qw (d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer d_nanosleep d_clock_gettime d_clock_getres - d_clock d_clock_nanosleep d_hires_stat)) { + d_clock d_clock_nanosleep d_hires_stat d_hires_utime)) { my $macro = $_; if ($macro =~ /^(d_nanosleep|d_clock)$/) { $macro =~ s/^d_(.+)/TIME_HIRES_\U$1/; @@ -885,6 +954,8 @@ push @names, {name => $_, macro => $macro, value => $val, default => ["IV", "0"]}; next; + } elsif ($macro =~ /^(d_hires_.*)$/) { + $macro =~ s/^d_(.+)/TIME_\U$1/; } else { $macro =~ s/^d_(.+)/HAS_\U$1/; } diff -Nru ../Time-HiRes-1.9733.orig/fallback/const-c.inc ./fallback/const-c.inc --- ../Time-HiRes-1.9733.orig/fallback/const-c.inc Sun May 29 12:14:27 2016 +++ ./fallback/const-c.inc Sun May 29 12:14:32 2016 @@ -19,6 +19,7 @@ #ifndef pTHX_ #define pTHX_ /* 5.6 or later define this for threading support. */ #endif + static int constant_11 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given @@ -87,6 +88,51 @@ } static int +constant_13 (pTHX_ const char *name, IV *iv_return) { + /* When generated this function returned values for the list of names given + here. However, subsequent manual editing may have added or removed some. + CLOCK_HIGHRES TIMER_ABSTIME d_hires_utime */ + /* Offset 1 gives the best switch position. */ + switch (name[1]) { + case 'I': + if (memEQ(name, "TIMER_ABSTIME", 13)) { + /* ^ */ +#ifdef TIMER_ABSTIME + *iv_return = TIMER_ABSTIME; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'L': + if (memEQ(name, "CLOCK_HIGHRES", 13)) { + /* ^ */ +#ifdef CLOCK_HIGHRES + *iv_return = CLOCK_HIGHRES; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case '_': + if (memEQ(name, "d_hires_utime", 13)) { + /* ^ */ +#ifdef TIME_HIRES_UTIME + *iv_return = 1; + return PERL_constant_ISIV; +#else + *iv_return = 0; + return PERL_constant_ISIV; +#endif + } + break; + } + return PERL_constant_NOTFOUND; +} + +static int constant_14 (pTHX_ const char *name, IV *iv_return) { /* When generated this function returned values for the list of names given here. However, subsequent manual editing may have added or removed some. @@ -250,16 +296,17 @@ {name=>"d_getitimer", type=>"IV", macro=>"HAS_GETITIMER", value=>"1", default=>["IV", "0"]}, {name=>"d_gettimeofday", type=>"IV", macro=>"HAS_GETTIMEOFDAY", value=>"1", default=>["IV", "0"]}, {name=>"d_hires_stat", type=>"IV", macro=>"TIME_HIRES_STAT", value=>"1", default=>["IV", "0"]}, + {name=>"d_hires_utime", type=>"IV", macro=>"TIME_HIRES_UTIME", value=>"1", default=>["IV", "0"]}, {name=>"d_nanosleep", type=>"IV", macro=>"TIME_HIRES_NANOSLEEP", value=>"1", default=>["IV", "0"]}, {name=>"d_setitimer", type=>"IV", macro=>"HAS_SETITIMER", value=>"1", default=>["IV", "0"]}, {name=>"d_ualarm", type=>"IV", macro=>"HAS_UALARM", value=>"1", default=>["IV", "0"]}, {name=>"d_usleep", type=>"IV", macro=>"HAS_USLEEP", value=>"1", default=>["IV", "0"]}); -print constant_types(); # macro defs +print constant_types(), "\n"; # macro defs foreach (C_constant ("Time::HiRes", 'constant', 'IV', $types, undef, 3, @names) ) { print $_, "\n"; # C constant subs } -print "#### XS Section:\n"; +print "\n#### XS Section:\n"; print XS_constant ("Time::HiRes", $types); __END__ */ @@ -322,33 +369,7 @@ } break; case 13: - /* Names all of length 13. */ - /* CLOCK_HIGHRES TIMER_ABSTIME */ - /* Offset 2 gives the best switch position. */ - switch (name[2]) { - case 'M': - if (memEQ(name, "TIMER_ABSTIME", 13)) { - /* ^ */ -#ifdef TIMER_ABSTIME - *iv_return = TIMER_ABSTIME; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 'O': - if (memEQ(name, "CLOCK_HIGHRES", 13)) { - /* ^ */ -#ifdef CLOCK_HIGHRES - *iv_return = CLOCK_HIGHRES; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - } + return constant_13 (aTHX_ name, iv_return); break; case 14: return constant_14 (aTHX_ name, iv_return); diff -Nru ../Time-HiRes-1.9733.orig/t/utime.t ./t/utime.t --- ../Time-HiRes-1.9733.orig/t/utime.t Wed Dec 31 16:00:00 1969 +++ ./t/utime.t Sun May 29 12:14:32 2016 @@ -0,0 +1,84 @@ +use strict; + +BEGIN { + require Time::HiRes; + unless(&Time::HiRes::d_hires_utime) { + require Test::More; + Test::More::plan(skip_all => "no hires_utime()"); + } +} + +use Test::More; +use t::Watchdog; +use File::Temp qw( tempfile ); + +use Config; + +my $atime = 1.111111111; +my $mtime = 2.222222222; + +subtest "utime \$fh" => sub { + my ($fh, $filename) = tempfile( "Time-HiRes-utime-XXXXXXXXX", UNLINK => 1 ); + is Time::HiRes::utime($atime, $mtime, $fh), 1, "One file changed"; + my ($got_atime, $got_mtime) = ( Time::HiRes::stat($filename) )[8, 9]; + is $got_atime, $atime, "atime set correctly"; + is $got_mtime, $mtime, "mtime set correctly"; +}; + +subtest "utime \$filename" => sub { + my ($fh, $filename) = tempfile( "Time-HiRes-utime-XXXXXXXXX", UNLINK => 1 ); + is Time::HiRes::utime($atime, $mtime, $filename), 1, "One file changed"; + my ($got_atime, $got_mtime) = ( Time::HiRes::stat($fh) )[8, 9]; + is $got_atime, $atime, "atime set correctly"; + is $got_mtime, $mtime, "mtime set correctly"; +}; + +subtest "utime \$filename and \$fh" => sub { + my ($fh1, $filename1) = tempfile( "Time-HiRes-utime-XXXXXXXXX", UNLINK => 1 ); + my ($fh2, $filename2) = tempfile( "Time-HiRes-utime-XXXXXXXXX", UNLINK => 1 ); + is Time::HiRes::utime($atime, $mtime, $filename1, $fh2), 2, "Two files changed"; + { + my ($got_atime, $got_mtime) = ( Time::HiRes::stat($fh1) )[8, 9]; + is $got_atime, $atime, "File 1 atime set correctly"; + is $got_mtime, $mtime, "File 1 mtime set correctly"; + } + { + my ($got_atime, $got_mtime) = ( Time::HiRes::stat($filename2) )[8, 9]; + is $got_atime, $atime, "File 2 atime set correctly"; + is $got_mtime, $mtime, "File 2 mtime set correctly"; + } +}; + +subtest "utime undef sets time to now" => sub { + my ($fh1, $filename1) = tempfile( "Time-HiRes-utime-XXXXXXXXX", UNLINK => 1 ); + my ($fh2, $filename2) = tempfile( "Time-HiRes-utime-XXXXXXXXX", UNLINK => 1 ); + + my $now = Time::HiRes::time; + is Time::HiRes::utime(undef, undef, $filename1, $fh2), 2, "Two files changed"; + + { + my ($got_atime, $got_mtime) = ( Time::HiRes::stat($fh1) )[8, 9]; + cmp_ok abs( $got_atime - $now), '<', 0.1, "File 1 atime set correctly"; + cmp_ok abs( $got_mtime - $now), '<', 0.1, "File 1 mtime set correctly"; + } + { + my ($got_atime, $got_mtime) = ( Time::HiRes::stat($filename2) )[8, 9]; + cmp_ok abs( $got_atime - $now), '<', 0.1, "File 2 atime set correctly"; + cmp_ok abs( $got_mtime - $now), '<', 0.1, "File 2 mtime set correctly"; + } +}; + +subtest "negative atime dies" => sub { + eval { Time::HiRes::utime(-4, $mtime) }; + like $@, qr/::utime\(-4, 2\.22222\): negative time not invented yet/, + "negative time error"; +}; + +subtest "negative mtime dies" => sub { + eval { Time::HiRes::utime($atime, -4) }; + like $@, qr/::utime\(1.11111, -4\): negative time not invented yet/, + "negative time error"; +}; + +done_testing; +1;
On Sun May 29 15:41:53 2016, ANDREW wrote:
Show quoted text
> This patch adds support for setting higher-precision timestamps via > `utime` using futimens for file descriptors and utimensat for files. > > Tests pass on OpenBSD-current under both perl 5.20.2 and perl 5.22.2. > > I look forward to critiques as I am my XS skills are pretty new.
First round looked pretty good, one small issue: in a system without neither futimens nor utimensat() (OS X) I get a warning: HiRes.c:1886:2: warning: declaration does not declare anything [-Wmissing-declarations] NV; ^~ Looks like the "NV nsec" in the utime() fallback is unused, so I'll remove that. However, some portability issues: IS_SAFE_PATHNAME() seems not be available in some older Perls. I'll look into it.
Show quoted text
On Mon Jun 20 07:21:59 2016, JHI wrote:
Show quoted text
> On Sun May 29 15:41:53 2016, ANDREW wrote:
> > This patch adds support for setting higher-precision timestamps via > > `utime` using futimens for file descriptors and utimensat for files. > > > > Tests pass on OpenBSD-current under both perl 5.20.2 and perl 5.22.2. > > > > I look forward to critiques as I am my XS skills are pretty new.
> > First round looked pretty good, one small issue: in a system without > neither futimens nor utimensat() > (OS X) I get a warning: > > HiRes.c:1886:2: warning: declaration does not declare anything > [-Wmissing-declarations] > NV; > ^~ > > Looks like the "NV nsec" in the utime() fallback is unused, so I'll > remove that. > > However, some portability issues: IS_SAFE_PATHNAME() seems not be > available in some older Perls. I'll look into it. > >
I'm dubious of this logic: + if (exists $Config{d_hires_utime}) { + $has_utimensat++ if $Config{d_hires_utime}; # Unlikely... and the same for futimens. We should not from the general imply the specific.
Subject: Re: [rt.cpan.org #114809] Time::HiRes should override `utime` to allow setting hires access and modification times
Date: Mon, 20 Jun 2016 06:02:53 -0700
To: Jarkko_Hietaniemi via RT <bug-Time-HiRes@rt.cpan.org>
From: Andrew Fresh <andrew@afresh1.com>
On Mon, Jun 20, 2016 at 08:11:27AM -0400, Jarkko_Hietaniemi via RT wrote:
Show quoted text
> I'm dubious of this logic: > > + if (exists $Config{d_hires_utime}) { > + $has_utimensat++ if $Config{d_hires_utime}; # Unlikely... > > and the same for futimens. We should not from the general imply the specific.
Agreed, I thought I fixed that. Oops! -- andrew - http://afresh1.com Hey, I think I see a barn up ahead. -- The American Astronaut
From: pereira.m@gmail.com
On Mon Jun 20 07:21:59 2016, JHI wrote:
Show quoted text
> However, some portability issues: IS_SAFE_PATHNAME() seems not be > available in some older Perls. I'll look into it.
Hi, The current workaround for IS_SAFE_PATHNAME (https://metacpan.org/source/JHI/Time-HiRes-1.9735/HiRes.xs#L927) breaks the installation of this module on Centos 6.5 with Perl 5.010001 The problem is related to the use of the Perl_ck_warner function which seems to be unavailable in this version of perl. The relevant excerpts from the complete log (https://gist.githubusercontent.com/MichaelPereira/cf998fb316f2741ce30e5f5cd8a4067e/raw/c9a03e34057d6a51e8008c806850070dc748c598/gistfile1.txt also attached to the message): <Compilation call of HiRes.c> HiRes.xs: In function ‘XS_Time__HiRes_utime’: HiRes.xs:1378: warning: implicit declaration of function ‘Perl_ck_warner’ <In each test compilation> Can't load '/root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so' for module Time::HiRes: /root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so: undefined symbol: Perl_ck_warner at /usr/lib64/perl5/DynaLoader.pm line 200. at t/nanosleep.t line 4 By any chance, would you know of a way to rewrite the problematic line to avoid using this function? Thanks for your help
Subject: Time_Hires_cpan_installation_failure.txt
cpanm (App::cpanminus) 1.7042 on perl 5.010001 built for x86_64-linux-thread-multi Work directory is /root/.cpanm/work/1466518127.22818 You have make /usr/bin/make You have LWP 5.833 You have /bin/tar: tar (GNU tar) 1.23 Copyright (C) 2010 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. You have /usr/bin/unzip Searching Time::HiRes () on cpanmetadb ... --> Working on Time::HiRes Fetching http://www.cpan.org/authors/id/J/JH/JHI/Time-HiRes-1.9735.tar.gz -> OK Unpacking Time-HiRes-1.9735.tar.gz Entering Time-HiRes-1.9735 Checking configure dependencies from META.json Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.18) Configuring Time-HiRes-1.9735 Running Makefile.PL Configuring Time::HiRes... Using hints hints/linux.pl... Extra libraries: -lrt... Have syscall()... looking for syscall.h... found <syscall.h>. Looking for gettimeofday()... found. Looking for setitimer()... found. Looking for getitimer()... found. You have interval timers (both setitimer and getitimer). Looking for ualarm()... found. Looking for usleep()... found. Looking for nanosleep()... testing... found. You can mix subsecond sleeps with signals, if you want to. You seem to have stat() subsecond timestamps. (Your struct stat has them, but the filesystems must help.) Checking if your kit is complete... Looks good Generating a Unix-style Makefile Writing Makefile for Time::HiRes Writing MYMETA.yml and MYMETA.json Now you may issue 'make'. Do not forget also 'make test'. -> OK Checking dependencies from MYMETA.json ... Checking if you have strict 0 ... Yes (1.04) Checking if you have Test::More 0.82 ... Yes (1.302022) Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.18) Checking if you have DynaLoader 0 ... Yes (1.10) Checking if you have Config 0 ... Yes (undef) Checking if you have Exporter 0 ... Yes (5.63) Checking if you have Carp 0 ... Yes (1.11) Building and testing Time-HiRes-1.9735 cp HiRes.pm blib/lib/Time/HiRes.pm Running Mkbootstrap for HiRes () chmod 644 "HiRes.bs" "/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- HiRes.bs blib/arch/auto/Time/HiRes/HiRes.bs 644 "/usr/bin/perl" "/usr/share/perl5/ExtUtils/xsubpp" -typemap '/usr/share/perl5/ExtUtils/typemap' -typemap '/root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/typemap' HiRes.xs > HiRes.xsc mv HiRes.xsc HiRes.c gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"1.9735\" -DXS_VERSION=\"1.9735\" -fPIC "-I/usr/lib64/perl5/CORE" -DTIME_HIRES_NANOSLEEP -DTIME_HIRES_CLOCK_GETTIME -DTIME_HIRES_CLOCK_GETRES -DTIME_HIRES_CLOCK_NANOSLEEP -DTIME_HIRES_CLOCK -DHAS_FUTIMENS -DHAS_UTIMENSAT -DTIME_HIRES_UTIME -DTIME_HIRES_STAT_XTIM -DTIME_HIRES_STAT=4 -DATLEASTFIVEOHOHFIVE HiRes.c HiRes.xs: In function ‘XS_Time__HiRes_utime’: HiRes.xs:1378: warning: implicit declaration of function ‘Perl_ck_warner’ HiRes.c: In function ‘XS_Time__HiRes_constant’: ./const-xs.inc:11: warning: ‘iv’ may be used uninitialized in this function ./const-xs.inc:11: note: ‘iv’ was declared here rm -f blib/arch/auto/Time/HiRes/HiRes.so LD_RUN_PATH="/lib64" gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -o blib/arch/auto/Time/HiRes/HiRes.so HiRes.o \ -lrt \ chmod 755 blib/arch/auto/Time/HiRes/HiRes.so Manifying 1 pod document "/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- HiRes.bs blib/arch/auto/Time/HiRes/HiRes.bs 644 PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/alarm.t ......... ok t/clock.t ......... ok Can't load '/root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so' for module Time::HiRes: /root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so: undefined symbol: Perl_ck_warner at /usr/lib64/perl5/DynaLoader.pm line 200. at t/gettimeofday.t line 4 Compilation failed in require at t/gettimeofday.t line 4. BEGIN failed--compilation aborted at t/gettimeofday.t line 9. t/gettimeofday.t .. Dubious, test returned 255 (wstat 65280, 0xff00) No subtests run Can't load '/root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so' for module Time::HiRes: /root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so: undefined symbol: Perl_ck_warner at /usr/lib64/perl5/DynaLoader.pm line 200. at t/itimer.t line 14 Compilation failed in require at t/itimer.t line 14. BEGIN failed--compilation aborted at t/itimer.t line 26. t/itimer.t ........ Dubious, test returned 255 (wstat 65280, 0xff00) No subtests run Can't load '/root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so' for module Time::HiRes: /root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so: undefined symbol: Perl_ck_warner at /usr/lib64/perl5/DynaLoader.pm line 200. at t/nanosleep.t line 4 Compilation failed in require at t/nanosleep.t line 4. BEGIN failed--compilation aborted at t/nanosleep.t line 9. t/nanosleep.t ..... Dubious, test returned 255 (wstat 65280, 0xff00) No subtests run t/sleep.t ......... ok Can't load '/root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so' for module Time::HiRes: /root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so: undefined symbol: Perl_ck_warner at /usr/lib64/perl5/DynaLoader.pm line 200. at t/stat.t line 4 Compilation failed in require at t/stat.t line 4. BEGIN failed--compilation aborted at t/stat.t line 14. t/stat.t .......... Dubious, test returned 255 (wstat 65280, 0xff00) No subtests run t/time.t .......... ok t/tv_interval.t ... ok Can't load '/root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so' for module Time::HiRes: /root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so: undefined symbol: Perl_ck_warner at /usr/lib64/perl5/DynaLoader.pm line 200. at t/ualarm.t line 4 Compilation failed in require at t/ualarm.t line 4. BEGIN failed--compilation aborted at t/ualarm.t line 9. t/ualarm.t ........ Dubious, test returned 255 (wstat 65280, 0xff00) No subtests run Can't load '/root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so' for module Time::HiRes: /root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so: undefined symbol: Perl_ck_warner at /usr/lib64/perl5/DynaLoader.pm line 200. at t/usleep.t line 4 Compilation failed in require at t/usleep.t line 4. BEGIN failed--compilation aborted at t/usleep.t line 9. t/usleep.t ........ Dubious, test returned 255 (wstat 65280, 0xff00) No subtests run Can't load '/root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so' for module Time::HiRes: /root/.cpanm/work/1466518127.22818/Time-HiRes-1.9735/blib/arch/auto/Time/HiRes/HiRes.so: undefined symbol: Perl_ck_warner at /usr/lib64/perl5/DynaLoader.pm line 200. at t/utime.t line 4 BEGIN failed--compilation aborted at t/utime.t line 9. t/utime.t ......... Dubious, test returned 255 (wstat 65280, 0xff00) No subtests run Test Summary Report ------------------- t/gettimeofday.t (Wstat: 65280 Tests: 0 Failed: 0) Non-zero exit status: 255 Parse errors: No plan found in TAP output t/itimer.t (Wstat: 65280 Tests: 0 Failed: 0) Non-zero exit status: 255 Parse errors: No plan found in TAP output t/nanosleep.t (Wstat: 65280 Tests: 0 Failed: 0) Non-zero exit status: 255 Parse errors: No plan found in TAP output t/stat.t (Wstat: 65280 Tests: 0 Failed: 0) Non-zero exit status: 255 Parse errors: No plan found in TAP output t/ualarm.t (Wstat: 65280 Tests: 0 Failed: 0) Non-zero exit status: 255 Parse errors: No plan found in TAP output t/usleep.t (Wstat: 65280 Tests: 0 Failed: 0) Non-zero exit status: 255 Parse errors: No plan found in TAP output t/utime.t (Wstat: 65280 Tests: 0 Failed: 0) Non-zero exit status: 255 Parse errors: No plan found in TAP output Files=12, Tests=23, 10 wallclock secs ( 0.04 usr 0.01 sys + 4.56 cusr 0.04 csys = 4.65 CPU) Result: FAIL Failed 7/12 test programs. 0/23 subtests failed. make: *** [test_dynamic] Error 255 -> FAIL Installing Time::HiRes failed. See /root/.cpanm/work/1466518127.22818/build.log for details. Retry with --force to force install it.
Oh, rats. Please try the attached. Note that despite what it is claiming it is not yet the final official Time-HiRes 1.9736. On Tue Jun 21 11:13:33 2016, pereira.m@gmail.com wrote:
Show quoted text
> On Mon Jun 20 07:21:59 2016, JHI wrote:
> > However, some portability issues: IS_SAFE_PATHNAME() seems not be > > available in some older Perls. I'll look into it.
> > Hi, > > The current workaround for IS_SAFE_PATHNAME > (https://metacpan.org/source/JHI/Time-HiRes-1.9735/HiRes.xs#L927) > breaks the installation of this module on Centos 6.5 with Perl > 5.010001 > > The problem is related to the use of the Perl_ck_warner function which > seems to be unavailable in this version of perl. > > The relevant excerpts from the complete log > (https://gist.githubusercontent.com/MichaelPereira/cf998fb316f2741ce30e5f5cd8a4067e/raw/c9a03e34057d6a51e8008c806850070dc748c598/gistfile1.txt > also attached to the message): > > <Compilation call of HiRes.c> > HiRes.xs: In function ‘XS_Time__HiRes_utime’: > HiRes.xs:1378: warning: implicit declaration of function > ‘Perl_ck_warner’ > > <In each test compilation> > Can't load '/root/.cpanm/work/1466518127.22818/Time-HiRes- > 1.9735/blib/arch/auto/Time/HiRes/HiRes.so' for module Time::HiRes: > /root/.cpanm/work/1466518127.22818/Time-HiRes- > 1.9735/blib/arch/auto/Time/HiRes/HiRes.so: undefined symbol: > Perl_ck_warner at /usr/lib64/perl5/DynaLoader.pm line 200. > at t/nanosleep.t line 4 > > By any chance, would you know of a way to rewrite the problematic line > to avoid using this function? > > Thanks for your help
Subject: Time-HiRes-1.9736.tar.gz

Message body not shown because it is not plain text.

From: pereira.m@gmail.com
On Tue Jun 21 19:45:05 2016, JHI wrote:
Show quoted text
> Oh, rats. Please try the attached. Note that despite what it is > claiming it is not yet the final official Time-HiRes 1.9736.
Hi JHI, Thanks for the quick reply time. Unfortunately I am still getting the same error. The reason is that contrary to what is being shown at the top of the error log:
Show quoted text
> cpanm (App::cpanminus) 1.7042 on perl 5.010001 built for x86_64-linux-thread-multi
The version of perl installed on the system is:
Show quoted text
>[root@centos65-test-8 Time-HiRes-1.9736]# perl --version > >This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
In the modified #ifndef, I can get it to work by replacing the PERL_VERSION check from 10 to 11: [root@centos65-test-8 Time-HiRes-1.9736]# diff HiRes.c.1.9736 HiRes.c 940c940 < #if PERL_VERSION >= 10 /* Perl_ck_warner is 5.10.0 -> */ ---
Show quoted text
> #if PERL_VERSION >= 11 /* Perl_ck_warner is 5.11.0 -> */
But I am unable to find in which version exactly was Perk_ck_warner introduced, so I'm not sure if this is going to work for people with Perl 5.11. With the modified check, the rest of the setup runs correctly in my case. Thanks again, Michael
Subject: ifndef_perl_ck_warner.patch
940c940 < #if PERL_VERSION >= 10 /* Perl_ck_warner is 5.10.0 -> */ --- > #if PERL_VERSION >= 11 /* Perl_ck_warner is 5.11.0 -> */
Subject: Re: [rt.cpan.org #114809] Time::HiRes should override `utime` to allow setting hires access and modification times
Date: Wed, 22 Jun 2016 13:27:07 -0400
To: bug-Time-HiRes@rt.cpan.org
From: Jarkko Hietaniemi <jhi@iki.fi>
On Wednesday-201606-22 11:35, pereira.m@gmail.com via RT wrote:
Show quoted text
> Thanks for the quick reply time. Unfortunately I am still getting the same error. The reason is that contrary to what is being shown at the top of the error log: >
>> > cpanm (App::cpanminus) 1.7042 on perl 5.010001 built for x86_64-linux-thread-multi
> The version of perl installed on the system is: >
That is strange. At least according to the perl source code archive of Perl 5.10.0 Perl_ck_warner was available in that version. And this: "perl 5.010001" does mean 5.10.1, it's well-defined that way: (a + b / 1000 + c / 1000000)
From: pereira.m@gmail.com
I confirm that everything is good with Time-HiRes-1.9739. Thanks a lot for the changes


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.