-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: add repro for #9538 (subst on 32-bit) (#9539) Signed-off-by: Etienne Millon <[email protected]> * refactor: detect large files in Io functions (#9828) `Io.read_all` and related functions read the contents of a file in a string, which has a size limit (`Sys.max_string_length`) and can be an issue in 32-bit systems. This makes an explicit check and raises a `Code_error` in these situations. Signed-off-by: Etienne Millon <[email protected]> * fix(subst): ignore large files (#9811) Fixes #9538 This logs a warning for large files (>16MB on 32-bit systems). Signed-off-by: Etienne Millon <[email protected]> --------- Signed-off-by: Etienne Millon <[email protected]>
- Loading branch information
Showing
7 changed files
with
89 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- subst: do not fail on 32-bit systems when large files are encountered. Just log a warning in this case. (#9811, fixes #9538, @emillon) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
When dune subst is called on a file larger than 16MiB, it should not crash. | ||
See #9538. | ||
|
||
$ cat > create.ml << EOF | ||
> let () = Unix.truncate "large.dat" 0x1_00_00_00 | ||
> EOF | ||
$ touch large.dat | ||
$ ocaml unix.cma create.ml | ||
$ rm create.ml | ||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 1.0) | ||
> (name project) | ||
> (package | ||
> (name project)) | ||
> EOF | ||
|
||
This test uses subst, which needs a git repository: | ||
|
||
$ git init | ||
Initialized empty Git repository in $TESTCASE_ROOT/.git/ | ||
$ git add dune-project | ||
$ git add large.dat | ||
$ git commit -m create | tail -n 3 | ||
2 files changed, 4 insertions(+) | ||
create mode 100644 dune-project | ||
create mode 100644 large.dat | ||
|
||
$ dune subst | ||
Warning: Ignoring large file: large.dat | ||
Hint: Dune has been built as a 32-bit binary so the maximum size "dune subst" | ||
can operate on is 16MiB. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(cram | ||
(applies_to 32bit) | ||
(enabled_if | ||
(not %{arch_sixtyfour})) | ||
(deps %{bin:git})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters