| Store | Cart

Re: perl-5.22.0-RC1 is now available

From: Steve Hay <stev...@googlemail.com>
Thu, 21 May 2015 19:38:35 +0100
On 21 May 2015 at 18:22, Steve Hay <stev...@googlemail.com> wrote:
> On 21 May 2015 at 17:30, Karl Williamson <pub...@khwilliamson.com> wrote:>> On 05/21/2015 08:08 AM, Ricardo Signes wrote:>>>>>> * kmx <k...@atlas.cz> [2015-05-21T09:51:04]>>>>>>>> The bigger trouble IMO is that without the patch the 5.22.0 release will>>>> fail to compile with currently widely used combination of gcc + mingw-w64>>>> runtime; so rather sooner than later it needs to be addressed anyway.>>>>>>>>> The patch in question is>>> http://www.nntp.perl.org/group/perl.perl5.porters/2015/05/msg227969.html>>>>>> I am inclined to apply it, as its effect seems constrainted to platforms>>> we>>> know are not passing tests at present.>>>>>> I would like some +1 or -1 before I do this, as I plan to release RC2>>> today.>>>>>>> In the absence of review by anyone who knows what they're talking about, I>> can say that the patch looks sane and is seemingly impossible to affect>> platforms outside of the targeted ones.>> I disagree after having a look at the patch. I'm not in a position to> test anything, but jdb raised a valid suggestion here:>> http://www.nntp.perl.org/group/perl.perl5.porters/2015/05/msg227976.html>> kmx said that this didn't work. I believe the reason comes down to> what I wrote a couple of message back in this thread (which bulk88> also mentioned in the other thread): HAS_MKSTEMP is being #defined in> win32/config_H.gc, but that only affects the miniperl.exe build.>> The main perl.exe/dll build uses a config.h generated from> win32/config.gc, which still has d_mkstemp='undef', so that doesn't> get HAS_MKSTEMP #defined as required when doing things the better way> that jdb suggested.>> That could be fixed by conditionally setting d_mkstemp='define' in> win32/config_sh.PL based on the value of $opt{gccversion}.>> I will try to get gcc-4.9 and do this later tonight if nobody else> gets there first.

Is the check against __MINGW64_VERSION_MAJOR >= 4 correct?

I have MinGW-w64 builds of 4.5.3, 4.5.4, 4.6.3, 4.7.0, 4.7.1, 4.7.2,
4.7.4 and 4.8.0 and none of those have mkstemp(). So shouldn't the
check be >= 4.9?

There is also the problem of how to check these #defines in
config_h.PL. We have $opt{gccversion} with which we can check >= 4.9
but how can we differentiate between MinGW (www.mingw.org) and
MinGW-w64 in this script other than by writing a little C program to
probe for those #defines? I also have a bunch of MinGW's and they
don't have mkstemp() either, but I don't see a 4.9 (yet) from
www.mingw.org. (In which case, a simple check for 4.9 would suffice
for now, but only until www.mingw.org make a 4.9 and then it could
break depending on whether their 4.9 also introduces a mkstemp()...)

Assuming a check against 4.9 is ok, I think the attached should do the trick.

From e6e1b23af697b9779b93eacdf4cede293c9b520c Mon Sep 17 00:00:00 2001
From: Steve Hay <stev...@googlemail.com>
Date: Thu, 21 May 2015 19:35:14 +0100
Subject: [PATCH] Handle existing mkstemp() in MinGW-w64 gcc-4.9

Based on a patch by kmx
---
 win32/config_sh.PL | 10 ++++++++++
 win32/makefile.mk  |  8 ++++++++
 win32/win32.c      |  2 ++
 win32/win32.h      |  2 ++
 4 files changed, 22 insertions(+)

diff --git a/win32/config_sh.PL b/win32/config_sh.PL
index 98255a8..aa5c54d 100644
--- a/win32/config_sh.PL
+++ b/win32/config_sh.PL
@@ -282,6 +282,16 @@ elsif ($opt{cc} =~ /\bicl/) {
     $opt{ar} ='xilib';
 }
 
