bors icon indicating copy to clipboard operation
bors copied to clipboard

Escaping job wildcard via backtick does not work

Open RalfJung opened this issue 3 months ago • 6 comments

I issued the command

@bors try jobs=`dist-various-*`

which did not work:

Unknown value for argument "jobs". Run @bors2 help to see available commands.

That error is not super helpful, I know about the command, I just don't know how to escape *... and the help text does not indicate that it seems.

I expected this to work similar to "try-job: dist-various-*" in the PR description. The docs even say

When using glob patterns, you might want to wrap them in backticks (`) to avoid GitHub rendering the pattern as Markdown.

but that does only seem to apply to jobs defined in the PR description (whereas the docs make it sound like it also should work for the jobs command parameter).

RalfJung avatar Sep 13 '25 08:09 RalfJung

This was discussed in https://github.com/rust-lang/bors/issues/314. The TLDR is that it would require considerable implementation complexity to distinguish

`@bors try jobs=...`
vs
@bors try jobs=`...`

So we don't do it, and thus using backticks inside bors commands doesn't work.

You don't really need to escape the jobs though, even though it may render weirdly, bors will be able to deal with the raw text.

When using glob patterns, you might want to wrap them in backticks (`) to avoid GitHub rendering the pattern as Markdown.

Hmm, I thought that I added to the docs that it only works in the PR description, but clearly not. I'll update the docs, thanks.

Kobzol avatar Sep 15 '25 07:09 Kobzol

https://github.com/rust-lang/rustc-dev-guide/pull/2589

Kobzol avatar Sep 15 '25 07:09 Kobzol

This was discussed in https://github.com/rust-lang/bors/issues/314.

Ah, I thought I had remembered discussion about this somewhere, but I couldn't find it...

Any chance the error could be more helpful in this case?

Would "jobs=dist-various-*" (written as jobs=dist-various-\*) work?

It'd be better if the same syntax was recommended and supported in both places where we can designate try jobs, it's quite confusing to have to remember what to use where. So if we can't have backtick support for "jobs=", it should IMO be deprecated for "try-jobs" as well.

RalfJung avatar Sep 15 '25 08:09 RalfJung

I wouldn't even say that it's real syntax, it's mostly just a hack to prevent GitHub from rendering the command as Markdown. Writing bors try jobs=foo-* can be interpreted by bors perfectly fine, it's just that GH might render it in a weird way.

I'll take a look at improving the error message.

Kobzol avatar Sep 15 '25 08:09 Kobzol

I wouldn't even say that it's real syntax, it's mostly just a hack to prevent GitHub from rendering the command as Markdown. Writing bors try jobs=foo-* can be interpreted by bors perfectly fine, it's just that GH might render it in a weird way.

Yeah I understand, but it does look odd and makes it harder for a human to tell (from looking at the comment) what jobs were run. So if \* works that seems preferable.

RalfJung avatar Sep 15 '25 08:09 RalfJung

Actually, we already have a test for this (https://github.com/rust-lang/bors/blob/0f1f77644faffb5bac8156dd2d73a1719644c579/src/bors/command/parser.rs#L1105) and I think we have already discussed this on Zulip where someone suggested the escape 😆 So it should work to use \*.

Kobzol avatar Sep 15 '25 18:09 Kobzol