This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU M4 source repository".
http://git.sv.gnu.org/gitweb/?p=m4.git;a=commitdiff;h=2c19e82d5d813565abfc2aca0085e1da339416fd The branch, master has been updated via 2c19e82d5d813565abfc2aca0085e1da339416fd (commit) via 3285293706f3a2af3a3c5c97ec48c59a0b8bf63f (commit) from 9f19b5b5d14c1aba2dcd7e0d84a9d12c39dc4487 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2c19e82d5d813565abfc2aca0085e1da339416fd Author: Gary V. Vaughan <[email protected]> Date: Fri Nov 21 18:39:23 2014 +0000 modules: support 8.3 truncated filenames. * m4/path.c (TRUNCATE_FILENAME): New macro, defined on OS2. (path_truncate): New function when TRUNCATE_FILENAME is defined, otherwise a null-operation macro. Trim the basename to no more than 8 characters, followed by the extension. (m4_path_search): Use it. Reported by Ko Myung-Hun Signed-off-by: Gary V. Vaughan <[email protected]> commit 3285293706f3a2af3a3c5c97ec48c59a0b8bf63f Author: Gary V. Vaughan <[email protected]> Date: Fri Nov 21 13:41:01 2014 +0000 Revert "modules: fall-back to system dlopen search path." The original patch had security issues, and broke loading of frozen files including modules that are only available along the fall-back path. This reverts commit 1d887c9b5002d8e9a4e65c192c8a1b7355cc356a. ----------------------------------------------------------------------- Summary of changes: m4/module.c | 4 ---- m4/path.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/m4/module.c b/m4/module.c index be6a58d..838c5f9 100644 --- a/m4/module.c +++ b/m4/module.c @@ -286,10 +286,6 @@ m4__module_open (m4 *context, const char *name, m4_obstack *obs) char *filepath = m4_path_search (context, name, suffixes); void *handle = NULL; - /* Use system module search path if m4_path_search fails. */ - if (!filepath) - filepath = xstrdup (name); - if (filepath) { handle = dlopen (filepath, RTLD_NOW|RTLD_GLOBAL); diff --git a/m4/path.c b/m4/path.c index 281795e..44ed620 100644 --- a/m4/path.c +++ b/m4/path.c @@ -34,6 +34,10 @@ #include "dirname.h" #include "filenamecat.h" +#if OS2 /* Any others? */ +# define TRUNCATE_FILENAME 1 +#endif + /* Define this to see runtime debug info. Implied by DEBUG. */ /*#define DEBUG_INCL */ @@ -127,6 +131,43 @@ include_env_init (m4 *context) } +#if TRUNCATE_FILENAME +/* Destructively modify PATH to contain no more than 8 non-`.' + characters, optionally followed by a `.' and a filenname extension + of 3 characters or fewer. */ +static char * +path_truncate (char *path) +{ + char *p, *beg = path; /* following final '/' */ + for (p = path; *p != '\0'; ++p) + { + if (ISSLASH (*p)) + beg = 1+ p; + } + + char *end = strchr (beg, '.'); /* first period */ + char *ext = strrchr (beg, '.'); /* last period */ + + size_t len = (size_t) (end - beg); /* length of filename element */ + if (len > 8) + end = beg + 8; + + if (ext == NULL) + { + *end = '\0'; + } + else if (ext != end) + { + stpncpy (end, ext, 4); + } + + return path; +} +#else +# define path_truncate(path) (path) +#endif + + /* Functions for normal input path search */ @@ -186,7 +227,7 @@ 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 = strncpy (xmalloc (mem + max_suffix_len +1), filename, mem); + filepath = path_truncate (strncpy (xmalloc (mem + max_suffix_len +1), filename, mem)); for (i = 0; suffixes && suffixes[i]; ++i) { strcpy (filepath + mem, suffixes[i]); @@ -227,7 +268,7 @@ m4_path_search (m4 *context, const char *filename, const char **suffixes) /* Capture errno only when searching `.'. */ e = errno; - filepath = strncpy (xmalloc (mem + max_suffix_len +1), pathname, mem); + filepath = path_truncate (strncpy (xmalloc (mem + max_suffix_len +1), pathname, mem)); free (pathname); for (i = 0; suffixes && suffixes[i]; ++i) hooks/post-receive -- GNU M4 source repository
