cc_wrapper crashes with ValueError on Windows when a path is on another drive

Open Beginner friendly
#2,492 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@TrapsterDK is already working on this.

Since Nov 18, 2026.

  • #2493 by @TrapsterDK — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
79/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start by reading shorten_path in haskell/private/cc_wrapper.py.tpl and check how it handles paths on different Windows drives. The issue identifies the failure and the expected behavior: when os.path.relpath raises ValueError, retain the original path. Done means the wrapper no longer aborts for cross-drive paths; run the relevant cc_wrapper tests or reproduce with paths on separate drives.

Written by the indexing model from the issue text.

Description

On Windows, os.path.relpath raises ValueError: path is on mount 'D:', start on mount 'C:' when the path and the current working directory are on different drives. shorten_path in haskell/private/cc_wrapper.py.tpl calls it without a guard, so the C compiler wrapper aborts instead of linking or compiling.

To reproduce: build a Haskell target on Windows where the execroot or an include or library directory is on a different drive than the action's working directory (for example the Bazel output base on D: and a toolchain or temp directory on C:). Any cc_wrapper call that passes such a path fails with the ValueError.

Fix: treat ValueError from os.path.relpath as 'cannot shorten' and keep the original path. A PR follows.

Assisted by Claude.

Dominant language
Starlark
Stars
279
Forks
94
Avg merge
1d 12h
Merged PRs (30d)
10

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tweag/rules_haskell

All issues in tweag/rules_haskell

Similar issues

More Build System issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.