Skip to content

dune pkg lock doesn't respect dune-workspace's lock_dir stanza #13841

@shunueda

Description

@shunueda

Expected Behavior

When (lock_dir (path ...)) is configured in dune-workspace, running dune pkg lock without arguments should create/update the lock directory at the path specified in the stanza, as per the documentation:

The location in the source tree where the lock directory will be created or read from. If not specified defaults to dune.lock.

Actual Behavior

dune pkg lock ignores the configured lock_dir stanza's path and always creates the lock at dune.lock. The custom path is only used when explicitly passed as an argument: dune pkg lock foo.

This is where the potential bug is: pkg_common.ml#L189 - for example assuming (lock_dir (path foo)):

  1. dune pkg lock (with no argument) defaults to default_path (= dune.lock), completely ignoring the lock_dir stanza.
  2. dune pkg lock foo works as intended as creates the locks in foo, and
  3. dune pkg lock bar results in:
$ dune pkg lock bar
Error: The following directories are not lock directories in this workspace:
- bar
This workspace contains the following lock directories:
- dune.lock
- foo

Happy to submit a patch, but is this an expected behavior?

Specifications

  • dune@3.21.1
  • aarch64-darwin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions