tebe6502 / Mad-Pascal

Mad Pascal Compiler for 6502 (Atari XE/XL, C64, C4Plus, Neo6502)
122 stars 20 forks source link

The compiller requires write access to library files for compilation (?) #117

Closed t-w closed 1 year ago

t-w commented 1 year ago

I have built the compiler (1.6.6) on Linux (using FreePascal) and manually installed it system-wide (somewhere in /opt/...). Initially it was working - but then I changed file permissions so that a regular user cannot access the compiler/library files for writing (precisely - I changed the file ownership from a regular user to root/admin - as it should be on a regular multiuser system) - and the compilations started failing, with rather strange errors, from:

/opt/retro/madpascal/lib/crt.pas (1,10) Error: Syntax error, '.' expected but 'unknown token' found

or

/opt/retro/madpascal/lib/types.pas (446,5) Error: Syntax error, '.' expected but 'END' found

to errors with "Access violation" (like the one in #112).

Using strace revealed (it doesn't matter if it is for C64 or Atari):

$ strace -o /tmp/output2 mp -t c64 a_test0.pas -ipath:/opt/retro/madpascal/lib

[...]

$ less /tmp/output2
[...]
access("/opt/retro/madpascal/lib/crt.pas", F_OK) = 0
stat("/opt/retro/madpascal/lib/crt.pas", {st_mode=S_IFREG|0644, st_size=3929, ...}) = 0
access("/opt/retro/madpascal/lib/crt.pas", F_OK) = 0
stat("/opt/retro/madpascal/lib/crt.pas", {st_mode=S_IFREG|0644, st_size=3929, ...}) = 0
access("/opt/retro/madpascal/lib/crt.pas", F_OK) = 0
stat("/opt/retro/madpascal/lib/crt.pas", {st_mode=S_IFREG|0644, st_size=3929, ...}) = 0
open("/opt/retro/madpascal/lib/crt.pas", O_RDWR|O_LARGEFILE) = -1 EACCES (Permission denied)

so the compiler indeed tries to open a library source (unit) for writing during compilation, and the compilation fails if it cannot...

A rather strange, not very safe behaviour, it would be good if it was corrected.

tebe6502 commented 1 year ago

Compiler does not require write access to library files to compile

try 1.6.8

t-w commented 1 year ago

Yes, it still does. Fix above.