Skip to content

cargo build fails when ~/.cargo/credentials is unreadable #7624

@RalfJung

Description

@RalfJung

Problem

When running cargo inside a sandbox that rejects access to ~/.cargo/credentials, cargo build fails. I prefer to run VScode in a sandbox and not give it access to confidential files such as ~/.cargo/credentials. cargo build really shouldn't need access to my credentials, so this seems like it should be avoidable.

Steps

  1. Change permissions such that ~/.cargo/credentials is unreadable
  2. Do some cargo action that does not require credentials
  3. You get: error: Permission denied (os error 13)

The error message is quite bad as it doesn't even say which file is affected! I had to use strace to determine that (which was hard because strace is blocked in the sandbox...)

EDIT: Error message fixed via #7649.

Possible Solution(s)

Only read credentials when needed, i.e., in cargo publish.

Notes

Output of cargo version:

cargo 1.41.0-nightly (8280633db 2019-11-11)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-configurationArea: cargo config files and env varsC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions