Skip to content

Error messages spell file paths differently between runs when an import directory is added twice #1246

Closed

Description

@jsiek

When the same directory is on the import path under two spellings, error messages name files with whichever spelling the import-directory set happens to yield first. That order changes between processes, so the same command prints different paths.

Repro

deduce.py already adds the stdlib directory as an absolute path, and --dir lib adds it again as a relative path:

for seed in 1 2 3 4; do
  PYTHONHASHSEED=$seed python deduce.py --dir lib test/should-error/private_lemma_hint_stdlib.pf 2>&1 \
    | grep -o "in module Nat ([^)]*)"
done

Observed

in module Nat (lib/NatMult.pf:21)
in module Nat (lib/NatMult.pf:21)
in module Nat (/home/runner/deduce/lib/NatMult.pf:21)
in module Nat (/home/runner/deduce/lib/NatMult.pf:21)

Expected

The same output on every run. Either normalize import directories when adding them (flags.add_import_directory, e.g. resolve to one canonical form so duplicates collapse), or search them in a fixed order (flags.import_directories is a set[str]).

Where found

While comparing diagnostics for every test/should-validate and test/should-error file between processes for the prelude-snapshot work (#1217). Three files differed only in this path spelling, including between two runs that did not use a snapshot. The comparison script had added lib and the absolute lib/ path. CI doesn't add the same directory twice, so the .err fixtures stay stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions