Skip to content
This repository was archived by the owner on May 14, 2026. It is now read-only.
This repository was archived by the owner on May 14, 2026. It is now read-only.

fix(config,network): resolve cafile relative paths against .npmrc dir, not process cwd #498

@zkochan

Description

@zkochan

Background

#490 landed cafile=<path> handling. The current implementation reads the file via std::fs::read_to_string(path), which resolves relative paths against the process cwd. This matches pnpm's behavior exactly — pnpm's loadCAFile also passes the path straight to fs.readFileSync without path.resolve, and pnpm doesn't process.chdir(opts.dir) on --dir.

The result: with pacquet --dir /project install from /home/user, a project .npmrc containing cafile=certs/ca.pem reads /home/user/certs/ca.pem instead of /project/certs/ca.pem, silently dropping the CA list when it isn't found. Surprising and footgun-y for --dir invocations.

Documented as a parity quirk in crates/config/src/npmrc_auth.rs:load_cafile (see the long comment at SHA 55083a4).

What to do

This is upstream's quirk — pacquet matches pnpm bug-for-bug per AGENTS.md's cardinal rule. The correct sequence:

  1. File an issue against pnpm/pnpm describing the problem (cafile relative paths surprise users with --dir).
  2. If upstream accepts and lands a fix (most likely: resolve cafile against the directory the .npmrc was read from), port the change into pacquet's load_cafile.
  3. Drop the parity-quirk paragraph from the load_cafile doc comment.

Alternatively, if upstream rejects (e.g. "we don't want to change long-standing behavior"), keep pacquet matching but consider documenting the quirk in the user-facing docs (the pnpm.io cli page if pacquet documents there) and the workarounds (absolute path, cd first, or use inline ca=).

Out of scope

  • Diverging from pnpm without an upstream fix landing first. AGENTS.md is explicit: "Do not 'fix' pnpm quirks unless the same fix has landed upstream."

References


Written by an agent (Claude Code, claude-opus-4-7).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions