Skip to content

Commit

Permalink
Make sure to only read existing files (#63)
Browse files Browse the repository at this point in the history
In particular don't use ReadPackage on paths that may not even be there
  • Loading branch information
fingolfin committed Jul 4, 2024
1 parent 6e49019 commit 7f4666b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
This file describes changes in the smallgrp package.

# 1.5.4 (2024-MM-DD)

- Don't attempt to load non-existent source files (this was
harmless so far as it failed silently, but in future GAP
versions may result in a scary warning or even an error)

# 1.5.3 (2023-05-16)

- Fix `SmallGroupsAvailable(p^7)` to return `false` when p > 11
Expand Down
13 changes: 11 additions & 2 deletions read.g
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,17 @@ READ_SMALL_LIB := function()
local i, s, LoadFunc;

LoadFunc := path ->
{args...} ->
ReadPackage("smallgrp", Concatenation(path, "/", args[1]));
function(args...)
local relpath, filename;
relpath := Concatenation(path, "/", args[1]);
filename:= Filename( DirectoriesPackageLibrary( "smallgrp", "" ), relpath );
if filename <> fail and IsReadableFile( filename ) then
Read( filename );
return true;
else
return false;
fi;
end;
s := 1;
repeat
s := s + 1;
Expand Down

0 comments on commit 7f4666b

Please sign in to comment.