]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
intl: Fix that /@unixroot prefix is not working on OS/2 kLIBC
authorKO Myung-Hun <komh78-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Thu, 1 Dec 2016 09:19:56 +0000 (18:19 +0900)
committerDaiki Ueno <ueno@gnu.org>
Mon, 5 Dec 2016 08:51:52 +0000 (09:51 +0100)
OS/2 kLIBC has a feature to rewrite some path components. For example,
'/@unixroot' is replaced with a value of $UNIXROOT if it is.

So prepending a drive letter to the path starting with '/' makes the
path starting with '/@unixroot' to 'x:/@unixroot' which is unexpected.

This will breaks the behavior of some programs depending on /@unixroot
prefix.

* gettext-runtime/intl/bindtextdom.c (BINDTEXTDOMAIN): Do not touch
dirname if it is started with '/@unixroot'.
* gettext-runtime/intl/relocatable.c (relocate): Do not touch pathname
if it is started with '/@unixroot'.

gettext-runtime/intl/bindtextdom.c
gettext-runtime/intl/relocatable.c

index bd82f1a1fa9ded86feac377109aa5030bcda1015..f80da30eaa4e2acc4f8d73836c1e10d6fb86138d 100644 (file)
@@ -321,6 +321,12 @@ BINDTEXTDOMAIN (const char *domainname, const char *dirname)
   const char *saved_dirname = dirname;
   char dirname_with_drive[_MAX_PATH];
 
+# ifdef __KLIBC__
+  if (dirname && strncmp (dirname, "/@unixroot", 10) == 0
+      && (dirname[10] == '\0' || dirname[10] == '/' || dirname[10] == '\\'))
+    /* kLIBC itself processes /@unixroot prefix */;
+  else
+# endif
   /* Resolve UNIXROOT into dirname if it is not resolved by os2compat.[ch]. */
   if (dirname && (dirname[0] == '/' || dirname[0] == '\\' ))
     {
index 60cb54ac7e17c2a1dd58dcab72b27402623fe2a8..401f3e0e45dbe57b62f0fb88a0cc9bf1b9024543 100644 (file)
@@ -539,6 +539,18 @@ relocate (const char *pathname)
     }
 
 #ifdef __EMX__
+# ifdef __KLIBC__
+#  undef strncmp
+
+  if (pathname && strncmp (pathname, "/@unixroot", 10) == 0
+      && (pathname[10] == '\0' || pathname[10] == '/' || pathname[10] == '\\'))
+    {
+      /* kLIBC itself processes /@unixroot prefix */
+
+      return pathname;
+    }
+  else
+# endif
   if (pathname && ISSLASH (pathname[0]))
     {
       const char *unixroot = getenv ("UNIXROOT");