[tex-live] Whitespace in file name with all but plain TeX fails

Olaf Weber olaf at infovore.xs4all.nl
Tue Oct 11 18:39:24 CEST 2005


Martin Schröder writes:
> On 2005-10-11 07:01:53 +0900, Akira Kakuto wrote:

>>> Indeed, I confirm that 
>>>   pdfetex 'v er.tex'
>>> works in TL 2004 and fails with the current TL pdfetex (both
>>> i386-linux).  The error message is: 
>>> 
>>> ! I can't find file `"v er.tex"'.

>> On Windows, pdfetex "v er.tex" is OK.
>> Please check
>> char *makecfilename(strnumber s) in utils.c,
>> where I find #ifdef WIN32.

> Is this by chance bug #377 again? :-(

> Best
>     Martin

> PS: Followup -> ntg-pdftex

	In pdftex.ch:

@x 11447
@d append_to_name(#)==begin c:=#; if not (c="""") then begin incr(k);
  if k<=file_name_size then name_of_file[k]:=xchr[c];
  end end
@y
@d append_to_name(#)==begin c:=#; if not (c="""") or not is_quote_bad
  then begin incr(k);
  if k<=file_name_size then name_of_file[k]:=xchr[c];
  end end
@z

	In utils.c:

boolean isquotebad() {
#ifdef WIN32
    return true;
#else
    return false;
#endif
}


On non-WIN32 this means that append_to_name effectively becomes

   begin
      c:=#;
      if true then begin
         incr(k);
         if k<=file_name_size then name_of_file[k]:=xchr[c];
      end
   end

So the quotes aren't stripped from quoted filenames, and the file
becomes unfindable as a result.


Try the following diff:

Index: pdftexdir/pdfstrcmp.ch
===================================================================
RCS file: /usr/local/cvsroot/texk/texk/web2c/pdftexdir/pdfstrcmp.ch,v
retrieving revision 1.1
diff -u -r1.1 pdfstrcmp.ch
--- pdftexdir/pdfstrcmp.ch	27 Jul 2005 08:17:45 -0000	1.1
+++ pdftexdir/pdfstrcmp.ch	11 Oct 2005 16:34:49 -0000
@@ -442,17 +442,6 @@
 job_name_code: print(job_name);
 @z
 
- at x 11447
- at d append_to_name(#)==begin c:=#; if not (c="""") then begin incr(k);
-  if k<=file_name_size then name_of_file[k]:=xchr[c];
-  end end
- at y
- at d append_to_name(#)==begin c:=#; if not (c="""") or not is_quote_bad
-  then begin incr(k);
-  if k<=file_name_size then name_of_file[k]:=xchr[c];
-  end end
- at z
-
 %***********************************************************************
 
 @x 32168
Index: pdftexdir/pdftex.ch
===================================================================
RCS file: /usr/local/cvsroot/texk/texk/web2c/pdftexdir/pdftex.ch,v
retrieving revision 1.17
diff -u -r1.17 pdftex.ch
--- pdftexdir/pdftex.ch	10 Sep 2005 08:43:42 -0000	1.17
+++ pdftexdir/pdftex.ch	11 Oct 2005 16:37:00 -0000
@@ -3988,7 +3988,7 @@
     @<Output the |obj_tab|@>;
     @<Output the trailer@>;
     pdf_flush;
-    print_nl("Output written on "); slow_print(output_file_name);
+    print_nl("Output written on "); print_file_name(0, output_file_name, 0);
   @.Output written on x@>
     print(" ("); print_int(total_pages); print(" page");
     if total_pages<>1 then print_char("s");
Index: pdftexdir/utils.c
===================================================================
RCS file: /usr/local/cvsroot/texk/texk/web2c/pdftexdir/utils.c,v
retrieving revision 1.5
diff -u -r1.5 utils.c
--- pdftexdir/utils.c	3 Aug 2005 08:43:39 -0000	1.5
+++ pdftexdir/utils.c	11 Oct 2005 16:33:51 -0000
@@ -1111,32 +1111,19 @@
 /* makecfilename
   input/ouput same as makecstring:
     input: string number
-    output: C string (buffer address that contains the string)
-  WIN32: quotes are removed.
+    output: C string with quotes removed.
 */
 char *makecfilename(strnumber s) {
     char *name = makecstring(s);
-#ifdef WIN32
-    /* unquote file name */
-    if (*name == '"') {
-        char *p = name;
-        char *q = name;
-        while (p && *p) {
-            *q = (*p == '"' ? *(++p) : *p);
-            p++, q++;
-        }
-        *q = '\0';
+    char *p = name;
+    char *q = name;
+
+    while (*p) {
+        if (*p != '"')
+            *q++ = *p;
+        p++;
     }
+    *q = '\0';
     fprintf(stderr, " %s\n", name);
-#endif
     return name;
 }
-
-
-boolean isquotebad() {
-#ifdef WIN32
-    return true;
-#else
-    return false;
-#endif
-}



-- 
Olaf Weber

               (This space left blank for technical reasons.)



More information about the tex-live mailing list