Skip to content

CACHEDIR.TAG not created for target directory with cargo package or cargo publish #16238

@ehuss

Description

@ehuss

Problem

The target directory is not excluded from backups when created with cargo package or cargo publish.

Steps

  1. cargo new foo
  2. cd foo
  3. cargo package --allow-dirty
  4. ls -al target

Possible Solution(s)

There's probably a call to create_dir_all somewhere that is creating the target/package directory without using the normal "create target dir" logic that excludes it from backups.

Notes

No response

Version

cargo 1.93.0-nightly (445fe4a68 2025-11-07)
release: 1.93.0-nightly
commit-hash: 445fe4a68f469bf936b2fd81de2c503b233a7f4f
commit-date: 2025-11-07
host: aarch64-apple-darwin
libgit2: 1.9.1 (sys:0.20.2 vendored)
libcurl: 8.7.1 (sys:0.4.83+curl-8.15.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 3.5.4 30 Sep 2025
os: Mac OS 15.6.1 [64-bit]

Metadata

Metadata

Assignees

Labels

C-bugCategory: bugCommand-packageCommand-publishS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions