texlive[62365] Build/source/texk/web2c/lib: texmfmp.c: convert the

commits+hironobu at tug.org commits+hironobu at tug.org
Thu Mar 3 13:03:17 CET 2022


Revision: 62365
          http://tug.org/svn/texlive?view=revision&revision=62365
Author:   hironobu
Date:     2022-03-03 13:03:16 +0100 (Thu, 03 Mar 2022)
Log Message:
-----------
texmfmp.c: convert the argument of runpopen to utf8 for pTeX (H. Kitagawa)

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/lib/ChangeLog
    trunk/Build/source/texk/web2c/lib/texmfmp.c

Modified: trunk/Build/source/texk/web2c/lib/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/lib/ChangeLog	2022-03-03 11:43:31 UTC (rev 62364)
+++ trunk/Build/source/texk/web2c/lib/ChangeLog	2022-03-03 12:03:16 UTC (rev 62365)
@@ -1,8 +1,14 @@
+2022-03-03  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
+
+	* texmfmp.c: Convert the argument of runpopen to utf8 for pTeX.
+	  https://github.com/texjporg/tex-jp-build/issues/81
+
 2022-01-22  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
 
 	* openclose.c (open_input): Reencode nameoffile to utf8 for pTeX.
 	* texmfmp.c: Change type of str_pool to unsigned short for pTeX.
 	  We use only 0--511, and use flag 0x100 for Japanese char.
+	  https://github.com/texjporg/tex-jp-build/issues/81
 
 2022-01-01  Akira Kakuto  <kakuto at jcom.zaq.ne.jp>
 

Modified: trunk/Build/source/texk/web2c/lib/texmfmp.c
===================================================================
--- trunk/Build/source/texk/web2c/lib/texmfmp.c	2022-03-03 11:43:31 UTC (rev 62364)
+++ trunk/Build/source/texk/web2c/lib/texmfmp.c	2022-03-03 12:03:16 UTC (rev 62365)
@@ -667,6 +667,9 @@
   char *safecmd = NULL;
   char *cmdname = NULL;
   int allow;
+#if IS_pTeX && !defined(WIN32)
+  char *cmd2 = NULL;
+#endif
 
 #ifdef WIN32
   char *pp;
@@ -676,14 +679,27 @@
   }
 #endif
 
+#if IS_pTeX && !defined(WIN32)
+  cmd2 = (char *)ptenc_from_internal_enc_string_to_utf8((unsigned char *)cmd);
+  if (!cmd2) cmd2=(char *)cmd;
+#endif
+
   /* If restrictedshell == 0, any command is allowed. */
   if (restrictedshell == 0)
     allow = 1;
   else
+#if IS_pTeX && !defined(WIN32)
+    allow = shell_cmd_is_allowed (cmd2, &safecmd, &cmdname);
+#else
     allow = shell_cmd_is_allowed (cmd, &safecmd, &cmdname);
+#endif
 
   if (allow == 1)
+#if IS_pTeX && !defined(WIN32)
+    f = popen (cmd2, mode);
+#else
     f = popen (cmd, mode);
+#endif
   else if (allow == 2)
     f = popen (safecmd, mode);
   else if (allow == -1)
@@ -692,6 +708,9 @@
   else
     fprintf (stderr, "\nrunpopen command not allowed: %s\n", cmdname);
 
+#if IS_pTeX && !defined(WIN32)
+  if (cmd!=cmd2) free(cmd2);
+#endif
   if (safecmd)
     free (safecmd);
   if (cmdname)



More information about the tex-live-commits mailing list.