Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

cargo package should warn binary files by default #4413

Open
upsuper opened this issue Aug 18, 2017 · 4 comments
Open

cargo package should warn binary files by default #4413

upsuper opened this issue Aug 18, 2017 · 4 comments
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. C-enhancement Category: enhancement Command-package S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

Comments

@upsuper
Copy link
Contributor

upsuper commented Aug 18, 2017

I've seen multiple times that some images which is used in README only is included into crate package, e.g. bindgen contains a 1.3MB PNG, and dtoa contains a 68KB PNG.

I believe binary files in general are not useful in packages. They should be excluded or at least warned by default. People should still be able to explicitly specify binary files if necessary, though.

@froydnj
Copy link
Contributor

froydnj commented Aug 21, 2017

E.g. this bugzilla patch, produced via cargo-vendor includes rlibs from target/debug/. It would be splendid if we could blacklist such files in cargo package so crates.io packages didn't get so bloated.

@alexcrichton
Copy link
Member

Sounds like a good idea to me!

@carols10cents carols10cents added the C-enhancement Category: enhancement label Aug 27, 2017
@upsuper
Copy link
Contributor Author

upsuper commented Sep 14, 2017

Another bloating which could be avoidable if we have such warning: dropbox/rust-brotli#8

@link2xt
Copy link

link2xt commented Sep 8, 2023

Related issue about packaging a binary on purpose: serde-rs/serde#2538

@epage epage added the S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. label Oct 17, 2023
@epage epage added the A-diagnostics Area: Error and warning messages generated by Cargo itself. label Nov 3, 2023
github-merge-queue bot pushed a commit that referenced this issue Dec 31, 2024
### What does this PR try to resolve?

This adds a special case for checking source files are symlinks
and have been modified when under a VCS control

This is required because those paths may link to a file outside the
current package root, but still under the git workdir, affecting the
final packaged `.crate` file.

### How should we test and review this PR?

Pretty similar to #14966, as a part of #14967.

This may have potential performance issue. If a package contains
thousands of symlinks, Cargo will fire `git status` for each of them.
Not sure if we want to do anything proactively now.

The introduction of the `PathEntry` struct gives us more room for
storing file metadata to satisfiy use cases in the future. For
instances,

* Knowing a source file is a symlink and resolving it when packaging on
Windows
  * #5664
  * #14965
* Knowing more about a file's metadata (e.g. permission bits from Git)
  * #4413
  * #8006
* Provide richer information for `cargo package --list`, for example
JSON output mode
  * #11666
  * #13331
  * #13953
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. C-enhancement Category: enhancement Command-package S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Projects
None yet
Development

No branches or pull requests

6 participants