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 fails due to backslash in one of file names #6077

Open
zetok opened this issue Sep 22, 2018 · 3 comments
Open

cargo package fails due to backslash in one of file names #6077

zetok opened this issue Sep 22, 2018 · 3 comments
Labels
Command-package S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

Comments

@zetok
Copy link

zetok commented Sep 22, 2018

error: failed to prepare local package for uploading

Caused by:
  cannot package a filename with a special character `\`: tests/encrypted_asdf\n_pass.epc
$ cargo --version
cargo 1.29.0 (524a578d7 2018-08-05)

Steps to reproduce:

git clone https://gitlab.com/zetok/epaste.git
cd epaste
cargo package

Cargo shouldn't have any limitations regarding file names, since even the underlying FS itself only prohibits 2 bytes in file names, namely slash / and null byte \0.

@alexcrichton
Copy link
Member

Thanks for the report! This package would unfortunately fail to unpack on Windows, however, which is where this error stems from. Cargo by default takes the "least common denominator" of the family restrictions for the platforms it supports.

We could perhaps add a feature, though, for crates to opt out of this error if necessary

@rabite0
Copy link

rabite0 commented Jul 1, 2019

I'm also interested in this. When I tried to uplaod the newest version of hunter, I got the same error message:

cannot package a filename with a special character `?`: extra/actions/Add Action?type?name!.sh

I'm using the question marks as a way to encode queries that should be asked before the script is run. As far as I can see the forbidden characters are these: (found here).

let bad_chars = ['/', '\\', '<', '>', ':', '"', '|', '?', '*'];

There might be more restrictions, I don't' know.

I'm not even trying to support anything but UNIX-like systems (although Windows works with WSL), so restricting the possible characters in file names doesn't make a lot of sense in my case.

I haven't looked deeper into cargo's source, but if an option to disable some those restrictions would be accepted, I'd be willing to work on this.

@epage
Copy link
Contributor

epage commented Oct 24, 2023

The main problem I see with this is that there isn't a way to restrict what systems the package is relevant for. If we had package.required-target from #7058 and put that in the Index, then we could prevent accidentally pulling in one of these packages.

@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 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

5 participants