Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time::HiRes: macOS checks for both futimes() and utimensat(). #16354

Closed
p5pRT opened this issue Jan 9, 2018 · 9 comments
Closed

Time::HiRes: macOS checks for both futimes() and utimensat(). #16354

p5pRT opened this issue Jan 9, 2018 · 9 comments

Comments

@p5pRT
Copy link

@p5pRT p5pRT commented Jan 9, 2018

Migrated from rt.perl.org#132700 (status was 'resolved')

Searchable as RT132700$

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jan 9, 2018

From @doughera88

Created by @doughera88

after commit c9412ef, compilation on
my Mac OS system fails with​:

cc -c -fno-common -DPERL_DARWIN -mmacosx-version-min=10.13
-fno-strict-aliasing -pipe -fstack-protector-strong -I/opt/local/include
-DPERL_USE_SAFE_PUTENV -Wall -Werror=declaration-after-statement
-Werror=pointer-arith -Wextra -Wc++-compat -Wwrite-strings -Os
-DVERSION=\"1.9750\" -DXS_VERSION=\"1.9750\" "-I../.." -DTIME_HIRES_NANOSLEEP
-DTIME_HIRES_CLOCKID_T -DTIME_HIRES_CLOCK_GETTIME -DTIME_HIRES_CLOCK_GETRES
-DTIME_HIRES_CLOCK_NANOSLEEP -DTIME_HIRES_CLOCK_NANOSLEEP_EMULATION
-DTIME_HIRES_CLOCK -DHAS_FUTIMENS -DHAS_UTIMENSAT -DTIME_HIRES_UTIME
-DTIME_HIRES_STAT_ST_XTIMESPEC -DTIME_HIRES_STAT=1 -DATLEASTFIVEOHOHFIVE HiRes.c
HiRes.xs​:1474​:16​: error​: unrecognized platform name macOS
  if (UTIMENSAT_AVAILABLE) {
  ^
HiRes.xs​:951​:51​: note​: expanded from macro 'UTIMENSAT_AVAILABLE'
# define UTIMENSAT_AVAILABLE __builtin_available(macOS 10.13, *)
  ^
1 error generated.
make[1]​: *** [HiRes.o] Error 1

This is fixed in the attached patch, which uses the same check for both
futimens() and utimensat().

This mattered on Mac OS X High Sierra 10.13.2 with Apple LLVM version
8.1.0 (clang-802.0.38) Target​: x86_64-apple-darwin17.3.0

I'd appreciate confirmation that it doesn't break for others.
I don't know why the previous version passed on the original
submitter's system, nor why it didn't on my system. (I haven't been
able to find good documentation on the relevant functions.)

(perl -V info below is irrelevant, from a different machine.)

--
  Andy Dougherty doughera@​lafayette.edu

Perl Info

Flags:
    category=library
    severity=medium
    module=Time::HiRes

Site configuration information for perl 5.22.0:

Configured by doughera at Wed Jul 22 16:15:18 EDT 2015.

Summary of my perl5 (revision 5 version 22 subversion 0) configuration:
   
  Platform:
    osname=linux, osvers=3.16.0-4-amd64, archname=x86_64-linux
    uname='linux fractal 3.16.0-4-amd64 #1 smp debian 3.16.7-ckt11-1 (2015-05-24) x86_64 gnulinux '
    config_args='-Dprefix=/opt/perl -Dscriptdir=/opt/perl/bin -des'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, 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.9.2', 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='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
    libs=-lpthread -lnsl -lgdbm -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.19.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.19'
  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'



@INC for perl 5.22.0:
    /opt/perl/lib/site_perl/5.22.0/x86_64-linux
    /opt/perl/lib/site_perl/5.22.0
    /opt/perl/lib/5.22.0/x86_64-linux
    /opt/perl/lib/5.22.0
    /opt/perl/lib/site_perl/5.20.1
    /opt/perl/lib/site_perl/5.20.0
    /opt/perl/lib/site_perl/5.18.2
    /opt/perl/lib/site_perl/5.18.1
    /opt/perl/lib/site_perl/5.18.0
    /opt/perl/lib/site_perl/5.16.2
    /opt/perl/lib/site_perl/5.16.0
    /opt/perl/lib/site_perl/5.14.2
    /opt/perl/lib/site_perl/5.12.3
    /opt/perl/lib/site_perl/5.10.1
    /opt/perl/lib/site_perl/5.8.9
    /opt/perl/lib/site_perl
    .


Environment for perl 5.22.0:
    HOME=/home/doughera
    LANG (unset)
    LANGUAGE (unset)
    LC_CTYPE=en_US.UTF-8
    LD_LIBRARY_PATH=/usr/local/lib
    LOGDIR (unset)
    PATH=/home/doughera/script:/home/doughera/bin:/opt/perl/script:/opt/perl/bin:/opt/dist/bin:/opt/gnuplot/bin:/opt/groff/bin:/usr/local/script:/usr/local/bin:/opt/gnu/script:/opt/gnu/bin:/opt/dist/script:/bin:/usr/bin:/usr/X11R6/bin:/usr/openwin/bin:.
    PERL_BADLANG (unset)
    SHELL=/bin/bash
    

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jan 9, 2018

From @doughera88

Inline Patch
diff --git a/dist/Time-HiRes/Changes b/dist/Time-HiRes/Changes
index 5328dc0c02..aa4dc4ef36 100644
--- a/dist/Time-HiRes/Changes
+++ b/dist/Time-HiRes/Changes
@@ -1,4 +1,6 @@
 Revision history for the Perl extension Time::HiRes.
+1.9751 [2018-01-07]
+ - in macOS (OS X) use same check for both futimens() and utimensat()
 
 1.9750 [2017-12-22]
  - update META.yml and META.json for XSLoader instead of DynaLoader
diff --git a/dist/Time-HiRes/HiRes.pm b/dist/Time-HiRes/HiRes.pm
index 8f01b5e679..97412e6861 100644
--- a/dist/Time-HiRes/HiRes.pm
+++ b/dist/Time-HiRes/HiRes.pm
@@ -49,7 +49,7 @@ our @EXPORT_OK = qw (usleep sleep ualarm alarm gettimeofday time tv_interval
 		 stat lstat utime
 		);
 
-our $VERSION = '1.9750';
+our $VERSION = '1.9751';
 our $XS_VERSION = $VERSION;
 $VERSION = eval $VERSION;
 
diff --git a/dist/Time-HiRes/HiRes.xs b/dist/Time-HiRes/HiRes.xs
index 34c9db5067..06f5f3de0f 100644
--- a/dist/Time-HiRes/HiRes.xs
+++ b/dist/Time-HiRes/HiRes.xs
@@ -947,7 +947,7 @@ static int th_clock_nanosleep(clockid_t clock_id, int flags,
 # define FUTIMENS_AVAILABLE 0
 #endif
 #ifdef HAS_UTIMENSAT
-# ifdef PERL_DARWIN
+# if defined(PERL_DARWIN) && __has_builtin(__builtin_available)
 #  define UTIMENSAT_AVAILABLE __builtin_available(macOS 10.13, *)
 # else
 #  define UTIMENSAT_AVAILABLE 1

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jan 9, 2018

From @jkeenan

On Tue, 09 Jan 2018 18​:56​:29 GMT, doughera wrote​:

This is a bug report for perl from doughera@​lafayette.edu,
generated with the help of perlbug 1.40 running under perl 5.22.0.

-----------------------------------------------------------------
[Please describe your issue here]

after commit c9412ef, compilation on
my Mac OS system fails with​:

cc -c -fno-common -DPERL_DARWIN -mmacosx-version-min=10.13
-fno-strict-aliasing -pipe -fstack-protector-strong
-I/opt/local/include
-DPERL_USE_SAFE_PUTENV -Wall -Werror=declaration-after-statement
-Werror=pointer-arith -Wextra -Wc++-compat -Wwrite-strings -Os
-DVERSION=\"1.9750\" -DXS_VERSION=\"1.9750\" "-I../.."
-DTIME_HIRES_NANOSLEEP
-DTIME_HIRES_CLOCKID_T -DTIME_HIRES_CLOCK_GETTIME
-DTIME_HIRES_CLOCK_GETRES
-DTIME_HIRES_CLOCK_NANOSLEEP -DTIME_HIRES_CLOCK_NANOSLEEP_EMULATION
-DTIME_HIRES_CLOCK -DHAS_FUTIMENS -DHAS_UTIMENSAT -DTIME_HIRES_UTIME
-DTIME_HIRES_STAT_ST_XTIMESPEC -DTIME_HIRES_STAT=1
-DATLEASTFIVEOHOHFIVE HiRes.c
HiRes.xs​:1474​:16​: error​: unrecognized platform name macOS
if (UTIMENSAT_AVAILABLE) {
^
HiRes.xs​:951​:51​: note​: expanded from macro 'UTIMENSAT_AVAILABLE'
# define UTIMENSAT_AVAILABLE __builtin_available(macOS 10.13, *)
^
1 error generated.
make[1]​: *** [HiRes.o] Error 1

This is fixed in the attached patch, which uses the same check for
both
futimens() and utimensat().

This mattered on Mac OS X High Sierra 10.13.2 with Apple LLVM version
8.1.0 (clang-802.0.38) Target​: x86_64-apple-darwin17.3.0

I'd appreciate confirmation that it doesn't break for others.
I don't know why the previous version passed on the original
submitter's system, nor why it didn't on my system. (I haven't been
able to find good documentation on the relevant functions.)

(perl -V info below is irrelevant, from a different machine.)

--
Andy Dougherty doughera@​lafayette.edu

Andy, does this commit, made earlier today, resolve the problem for you?

#####
commit de3293c
Author​: Chris 'BinGOs' Williams <chris@​bingosnet.co.uk>
Date​: Tue Jan 9 12​:41​:38 2018 +0000

  Update Time-HiRes to CPAN version 1.9752
 
  [DELTA]
 
  1.9752 [2018-01-04]
  - fix an error in the error message of utimensat() not available​:
  it said futimens() not available
  - add --force alias for Makefile.PL --configure
 
  1.9751 [2018-01-02]
  - in macOS/OSX/Darwin, use __has_builtin() check also for utimensat(),
  can cause errors like
  "HiRes.xs​:1474​:16​: error​: unrecognized platform name macOS"
  [rt.cpan.org #123994]
  (oversight from 1.9749)
.....
#####

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jan 9, 2018

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jan 10, 2018

From @doughera88

On Tue, Jan 09, 2018 at 11​:26​:29AM -0800, James E Keenan via RT wrote​:

On Tue, 09 Jan 2018 18​:56​:29 GMT, doughera wrote​:

after commit c9412ef, compilation on
my Mac OS system fails with​:

HiRes.xs​:1474​:16​: error​: unrecognized platform name macOS
if (UTIMENSAT_AVAILABLE) {
^
HiRes.xs​:951​:51​: note​: expanded from macro 'UTIMENSAT_AVAILABLE'
# define UTIMENSAT_AVAILABLE __builtin_available(macOS 10.13, *)
^

Andy, does this commit, made earlier today, resolve the problem for you?

#####
commit de3293c
Author​: Chris 'BinGOs' Williams <chris@​bingosnet.co.uk>
Date​: Tue Jan 9 12​:41​:38 2018 +0000

Update Time\-HiRes to CPAN version 1\.9752

Yes it does. Thanks for catching that and following up.

My ticket can be closed.

Thanks,

--
  Andy Dougherty doughera@​lafayette.edu

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jan 11, 2018

From @jkeenan

On Wed, 10 Jan 2018 02​:29​:28 GMT, doughera wrote​:

On Tue, Jan 09, 2018 at 11​:26​:29AM -0800, James E Keenan via RT wrote​:

On Tue, 09 Jan 2018 18​:56​:29 GMT, doughera wrote​:

after commit c9412ef, compilation on
my Mac OS system fails with​:

HiRes.xs​:1474​:16​: error​: unrecognized platform name macOS
if (UTIMENSAT_AVAILABLE) {
^
HiRes.xs​:951​:51​: note​: expanded from macro 'UTIMENSAT_AVAILABLE'
# define UTIMENSAT_AVAILABLE __builtin_available(macOS 10.13, *)
^

Andy, does this commit, made earlier today, resolve the problem for you?

#####
commit de3293c
Author​: Chris 'BinGOs' Williams <chris@​bingosnet.co.uk>
Date​: Tue Jan 9 12​:41​:38 2018 +0000

Update Time\-HiRes to CPAN version 1\.9752

Yes it does. Thanks for catching that and following up.

My ticket can be closed.

Thanks,

Closed, as pending release, per OP request.

Thank you very much.
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jan 11, 2018

@jkeenan - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jun 23, 2018

From @khwilliamson

Thank you for filing this report. You have helped make Perl better.

With the release yesterday of Perl 5.28.0, this and 185 other issues have been
resolved.

Perl 5.28.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.28.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT p5pRT closed this as completed Jun 23, 2018
@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jun 23, 2018

@khwilliamson - Status changed from 'pending release' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant