Skip to content

dune install with root permission should not create files in the build directory #3857

@kit-ty-kate

Description

@kit-ty-kate

Expected Behavior

Calling sudo dune install then dune build or dune clean (without sudo) should not fail.

Actual Behavior

Calling dune install with sudo creates a build state which is not usable anymore for the regular user.

Reproduction

$ mkdir /tmp/test && cd /tmp/test
$ echo '(executable (public_name test))' > dune
$ touch test.ml test.opam
$ dune build @install
$ sudo $(which dune) install --prefix /tmp/test
$ dune clean
Error: unlink: _build/default/.dune/configurator.v2: Permission denied
$ dune build
Error: unlink: _build/default/.dune/configurator.v2: Permission denied

Specifications

  • Version of dune (output of dune --version): 2.7.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions