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

Make rustc --explain compatible with BusyBox less #133196

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

omnivagant
Copy link
Contributor

busybox less does not support the -r flag and less(1) says:

USE OF THE -r OPTION IS NOT RECOMMENDED.

busybox less does not support the -r flag and less(1) says:

  USE OF THE -r OPTION IS NOT RECOMMENDED.
@rustbot
Copy link
Collaborator

rustbot commented Nov 19, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nnethercote (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 19, 2024
@workingjubilee workingjubilee changed the title Make rustc --explain busybox less compatible Make rustc --explain compatible with BusyBox less Nov 19, 2024
@nnethercote
Copy link
Contributor

USE OF THE -r OPTION IS NOT RECOMMENDED.

I see this text in the man page for GNU less, which is used on my Linux machine (unsurprising) and on my Mac laptop (huh?)

less is used as the pager on non-Windows sytems if PAGER isn't set. I guess the question is whether any versions of less (other than busybox's) have -R/-r that don't mean the same things as the GNU version.

https://man.freebsd.org/cgi/man.cgi?query=less shows that freebsd less is also the GNU one. Maybe that explains my Mac result above? Similar story with openbsd: https://man.openbsd.org/less.1. And netbsd: https://man.netbsd.org/less.1.

So, changing to -R seems ok for a lot of the popular non-Windows platforms, and fixes busybox, but I'm worried that I might be overlooking some other platform. Any suggestions how to overcome that worry?

@omnivagant
Copy link
Contributor Author

It was introduced in #112697 but I cannot find any trace of why -r was chosen isntead of -R, perhaps out of habit? I can see situations where you would want to use less -r, but I don't think this is one.

With your additions, I cannot think of any other popular implementation of less.

It was discoevered in Alpine Linux https://gitlab.alpinelinux.org/alpine/aports/-/issues/16598

@nnethercote
Copy link
Contributor

nnethercote commented Nov 19, 2024

I tried out less -R on my Linux box, the output is identical to less -r.

To summarize:

  • rustc currently uses less -r for paging --explain output.
  • GNU less supports both -r and -R, and -R is strongly preferred according to the man page.
  • The relevant-to-rustc behaviour of GNU less is identical with -r and -R
  • GNU less is used on most(?) Linuxes and also BSDs, including macOS.
  • busybox less only supports -R.

Based on all that, changing from less -r to less -R seems ok to me.

@tgross35: you added the less -r invocation in #112697. Was there a reason for using -r instead of -R? Any objections to changing to less -R?

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tgross35: you added the less -r invocation in #112697. Was there a reason for using -r instead of -R? Any objections to changing to less -R?

Just habit as suggested above, I didn't know -R existed and pretty strongly preferred. So +1 to this change.

@tgross35
Copy link
Contributor

Assuming you're on board here @nnethercote

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 19, 2024

📌 Commit 6f8fe79 has been approved by tgross35

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 19, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 20, 2024
Rollup of 5 pull requests

Successful merges:

 - rust-lang#132732 (Use attributes for `dangling_pointers_from_temporaries` lint)
 - rust-lang#133108 (lints_that_dont_need_to_run: never skip future-compat-reported lints)
 - rust-lang#133190 (CI: use free runner in dist-aarch64-msvc)
 - rust-lang#133196 (Make rustc --explain compatible with BusyBox less)
 - rust-lang#133216 (Implement `~const Fn` trait goal in the new solver)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit cd36973 into rust-lang:master Nov 20, 2024
6 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Nov 20, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 20, 2024
Rollup merge of rust-lang#133196 - omnivagant:correct-less-r-flag, r=tgross35

Make rustc --explain compatible with BusyBox less

busybox less does not support the -r flag and less(1) says:

  USE OF THE -r OPTION IS NOT RECOMMENDED.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants