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 whines about not finding README.md #2553

Open
cmskog opened this issue May 16, 2021 · 3 comments
Open

Cargo whines about not finding README.md #2553

cmskog opened this issue May 16, 2021 · 3 comments

Comments

@cmskog
Copy link

cmskog commented May 16, 2021

I got the following message from cargo recently:

error: failed to parse manifest at /build/hyper-0.13.8.crate/Cargo.toml

Caused by:
readme file with name 'README.md' was not found

It seems cargo enforces that a readme file exists if it is included in Cargo.toml.

Obviously, hyper has a README.md file.
It is just not included in the crate downloaded from crates.io.

Weirdly, of the crates I have checked, this only seems to apply the hyper crate.

Any idea ?

@memoryruins
Copy link
Contributor

Which rust toolchain are you using? A similar issue was opened last year, but it was a regression in a cargo nightly #2231

@cmskog
Copy link
Author

cmskog commented May 17, 2021

Indeed, that might certainly be important for the discussion...
For that build, I used a 2020-06-12 nightly.

To reiterate, the flaw is not in hyper(since the crate has the file that is pointed out by package.readme in its Cargo.toml. Which, of course, makes the issue opened in the wrong place. But, perhaps, this place is a good starting point...

And, it is also NOT in cargo.
The code in cargo that bails out on a lacking readme file is in commit b0a3cc6b7a42a15937cc63d6b26aa4d25af6ce99.
It might be that that commit was later reverted, if it caused too much collateral damage...
But, really...
That code checks that a file exists, if it is pointed out in Cargo.toml.
Is that asking too much ?

The question is rather:
Why isn't README.md included in the crate source archive when served from "crates.io" ???
wget -O - 'https://crates.io/api/v1/crates/hyper/0.14.7/download' 2>/dev/null | tar tvz | grep README.md returns nothing.

Is it because of some misplaced optimization effort ?
Nope, because, for example, for the serde crate version 1.0.117 we have:
wget -O - 'https://crates.io/api/v1/crates/serde/1.0.117/download' 2>/dev/null|tar xzO serde-1.0.117/Cargo.toml|grep readme
returns readme = "crates-io.md".
And that file exists in the archive:
wget -O - 'https://crates.io/api/v1/crates/serde/1.0.117/download' 2>/dev/null|tar tvz|grep crates-io.md
returns:
-rw-r--r-- 1000/1000 2332 2020-07-13 04:03 serde-1.0.117/crates-io.md

Ideas ?

@memoryruins
Copy link
Contributor

It might be that that commit was later reverted, if it caused too much collateral damage...

Yea I think the regression was fixed a few days later with rust-lang/cargo#8353

Either way, to help avoid issues like that, an option would be to remove the line that specifies README.md since by default (since almost a year ago rust-lang/cargo#8277) cargo checks if a README.md exists if one hasn't been specified, but doesn't error when it doesn't.

readme = "README.md"

Alternatively/ in addition, the readme file could be added to the include list

hyper/Cargo.toml

Lines 15 to 20 in 960a69a

include = [
"Cargo.toml",
"LICENSE",
"src/**/*",
#"build.rs",
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants