smatch icon indicating copy to clipboard operation
smatch copied to clipboard

Prevent Perl errors building DBs for generic projects

Open chrissamuel opened this issue 5 months ago • 0 comments

When running build_generic_data.sh I was getting errors like:

readline() on closed filehandle FILE at /path/to/smatch/smatch_scripts/../smatch_data/db/init_constraints.pl line 54.
readline() on closed filehandle FILE at /path/to/smatch/smatch_scripts/../smatch_data/db/init_constraints.pl line 61.
readline() on closed filehandle FILE at /path/to/smatch/smatch_scripts/../smatch_data/db/init_constraints_required.pl line 42.
off
off
readline() on closed filehandle FILE at /path/to/smatch/smatch_scripts/../smatch_data/db/insert_manual_states.pl line 68.

This is because the Perl scripts read from filehandles without checking if the open succeeded. These files don't exist for a new generic project so this commit changes the scripts to only try and read from them if their open() succeeds.

chrissamuel avatar Jul 04 '25 21:07 chrissamuel