GaloisInc / saw-script

The SAW scripting language.
BSD 3-Clause "New" or "Revised" License
442 stars 63 forks source link

saw inappropriately expands symbolic links #2082

Open sauclovian-g opened 3 months ago

sauclovian-g commented 3 months ago
% bin/saw test.saw 
[00:18:44.386] Loading file ".../saw-script/test.saw"
[00:18:44.387] .../saw-script/test.saw:4:21-4:28: Type mismatch.
   :

Well and good. But now,

% ln -s test.saw other.saw
% bin/saw other.saw       
[00:19:06.439] Loading file ".../saw-script/test.saw"
[00:19:06.440] .../saw-script/test.saw:4:21-4:28: Type mismatch.

Notice that it has expanded the symbolic link other.saw and this causes it to report errors with the name of the link target rather than the filename I gave it. Experimentation shows that if the path to other.saw includes symbolic links to directories, it expands those as well.

This is generally not what you want -- in almost all cases you want tools to use and report the filenames you give them and not try to reinterpret them. Doing so can in some cases lead to confusion (particularly, but not only, if there are automounters involved) and it can also create testing and debugging headaches. (For example: if you check out and build two different versions of saw in different trees, now you can't compare the output from test runs.)