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

Docs for releases during 2018-{10-12} appear unstyled #1327

Closed
inejge opened this issue Mar 22, 2021 · 13 comments · Fixed by rust-lang/rust#83478 or #1340
Closed

Docs for releases during 2018-{10-12} appear unstyled #1327

inejge opened this issue Mar 22, 2021 · 13 comments · Fixed by rust-lang/rust#83478 or #1340
Labels
A-admin Area: Administration of the production docs.rs server A-backend Area: Webserver backend C-bug Category: This is a bug

Comments

@inejge
Copy link

inejge commented Mar 22, 2021

The most recent docs.rs displays the contents for rouille-3.0.0 with no styles; only the top nav bar is styled. Tested with FF 86 and Chromium 89. When I last visited the page, in the past week or so, it displayed correctly.

Inspector shows the stylesheet links in <head> as relative, e.g.,

<link rel="stylesheet" type="text/css" href="../rustdoc-20181129-1.32.0-nightly-3e90a12a8.css" id="mainThemeStyle">

...and obviously doesn't read valid CSS, since the console is full of "Ruleset ignored due to bad selector" messages. If I tweak the links to absolute like this:

<link rel="stylesheet" type="text/css" href="/rustdoc-20181129-1.32.0-nightly-3e90a12a8.css" id="mainThemeStyle">

...the styling appears, but will of course again be absent if I navigate away to any subpage.

@jyn514
Copy link
Member

jyn514 commented Mar 22, 2021

I can't replicate this - can you post a screenshot of what the page looks like for you?

image

@inejge
Copy link
Author

inejge commented Mar 22, 2021

image

@jyn514
Copy link
Member

jyn514 commented Mar 22, 2021

Can you pull up the network console and show what file it's trying to load? Mine is loading https://docs.rs/rouille/3.0.0/rustdoc-20181129-1.32.0-nightly-3e90a12a8.css which succeeds.

@inejge
Copy link
Author

inejge commented Mar 22, 2021

For that particular URL (the others behave similarly), first I get a 302 which pastes an extra /rouille on the response in Location, resulting in a subsequent 404. Copy/paste from the network console:

{
	"GET": {
		"scheme": "https",
		"host": "docs.rs",
		"filename": "/rouille/3.0.0/rustdoc-20181129-1.32.0-nightly-3e90a12a8.css",
		"remote": {
			"Address": "52.84.109.107:443"
		}
	}
}
{
	"Status": "302Found",
	"Version": "HTTP/2",
	"Transferred": "2.79 KB (8.98 KB size)",
	"Referrer Policy": "strict-origin-when-cross-origin"
}
{
	"Response Headers (460 B)": {
		"headers": [
			{
				"name": "content-length",
				"value": "0"
			},
			{
				"name": "date",
				"value": "Mon, 22 Mar 2021 22:11:03 GMT"
			},
			{
				"name": "expires",
				"value": "Mon, 22 Mar 2021 22:11:03 GMT"
			},
			{
				"name": "location",
				"value": "https://docs.rs/rouille/3.0.0/rustdoc-20181129-1.32.0-nightly-3e90a12a8.css/rouille/"
			},
			{
				"name": "server",
				"value": "nginx/1.14.0 (Ubuntu)"
			},
			{
				"name": "via",
				"value": "1.1 d84412fe91532b74b0fb5833b7857e01.cloudfront.net (CloudFront)"
			},
			{
				"name": "x-amz-cf-id",
				"value": "X0QTIL_EkQwhpJYBEZNWRISTLtnCNKs4dRpu8PXLmvwkEEwuJzaizg=="
			},
			{
				"name": "x-amz-cf-pop",
				"value": "BUD50-C1"
			},
			{
				"name": "x-cache",
				"value": "Miss from cloudfront"
			},
			{
				"name": "X-Firefox-Spdy",
				"value": "h2"
			}
		]
	}
}
{
	"Request Headers (398 B)": {
		"headers": [
			{
				"name": "Accept",
				"value": "text/css,*/*;q=0.1"
			},
			{
				"name": "Accept-Encoding",
				"value": "gzip, deflate, br"
			},
			{
				"name": "Accept-Language",
				"value": "en-US,en;q=0.5"
			},
			{
				"name": "Cache-Control",
				"value": "max-age=0"
			},
			{
				"name": "Connection",
				"value": "keep-alive"
			},
			{
				"name": "DNT",
				"value": "1"
			},
			{
				"name": "Host",
				"value": "docs.rs"
			},
			{
				"name": "Referer",
				"value": "https://docs.rs/rouille/3.0.0/rouille/"
			},
			{
				"name": "Sec-GPC",
				"value": "1"
			},
			{
				"name": "TE",
				"value": "Trailers"
			},
			{
				"name": "User-Agent",
				"value": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0"
			}
		]
	}
}

@Nemo157
Copy link
Member

Nemo157 commented Mar 22, 2021

