LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Heiko Oberdiek <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Wed, 21 Apr 2021 19:41:59 +0200
Content-Type:
text/plain
Parts/Attachments:
text/plain (36 lines)
Hello,

On 2021-04-21 17:51, Bruno Le Floch wrote:
> On 4/20/21 12:36 PM, Joseph Wright wrote:
>> I don't think I've ever seen a test of what happens if \pdffilesize is used on a
>> truly massive file.
>>
> 
> In an interactive session, with test.dat around 8GB, I get
> 
> *\message{\pdffilesize{test.dat}}
> 7733552500
> *\count0=\pdffilesize{test.dat}\relax
> ! Number too big.
> <inserted text> 7733552500
> 
> <*> \count0=\pdffilesize{test.dat}
>                                    \relax
> ?

This is the expected behavior. TeX's count registers only accept values
from -2^{31} - 1 (-2147483647) to 2^{31} - 1 (2147483647) inclusively.
Therefore, \pdfilesize is not implemented as TeX number, but as text
string with the usual category codes as the output of the TeX primitives
\number or \string.

The file size is retrieved via the usual `stat' system call.
If the binary is compiled for a 32-bit platform without explicit
support for larger file sizes (-D_FILE_OFFSET_BITS=64), the maximum
file size is also restricted to 2^{31}-1 (see the stat(2) manual page).
If the stat system call fails for some reason (ENOENT, EOVERFLOW, ...),
\pdffilesize returns the empty string.

Yours sincerely
   Heiko

ATOM RSS1 RSS2