Hi/2.

Gary V. Vaughan wrote:
> On Nov 20, 2014, at 10:33 PM, Gary V. Vaughan <[email protected]> wrote:
>>
>> On Nov 20, 2014, at 4:55 AM, KO Myung-Hun <[email protected]> wrote:
>>> These are OS/2 patches for master branch. Patches for 1.4 branch are
>>> reflected.
>>>
>>> [PATCH 1/5] configury: support DLLs on OS/2
>>
>> Agreed.  But these flags apply to more than just OS/2, so I turned on 
>> -avoid-version and -no-undefined unconditionally.
>>
>>> [PATCH 2/5] m4: support to load modules on OS/2
>>
>> In principle, these seem like good changes, but the implementation is not as 
>> clean as it could be, considering many of these changes certainly may apply 
>> on more than just OS/2.  I've rewritten equivalents to everything except 
>> module name truncation to 8 characters maximum, which I'll figure out how to 
>> do nicely tomorrow.
> 
> On reflection, falling back to the system dlopen() search path is both a 
> security risk, and breaks the process for loading frozen files in the current 
> format, so I reverted that part.  If you need that functionality, then set 
> M4PATH appropriately in the environment, or from a wrapper script e.g.:
> 
>   M4PATH=$LD_LIBRARY_PATH m4
> 

Ok.

And NEED_USCORE is not defined on OS/2 in spite of its being required.
I've fixed libtool and sent the patch. Would you mind reviewing it ?


> I found a nice way to consistently perform path truncation during path 
> searching, though I only tested it lightly from gdb, so please confirm if it 
> works for you as expected on OS2.
> 

I found some problems.

1. A null-terminator may not be appended.
2. A length is invalidated when a path is truncated really.

I attach the fix.

>>> [PATCH 3/5] configury: append $EXEEXT suffix to the executable,
>>> [PATCH 4/5] configury: add -Zargs-resp to LDFLAGS on OS/2.
>>> [PATCH 5/5] esyscmd: fdopen() with a text mode explicitly on OS/2.
>>
>> Ack.
>>
>> Effectively applied and pushed everything here, or equivalents - save module 
>> name truncation.

Thanks a lot.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

>From f1c831594e4e44d5c64d43bacd619376de750be1 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <[email protected]>
Date: Sat, 22 Nov 2014 12:34:14 +0900
Subject: [PATCH] libm4: fix regression of
 2c19e82d5d813565abfc2aca0085e1da339416fd

path_truncate() expects a null-terminated string. So ensure that a
null-terminator is appended.

path_truncate() may change path. So re-calculate a length of path
after path_truncate().

* m4/path.c (m4_path_search): Ensure that a null-terminator is
appended. Re-calculate a length of path after path_truncate().
---
 m4/path.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/m4/path.c b/m4/path.c
index 44ed620..7243447 100644
--- a/m4/path.c
+++ b/m4/path.c
@@ -227,7 +227,8 @@ m4_path_search (m4 *context, const char *filename, const 
char **suffixes)
       size_t mem = strlen (filename);
 
       /* Try appending each of the suffixes we were given.  */
-      filepath = path_truncate (strncpy (xmalloc (mem + max_suffix_len +1), 
filename, mem));
+      filepath = path_truncate (strncpy (xmalloc (mem + max_suffix_len +1), 
filename, mem + 1));
+      mem = strlen (filepath);
       for (i = 0; suffixes && suffixes[i]; ++i)
         {
           strcpy (filepath + mem, suffixes[i]);
@@ -268,7 +269,8 @@ m4_path_search (m4 *context, const char *filename, const 
char **suffixes)
        /* Capture errno only when searching `.'.  */
        e = errno;
 
-      filepath = path_truncate (strncpy (xmalloc (mem + max_suffix_len +1), 
pathname, mem));
+      filepath = path_truncate (strncpy (xmalloc (mem + max_suffix_len +1), 
pathname, mem + 1));
+      mem = strlen (filepath);
       free (pathname);
 
       for (i = 0; suffixes && suffixes[i]; ++i)
-- 
1.8.5.2

_______________________________________________
M4-patches mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/m4-patches

Reply via email to