Interesting, I can reproduce if compression is disabled (though maybe that's just an artifact of the caching):

> curl -I https://docs.rs/rouille/3.0.0/rustdoc-20181129-1.32.0-nightly-3e90a12a8.css
HTTP/2 302
content-length: 0
location: https://docs.rs/rouille/3.0.0/rustdoc-20181129-1.32.0-nightly-3e90a12a8.css/rouille/
server: nginx/1.14.0 (Ubuntu)
date: Mon, 22 Mar 2021 22:34:16 GMT
expires: Mon, 22 Mar 2021 22:34:16 GMT
x-cache: Miss from cloudfront
via: 1.1 458f29e42261f01e7368474593f44b66.cloudfront.net (CloudFront)
x-amz-cf-pop: TXL52-C1
x-amz-cf-id: gtmRXBGWwh5d06CQuMfY_nrCsI-QyyBEDOCUNIW21u4-6PwT0Qi2FQ==


> curl -I https://docs.rs/rouille/3.0.0/rustdoc-20181129-1.32.0-nightly-3e90a12a8.css --compressed
HTTP/2 200
content-type: text/css
server: nginx/1.14.0 (Ubuntu)
date: Sun, 07 Feb 2021 13:56:45 GMT
cache-control: public, max-age=31104000
last-modified: Fri, 19 Jul 2019 14:28:38 GMT
content-encoding: gzip
vary: Accept-Encoding,Accept-Encoding
x-cache: Hit from cloudfront
via: 1.1 a57d5819527c444e16b1875e3bd28970.cloudfront.net (CloudFront)
x-amz-cf-pop: TXL52-C1
x-amz-cf-id: 29N_lXiWz5vXptphnNYQyckTHjaGlTQteFH_CRgNhQnoASEMQsDqBA==
age: 3746254

@jyn514
Copy link
Member

jyn514 commented Mar 22, 2021

Interesting, I can reproduce if compression is disabled (though maybe that's just an artifact of the caching):

This is the caching, on the prod server --compressed also gives the bad 302.

@jyn514 jyn514 added the C-bug Category: This is a bug label Mar 22, 2021
@Nemo157
Copy link
Member

Nemo157 commented Mar 22, 2021

Seems likely to be a side-effect of #1324 and some weirdness of the "redirect crate root into the docs" ignoring the filename, if there's a filename it should probably just return a 404.

@jyn514
Copy link
Member

jyn514 commented Mar 22, 2021

This was built with 2018-11-29, so I expect it's related to #1181 somehow. Honestly I would rather just rather rebuild those docs.

@jyn514
Copy link
Member

jyn514 commented Mar 22, 2021

Ok, the issue is that

/// Handler called for `/:crate` and `/:crate/:version` URLs. Automatically redirects to the docs
/// or crate details page based on whether the given crate version was successfully built.
pub fn rustdoc_redirector_handler(req: &mut Request) -> IronResult<Response> {
unconditionally redirects, even if the file doesn't exists (for everything except .js and .css files).

There are a couple possible fixes:

  1. Only redirect for valid crate or target names ([a-zA-Z_-]+). This doesn't include ., so any file with an extension will get 404s returned.
  2. Rebuild the crates that are linking to the wrong place (Docs built during 2018-{10-12} link to the wrong url for static resources #1181).
  3. Revert Give precedence to local shared files over global ones #1324 or special-case it somehow. I would rather not do this, it means the issue in Don't hard-code essential rustdoc files #1312 (comment) comes back.

1 is kind of a hack but I think it's the easiest and most reliable fix.

@jyn514 jyn514 added A-backend Area: Webserver backend E-easy Effort: Should be easy to implement and would make a good first PR mentor This has instructions for getting started labels Mar 22, 2021
@jyn514
Copy link
Member

jyn514 commented Mar 23, 2021

  1. isn't possible, because it's not always true that the page will be a 404 after a redirect: Add hack so that docs from 2018-11-29 are styled correctly #1331 (comment). For now I'll rebuild rouille 3.0.0 directly, and the other crates built during that time period will just be broken for now.

@jyn514 jyn514 added A-admin Area: Administration of the production docs.rs server and removed E-easy Effort: Should be easy to implement and would make a good first PR mentor This has instructions for getting started labels Mar 23, 2021
@jyn514 jyn514 changed the title Docs for rouille-3.0.0 appear unstyled Docs for releases during 2018-{10-12} appear unstyled Mar 23, 2021
@jyn514
Copy link
Member

jyn514 commented Mar 25, 2021

So I don't forget again: the broken links start in #243 (2018-10-20) and end after #281 (2019-01-11).

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 2, 2021
…imulacrum

rustdoc: Add unstable option to only emit shared/crate-specific files

The intended use case is for docs.rs, which can now copy exactly the
files it cares about, rather than having to guess based on whether they
have a resource suffix or not. In particular, some files have a resource
suffix but cannot be shared between crates: rust-lang/docs.rs#1312 (comment)

The end goal is to fix rust-lang/docs.rs#1327 by reverting rust-lang/docs.rs#1324.

This obsoletes `--print=unversioned-files`, which I plan to remove as
soon as docs.rs stops using it.

I recommend reviewing this one commit at a time.

r? `@GuillaumeGomez` cc `@Nemo157` `@pietroalbini`
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 2, 2021
…imulacrum

rustdoc: Add unstable option to only emit shared/crate-specific files

The intended use case is for docs.rs, which can now copy exactly the
files it cares about, rather than having to guess based on whether they
have a resource suffix or not. In particular, some files have a resource
suffix but cannot be shared between crates: rust-lang/docs.rs#1312 (comment)

The end goal is to fix rust-lang/docs.rs#1327 by reverting rust-lang/docs.rs#1324.

This obsoletes `--print=unversioned-files`, which I plan to remove as
soon as docs.rs stops using it.

I recommend reviewing this one commit at a time.

r? ``@GuillaumeGomez`` cc ``@Nemo157`` ``@pietroalbini``
@jyn514 jyn514 reopened this Apr 4, 2021
@jyn514
Copy link
Member

jyn514 commented Apr 4, 2021

Wow, github is really bad about that. That commit isn't even close to fixing this.

@jyn514
Copy link
Member

jyn514 commented Apr 13, 2021

For posterity: since rouille was rebuilt, another example of an affected crate is https://docs.rs/ess/0.4.2/ess/, which is now working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-admin Area: Administration of the production docs.rs server A-backend Area: Webserver backend C-bug Category: This is a bug
Projects
None yet
3 participants