+# MinGW-w64 gcc-4.9 has mkstemp().
+# There isn't yet a MinGW (www.mingw.org) gcc-4.9, but we hope that it will have
+# mkstemp() when it arrives.
+if ($opt{cc} =~ /\bgcc\b/ and $opt{gccversion} =~ /^(\d+)\.(\d+)/) {
+    my($major, $minor) = ($1, $2);
+    if (($major == 4 and $minor >= 9) or $major > 4) {+        $opt{d_mkstemp} = 'define';
+    }
+}
+
 if ($opt{useithreads} eq 'define' && $opt{ccflags} =~ /-DPERL_IMPLICIT_SYS\b/) {
     $opt{d_pseudofork} = 'define';
 }
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 8c4b2fe..5e30db6 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -460,6 +460,8 @@ BUILDOPT        += -fwrapv
 MINIBUILDOPT    += -fwrapv
 .ENDIF
 
+GCCV49 = $(shell for /f "delims=. tokens=1,2,3" %i in ('$(CC) -dumpversion') do @if "%i"=="4" (if "%j" geq "9" echo define) else if "%i" geq "5" (echo define))
+
 i = .i
 o = .o
 a = .a
@@ -1103,6 +1105,7 @@ config.w32 : $(CFGSH_TMPL)
 	@echo #undef NVgf>>$@
 	@echo #undef USE_LONG_DOUBLE>>$@
 	@echo #undef USE_CPLUSPLUS>>$@
+	@echo #undef HAS_MKSTEMP>>$@
 .IF "$(USE_LARGE_FILES)"=="define"
 	@echo #define Off_t $(INT64)>>$@
 	@echo #define LSEEKSIZE ^8>>$@
@@ -1210,6 +1213,11 @@ config.w32 : $(CFGSH_TMPL)
 .ELSE
 	@echo #undef USE_CPLUSPLUS>>$@
 .ENDIF
+.IF "$(GCCV49)"=="define"
+	@echo #define HAS_MKSTEMP>>$@
+.ELSE
+	@echo #undef HAS_MKSTEMP>>$@
+.ENDIF
 	@echo #endif>>$@
 
 ..\git_version.h : $(MINIPERL) ..\make_patchnum.pl
diff --git a/win32/win32.c b/win32/win32.c
index a78c598..a4cf45e 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1124,6 +1124,7 @@ chown(const char *path, uid_t owner, gid_t group)
  * XXX this needs strengthening  (for PerlIO)
  *   -- BKS, 11-11-200
 */
+#ifndef HAS_MKSTEMP
 int mkstemp(const char *path)
 {
     dTHX;
@@ -1144,6 +1145,7 @@ retry:
 	goto retry;
     return fd;
 }
+#endif
 
 static long
 find_pid(pTHX_ int pid)
diff --git a/win32/win32.h b/win32/win32.h
index 8a55202..df030d7 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -352,8 +352,10 @@ extern  void	*sbrk(ptrdiff_t need);
 #endif
 extern	char *	getlogin(void);
 extern	int	chown(const char *p, uid_t o, gid_t g);
+#ifndef HAS_MKSTEMP
 extern  int	mkstemp(const char *path);
 #endif
+#endif
 
 #undef	 Stat
 #define  Stat		win32_stat
-- 1.9.5.msysgit.1

Recent Messages in this Thread
Ricardo Signes May 19, 2015 02:14 pm
Shlomi Fish May 19, 2015 02:34 pm
H.Merijn Brand May 19, 2015 03:03 pm
Dave Mitchell May 20, 2015 09:45 am
Jan Dubois May 20, 2015 05:16 pm
sisy...@optusnet.com.au May 20, 2015 11:37 am
kmx May 21, 2015 01:51 pm
Ricardo Signes May 21, 2015 02:08 pm
kmx May 21, 2015 02:23 pm
Steve Hay May 21, 2015 02:44 pm
Curtis Jewell May 21, 2015 02:47 pm
Karl Williamson May 21, 2015 04:30 pm
Steve Hay May 21, 2015 05:22 pm
Steve Hay May 21, 2015 06:38 pm
Jan Dubois May 21, 2015 07:09 pm
kmx May 21, 2015 08:07 pm
Steve Hay May 21, 2015 08:19 pm
Jan Dubois May 21, 2015 08:34 pm
Messages in this thread