Skip to content

minimal-crates: shorten the target dir path length to avoid os error 206 - #11

Merged
ramfox merged 1 commit into
mainfrom
fix/windows-min-crates-target-dir
Nov 21, 2026
Merged

ramfox merged 1 commit into
mainfrom
fix/windows-min-crates-target-dir

Conversation

@ramfox

@ramfox ramfox commented Nov 20, 2026

Copy link
Copy Markdown
Member

Nightly cargo calls rustc w/ the -L flag, explicitly listing the target path of each dependency. With all of those directory paths listed, rustc's command line call can drive the length of the command over Windows' 32,767 character limit.

Building in the runner's temp dir keeps it shorter, and the runner cleans it up after each job.

Nightly cargo calls rustc w/ the -L flag, explicitly listing the target path of each dependency.  With all of those directory paths listed, rustc's command line call can push the length of the command over Windows' 32,767 character limit.

Building in the runner's temp dir keeps it shorter, and the runner cleans it up after each job.
@ramfox
ramfox requested review from Arqu and flub November 20, 2026 19:13
@ramfox ramfox changed the title minimal-crates: shorten the Windows target dir to avoid os error 206 minimal-crates: shorten the target dir path length to avoid os error 206 Nov 20, 2026
@n0bot n0bot Bot added this to iroh Nov 20, 2026
@github-project-automation github-project-automation Bot moved this to 🚑 Needs Triage in iroh Nov 20, 2026
@ramfox
ramfox merged commit 85c53c5 into main Nov 21, 2026
2 checks passed
@ramfox
ramfox deleted the fix/windows-min-crates-target-dir branch November 21, 2026 00:18
@github-project-automation github-project-automation Bot moved this from 🚑 Needs Triage to ✅ Done in iroh Nov 21, 2026
@flub

flub commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

you're aware you need to update the tags for this to take effect:

  • add v2.0.1 pointing to new head commit
  • move v2 pointing to new head commit

@flub

flub commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

?

Arqu added a commit that referenced this pull request Nov 26, 2026
#13)

## Description

A caller that patches in a private GitHub repository cannot run
`minimal-crates.yaml`. The workflow takes no secrets, and the caller's
`env` does not reach a called workflow, so cargo fetches the repository
without credentials and fails:

```
fatal: could not read Username for 'https://github.com': No such file or directory
error: failed to load source for dependency `noq`
```

This PR:

- Adds an optional `GIT_TOKEN` secret to `minimal-crates.yaml`.
- Sets the token in the workflow-level `env`, so every job uses it. With
`GIT_TOKEN`, git rewrites `https://github.com/` to carry the token
(`GIT_CONFIG_*` env vars). Cargo fetches with the git CLI so that the
rewrite applies.
- Resets `credential.helper` to empty. With credentials in the URL, git
gives them to the credential helpers to store after each successful
fetch. On macOS, Homebrew git's `osxkeychain` helper blocks during
`actions/checkout`, which runs with a temporary `HOME`, and the job
hangs.
- Without `GIT_TOKEN`, `GIT_CONFIG_COUNT` is `0` and no URL changes. The
only change for current callers is that cargo fetches git dependencies
with the git CLI.
- Documents in the README that every shared workflow takes `GIT_TOKEN`.
A new shared workflow, such as `cargo-deny.yaml` in #12, must take it
too.

Usage:

```yaml
  min-crates:
    uses: "n0-computer/workflows/.github/workflows/minimal-crates.yaml@v2"
    secrets:
      GIT_TOKEN: ${{ secrets.MY_PRIVATE_REPO_TOKEN }}
```

## Testing

- With git and the same `GIT_CONFIG_*` values, with global config off
and a system config whose `credential.helper` blocks (like Homebrew's
`osxkeychain`):
- A private repository, a public repository and the `actions/checkout`
case (its `extraheader` plus the token in the URL) each fetch in about 1
s. Git does not call the helper.
- Without the `credential.helper` reset, git calls the helper's `store`
after each fetch and hangs. This matches the macOS hang in CI.
- `zizmor --offline .`: no findings.
- `actionlint`: same findings as on `main` (runner labels, `$/` action
refs, the Windows `cargo check` step). None comes from this change.
- A private caller with a private git dependency ran this workflow in
CI. Before the `credential.helper` reset, Ubuntu and Windows passed and
macOS hung in `actions/checkout`. At 507db95, Ubuntu, macOS and Windows
pass.

## Release

After merge: tag `v2.0.1` and move `v2`. `v2` does not have #11 yet, so
this release also ships the Windows target dir fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants