Skip to content

Commit

Permalink
Merge pull request chapel-lang#16342 from ben-albrecht/workaround-tom…
Browse files Browse the repository at this point in the history
…l-error

Work-around TOML bug in mason and add a future for bug

TOML module produces a seg fault when parsing a file containing only a comment on linux32 / valgrind configs.\

This was exposed when `mason search` started adding a cache file containing only a comment if a cache
file did not exist (chapel-lang#16223). 

In this PR, we work around this bug by creating an empty cache file instead.

Also:

- added the `cache.toml` to CLEANFILES to prevent previous runs from interfering with each other in local testing
- added a future for the TOML bug - to be debugged in the future.

[Reviewed by @ronawho]
  • Loading branch information
ben-albrecht authored Sep 4, 2020
2 parents 161406f + fa541af commit e41d4a5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
11 changes: 11 additions & 0 deletions test/library/packages/TOML/test/commentOnly.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use TOML;

config const str: string = """# Comment""";

proc main() {
var TomlData = parseToml(str);
writeln(TomlData);
delete TomlData;
}


2 changes: 2 additions & 0 deletions test/library/packages/TOML/test/commentOnly.future
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bug: TOML containing only comments produces memory errors (caught in valgrind)

Empty file.
1 change: 1 addition & 0 deletions test/mason/search/badFileName/CLEANFILES
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mason_home/mason-registry/Bricks/cache.toml
3 changes: 1 addition & 2 deletions tools/mason/MasonSearch.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ proc rankResults(results: list(string), query: string): [] string {
/* Creates an empty cache file if its not found in registry */
proc touch(pathToReg: string) {
const fileWriter = open(pathToReg, iomode.cw).writer();
const contents = "# This cache file was created automatically by mason search";
fileWriter.write(contents);
fileWriter.write("");
fileWriter.close();
}

Expand Down

0 comments on commit e41d4a5

Please sign in to comment.