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

Add colors to tar check menu #163

Merged
merged 4 commits into from
Apr 3, 2022
Merged

Conversation

intgr
Copy link
Contributor

@intgr intgr commented Jun 5, 2021

Using the same color scheme as review menu
in commit a800fb2 (PR #161)

src/tar_check.rs Outdated
if has_install {
eprint!("{}", "[I]=show install file, ".bright_red().bold());
eprint!("{}, ", "[I]=show install file".bright_red().bold());
Copy link
Owner

@vn971 vn971 Jun 5, 2021

Choose a reason for hiding this comment

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

Hey, here I'm somewhat unsure here. The install file itself could be dangerous, but showing the file is not a dangerous operation.

Should we change it to something like [I]=show [red]install file[/red] ? Or something else?

Alternatively, make all actions except installation to be slightly green or even neutral? As far as my preferences go, I think I'd consider making everything neutral except install file text and ok, proceed -- because those are the only things or operations that "could harm"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll give that a try.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this what you had in mind?

image

@intgr
Copy link
Contributor Author

intgr commented Jun 5, 2021

I didn't realize that the tar check menu already has colors. I see how adding color to other options might reduce visibility of the previously red options.

image

Making them yellow seems to make them stand out more:

image

@Morganamilo
Copy link
Collaborator

Just mentioning yellow can look quite bad on a light terminal.

@vn971
Copy link
Owner

vn971 commented Jun 5, 2021

Looking at the screenshots, I think I'm definitely aligning more to the "traffic lights" rule you mentioned before. In this case it'd be one potentially dangerous operation [O]=ok, proceed and highlighting the potentially dangerous parts of SUID, maybe install file as well. Technically all files should be reviewed, because a file placed in cron directory is just as "dangerous" as an install file

@intgr
Copy link
Contributor Author

intgr commented Jun 5, 2021

This is what darker yellow would look like (better for white background)

image

@vn971
Copy link
Owner

vn971 commented Jun 5, 2021

I was thinking of something like that: 2021 06 05_10:20:16
AFK now, will be back a bit later today

Maybe showing install file / SUID files could be yellow (or a less intense red) color as well, I like some parts of your screenshot above. *I'll back later

@vn971
Copy link
Owner

vn971 commented Jun 5, 2021

I played some more with the idea, and no matter what I do, this kinda doesn't make sense for me. The only really dangerous action is to install the package, but the parts the user should be paying attention to are not those. I'm thinking of the following design
2021 06 05_13:20:10

Any thoughts on the "dangerous action" / "potentially dangerous details" concept mismatch?

@intgr
Copy link
Contributor Author

intgr commented Jun 6, 2021

My initial reason for creating these pull requests was that I found it hard to tell, where one option ends and the next one starts. So I'd prefer to have something that more clearly separates the options. Color and bolding the keyboard shortcut made them quite distinct. But without color, the effect is less pronounced:
image

I agree that the colors (like in #163 (comment)) do seem excessive. On the other hand, it slightly bothers me that the colors in the menus work differently now (compared to #161). But I can live with that. :)

@intgr intgr force-pushed the colors-to-tar-check-menu branch from f1e7f6c to 5e186df Compare June 6, 2021 19:05
@vn971
Copy link
Owner

vn971 commented Apr 3, 2022

I've finally got back to the MR 😅 (sorry, it's been a really long time, I acknowledge). I'm trying the PR out at the moment, I have a few questions

"[S]".bold(),
"SUID files".bold().bright_red()
);
//};
Copy link
Owner

Choose a reason for hiding this comment

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

I tried it out now, I think I actually like to keep the old if condition above. Without it, my terminal alarms me: "hey, you have both SUID and an installation file at your hands, be sure to review it!" (see screenshot)

2022 04 03_10:54:28

However, after clicking on checking these warnings, you see Package packagename-1.0.0-x86_64.pkg.tar.zst has no SUID files. That's confusing to me, I like the old conditional display better

Copy link
Owner

Choose a reason for hiding this comment

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

I'm willing to restore the if condition and try it out then, maybe that'll be good to keep everyone satisfied and improve the display :)

@@ -111,17 +111,26 @@ fn tar_check_archive<R: Read>(mut archive: Archive<R>, path_str: &str) {
if suid_files.is_empty() {
eprintln!("Package {} has no SUID files.", path_str);
}
eprint!("{}{}, ", "[E]".bold(), "=list executable files");
eprint!("{}{}, ", "[L]".bold(), "=list all files");
eprint!("{}{}, ", "[T]".bold(), "=run shell to inspect");
Copy link
Owner

@vn971 vn971 Apr 3, 2022

Choose a reason for hiding this comment

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

This gives a compiler warning:

error: literal with an empty format string
   --> src/tar_check.rs:114:35
    |
114 |         eprint!("{}{}, ", "[E]".bold(), "=list executable files");
    |                                         ^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::print-literal` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#print_literal
help: try this
    |
114 -         eprint!("{}{}, ", "[E]".bold(), "=list executable files");
114 +         eprint!("{}=list executable files, ", "[E]".bold());
    | 

I'll revert to inlining the "static" text as the compiler suggests, but will keep the .bold() part you've introduced

@vn971 vn971 merged commit 1b6c704 into vn971:master Apr 3, 2022
@vn971
Copy link
Owner

vn971 commented Apr 3, 2022

Merged!

Before:
2022 04 03_11:10:22
After:
2022 04 03_11:06:47

@intgr
Copy link
Contributor Author

intgr commented Apr 3, 2022

Thanks! :) I'm fine with this, it makes the available choices clearer without excessive color.

"hey, you have both SUID and an installation file at your hands, be sure to review it!"

Yeah, I think I commented the if out just to test the output. Didn't intend to leave it like that.

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

Successfully merging this pull request may close these issues.

3 participants