\pdffilesize and spaces

Joseph Wright joseph.wright at morningstar2.co.uk
Sat Oct 19 00:02:25 CEST 2019

On 18/10/2019 22:46, Joseph Wright wrote:
> On 18/10/2019 22:26, Karl Berry wrote:
>>      \edef\test{\pdffilesize{file_1.tex }}\show\test
>>      \edef\test{\pdffilesize{"file_1.tex "}}\show\test
>>
>> Fixes are welcome (sorry, I didn't see the reason in pdf_file_size_code:
>> and show_token_list offhand), but (I doubt any of the following is news
>> to you) ... I think there is no way to use \pdffilesize etc. on
>> arbitrary filenames. Maybe they can be made to work with one space, but
>> 2+ consecutive spaces in the input will get transmuted into one by TeX's
>> scanner before the primitive over sees it, if I understand
>> correctly. Catcode 9 characters will likewise disappear, etc., etc.
>
> Sure: I'm thinking of the detokenized name, after TeX has done 'stuff'.
> I'll see if I can work out where the issue is: I have a feeling it's not
> in the WEB but in the C ...

In particular, in texmfmp.c:

string
find_input_file(integer s)
{
string filename;

#if defined(XeTeX)
filename = gettexstring(s);
#else
filename = makecfilename(s);
#endif

which means that XeTeX gives a different result to pdfTeX ... (at least
for my simple test, XeTeX is 'correct', but I've no ideas why the
difference in path here).

Joseph