On Linux x86_64, there appears to have been a change in FileExists() between FPC 3.0.4 and 3.2.0. This has broken some delicate code (resulting in indelicate language after a long debugging session) which walked the /sys/devices tree trying to determine properties of a serial port... I've not found any way other than brute force to determine things like hardware and driver name since different drivers (kernel modules) store this information differently.
This is the content of the relevant directory:
/sys/devices/pci0000:00/0000:00:1d.2/usb4/4-2/4-2:1.0/ttyUSB0# ls -l
total 0
lrwxrwxrwx 1 root root 0 Jan 24 10:23 driver -> ../../../../../../../bus/usb-serial/drivers/cp210x
-r--r--r-- 1 root root 4096 Jan 24 10:23 port_number
drwxr-xr-x 2 root root 0 Jan 24 10:24 power
lrwxrwxrwx 1 root root 0 Jan 24 10:23 subsystem -> ../../../../../../../bus/usb-serial
drwxr-xr-x 3 root root 0 Jan 24 10:23 tty
-rw-r--r-- 1 root root 4096 Jan 24 10:23 uevent
This is the relevant code fragment:
DebugWriteF('Test existence "%s" "%s" / "%s"\n', [dir, candidate, content]);
if FileExists(dir + candidate + '/' + content) then begin
DebugWriteF('Test predicate "%s" "%s" "%s" "%s"\n', [dir, candidate, content, extra]);
if wtp2(dir, candidate, content, extra, hint) then
exit(dir + candidate + '/')
end
Code compiled with 3.0.4 gives me this output:
Testing against driver name usb-serial/drivers/cp210x
Test existence "/sys/devices/pci0000:00/0000:00:1d.2/usb4/4-2/4-2:1.0/" "ttyUSB0" / "driver"
Test predicate "/sys/devices/pci0000:00/0000:00:1d.2/usb4/4-2/4-2:1.0/" "ttyUSB0" "driver" "usb-serial/drivers/cp210x"
...
Code compiled with 3.2.0 gives me this output:
Testing against driver name usb-serial/drivers/cp210x
Test existence "/sys/devices/pci0000:00/0000:00:1d.2/usb4/4-2/4-2:1.0/" "ttyUSB0" / "driver"
...
Before I dig in again myself, what is FileExists() objecting to here: the fact that it's looking at a symlink, the fact that it's looking at a symlinked directory, or the fact that it's looking at a directory?
Is this an intentional change, i.e. which will persist in later versions of the compiler, or a regression which I can avoid by telling people not to use that specific version of compiler?
MarkMLl