Skip to content

y2038 issue

While working on reproducible builds for openSUSE, I found that there is a year 2038 issue in fpc.

The reproducer is extracted from lazarus sources:

sudo date --set=2038-02-01
cat test1.pas
program test1;
BEGIN
  writeln('build date: '+{$I %date%});
END.

rm test1 link* ; fpc test1.pas && ./test1
rm: cannot remove 'link*': No such file or directory
Free Pascal Compiler version 3.2.2 [2023/10/09] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling test1.pas
Linking test1
4 lines compiled, 0.0 sec
build date: 1901/12/27

The 1901 date is a result of an overflow in a signed 32-bit int used for %date%. It probably should start using a 64-bit int there.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information