Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions test/blackbox-tests/test-cases/dune
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
(applies_to windows-diff github6644)
(alias runtest-windows))

(cram
(applies_to windows-artifacts-duplicate-install)
(alias runtest-windows)
(enabled_if
(= %{os_type} "Win32")))

;; DISABLED TESTS

(subdir
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Reproduction case for Windows artifacts duplicate key crash
https://github.com/ocaml/dune/issues/12535

When an install stanza contains both `name.exe` and `name` (e.g., the
executable and a wrapper script), The Windows handling in Dune strips the
`.exe` suffix in artifacts.ml, causing both to become "name", leading to
duplicate keys in the artifacts map.

$ cat > dune-project <<EOF
> (lang dune 3.21)
> (package
> (name myapp))
> EOF

$ cat > dune <<EOF
> (executable
> (name myapp)
> (public_name myapp))
>
> (install
> (section bin)
> (files
> myapp.exe
> myapp))
> EOF

$ cat > myapp.ml <<EOF
> let () = print_endline "Hello from myapp"
> EOF

Wrapper script:
$ cat > myapp <<'EOF'
> #!/bin/sh
> exec $(dirname $0)/myapp.exe "$@"
> EOF
$ chmod +x myapp

On Windows, this should not crash with duplicate "myapp" keys.

$ dune build myapp.install 2>&1 | grep "Internal"
Internal error, please report upstream including the contents of _build/log.

Loading