[PATCH 0/2] OS/2 patches

2023-10-14 Thread KO Myung-Hun
Hi/2.

These are patches for OS/2.

Review, please...

[PATCH 1/2] Fix detection of GNU M4 on mksh
[PATCH 2/2] Ignore failure of setting mode on a temporary file on




[PATCH 2/2] Ignore failure of setting mode on a temporary file on OS/2

2023-10-14 Thread KO Myung-Hun
OS/2 does not allow chmod() on an opened file.

* bin/autom4te.in (handle_output): Ignore setting mode failure on OS/2.
---
 bin/autom4te.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bin/autom4te.in b/bin/autom4te.in
index 71d7e6a6..ac5fe18b 100644
--- a/bin/autom4te.in
+++ b/bin/autom4te.in
@@ -571,7 +571,8 @@ sub handle_output ($$)
 
   # File::Temp doesn't give us access to 3-arg open(2), unfortunately.
   chmod (oct ($mode) & ~(umask), $scratchfile)
-or fatal "setting mode of " . $scratchfile . ": $!";
+or fatal "setting mode of " . $scratchfile . ": $!"
+ unless $^O eq 'os2';
 }
 
   my $in = new Autom4te::XFile ($ocache . $req->id, "<");
-- 
2.42.0




[PATCH 1/2] Fix detection of GNU M4 on mksh

2023-10-14 Thread KO Myung-Hun
* m4/m4.m4 (AC_PROG_GNU_M4): Double-quotes $ac_snip2.
---
 m4/m4.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/m4/m4.m4 b/m4/m4.m4
index e6203118..76fbd04f 100644
--- a/m4/m4.m4
+++ b/m4/m4.m4
@@ -46,7 +46,7 @@ AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4 gnum4],
   test -z "`$ac_path_M4 -F conftest.m4f &1`" \
   && test -z "`AS_ECHO([$ac_snippet]) | $ac_path_M4 --trace=mac 2>&1`" \
   && test -f conftest.m4f \
-  && test x"`AS_ECHO([$ac_snip2]) | \
+  && test x"`AS_ECHO(["$ac_snip2"]) | \
 $ac_path_M4 --trace=T --debug=aflq 2>&1`" = \
   x'm4trace:stdin:3: -1- T()' \
   && ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:
-- 
2.42.0




Re: [PATCH 1/2] Fix detection of GNU M4 on mksh

2023-10-14 Thread Zack Weinberg
On Sat, Oct 14, 2023, at 9:19 AM, KO Myung-Hun wrote:
> * m4/m4.m4 (AC_PROG_GNU_M4): Double-quotes $ac_snip2.

Please explain why it isn't also necessary to add double quotes
around all the other variable expansions in this check, particularly
$ac_snippet and $ac_path_M4.

Also, typo in your commit message: "Double-quotes" should be "Double-quote".

zw



Re: [PATCH 2/2] Ignore failure of setting mode on a temporary file on OS/2

2023-10-14 Thread Zack Weinberg
On Sat, Oct 14, 2023, at 9:19 AM, KO Myung-Hun wrote:
> OS/2 does not allow chmod() on an opened file.
>
> * bin/autom4te.in (handle_output): Ignore setting mode failure on OS/2.

Not OK, for two reasons: (1) IIRC this is used to create scripts with the
execute bit set in at least one place.  Ignoring the chmod failure will
cause confusing errors downstream of where the problem actually was.  (2)
Having a temporary file that's potentially writable by other user ids,
even briefly, risks a variety of security problems.

Also, for maintainability's sake, no checks of $^O anywhere in autoconf's
Perl code unless there is absolutely no alternative.

Really what we need here is for File::Temp to allow us to supply the third
argument to the open() system call.  That feature was added in version
0.2310 of the File::Temp module.  Does anyone have time right now to do the
archaeology on what version of File::Temp shipped with the oldest version of
Perl we currently support?

zw



Re: [PATCH 2/2] Ignore failure of setting mode on a temporary file on OS/2

2023-10-14 Thread Russ Allbery
"Zack Weinberg"  writes:

> Really what we need here is for File::Temp to allow us to supply the
> third argument to the open() system call.  That feature was added in
> version 0.2310 of the File::Temp module.  Does anyone have time right
> now to do the archaeology on what version of File::Temp shipped with the
> oldest version of Perl we currently support?

The standard Perl command corelist -a  tells you the versions of
that module that shipped with each version of Perl.  The first version of
Perl that included a version of File::Temp later than 0.2310 was Perl
5.33.3 (which included 0.2311).

-- 
Russ Allbery (ea...@eyrie.org) 



Re: [PATCH 1/2] Fix detection of GNU M4 on mksh

2023-10-14 Thread KO Myung-Hun
Hi/2.

Zack Weinberg wrote:
> On Sat, Oct 14, 2023, at 9:19 AM, KO Myung-Hun wrote:
>> * m4/m4.m4 (AC_PROG_GNU_M4): Double-quotes $ac_snip2.
> 
> Please explain why it isn't also necessary to add double quotes
> around all the other variable expansions in this check, particularly
> $ac_snippet and $ac_path_M4.
> 

Because this test fails due to $ac_snip2. Anyway I've double-quoted
$ac_snippet, too.

However, not required to $ac_path_M4, which does not contain NL.

> Also, typo in your commit message: "Double-quotes" should be "Double-quote".
> 

Fixed.



-- 
KO Myung-Hun

Korean OS/2 User Community : https://www.os2.kr/
From 304a559a34e2cceeacce30e218e21c1cfd626400 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun 
Date: Sat, 14 Oct 2023 21:59:12 +0900
Subject: [PATCH v2] Fix detection of GNU M4 on mksh

If printing variables containing NL without double-quotation, NL is
replaced with a space on mksh.

As a result, detection of GNU M4 fails because of $ac_snip2 test.

* m4/m4.m4 (AC_PROG_GNU_M4): Double-quote $ac_snippet and $ac_snip2.
---
 m4/m4.m4 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/m4/m4.m4 b/m4/m4.m4
index e6203118..157ac04f 100644
--- a/m4/m4.m4
+++ b/m4/m4.m4
@@ -44,9 +44,9 @@ AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4 gnum4],
   AS_ECHO("$as_me:${as_lineno-$LINENO}: trying $ac_path_M4") \
   >&AS_MESSAGE_LOG_FD
   test -z "`$ac_path_M4 -F conftest.m4f &1`" \
-  && test -z "`AS_ECHO([$ac_snippet]) | $ac_path_M4 --trace=mac 2>&1`" \
+  && test -z "`AS_ECHO(["$ac_snippet"]) | $ac_path_M4 --trace=mac 2>&1`" \
   && test -f conftest.m4f \
-  && test x"`AS_ECHO([$ac_snip2]) | \
+  && test x"`AS_ECHO(["$ac_snip2"]) | \
 $ac_path_M4 --trace=T --debug=aflq 2>&1`" = \
   x'm4trace:stdin:3: -1- T()' \
   && ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:
-- 
2.42.0