Skip to content

cargo package: please provide a --list0 option to print NUL-terminated filenames #3306

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
joshtriplett opened this issue Nov 21, 2016 · 7 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-package S-propose-close Status: A team member has nominated this for closing, pending further input from the team

Comments

@joshtriplett
Copy link
Member

joshtriplett commented Nov 21, 2016

cargo package --list lists all the filenames the .crate file would include, followed by newlines. A crate could potentially include a file whose name includes a newline, such as for test data. Please consider providing a cargo package --list0 option to list filenames followed by NUL characters instead of newlines.

(After adding such an option, cargo package --list should probably fail with an error and no other output if any filename includes a newline, to catch errors.)

@alexcrichton
Copy link
Member

Sounds plausible to me!

@tbu-
Copy link
Contributor

tbu- commented Nov 21, 2016

Or we could disallow these characters. I haven't seen legitimate use cases for file names with newlines in them, @joshtriplett do you know any?

@joshtriplett
Copy link
Member Author

On November 21, 2016 2:59:03 PM PST, tbu- notifications@github.com wrote:

Or we could disallow these characters. I haven't seen legitimate use
cases for file names with newlines in them, @joshtriplett do you know
any?

Test cases; no other legitimate use that I can think of.

@carols10cents carols10cents added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-package labels Sep 29, 2017
@epage epage added the S-triage Status: This issue is waiting on initial triage. label Oct 11, 2023
@weihanglo weihanglo added S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-triage Status: This issue is waiting on initial triage. labels Dec 29, 2024
@weihanglo
Copy link
Member

weihanglo commented Dec 29, 2024

What should Cargo do for packaging a multi-package workspace for this list mode? Can JSON output (#11666) cover the use case of this?

@epage
Copy link
Contributor

epage commented Dec 30, 2024

FYI the issue for cargo package --workspace --list is #13953.

@weihanglo weihanglo added S-propose-close Status: A team member has nominated this for closing, pending further input from the team and removed S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. labels Mar 26, 2025
@weihanglo
Copy link
Member

We have a more solid solution now, a JSON output format for --list #15353, which also takes workspace into account. Unless there is a reason to have a new output format like nul-terminated, I propose to the team to close this in favor of #15353.

@epage
Copy link
Contributor

epage commented Mar 26, 2025

I second. While json formatting isn't always the easiest for shell scripts to interact with, it is the primary focus of our programmatic interface and we'd be very limited in what a nul-terminated could represent.

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Mar 26, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-package S-propose-close Status: A team member has nominated this for closing, pending further input from the team
Projects
None yet
Development

No branches or pull requests

6 participants