Move libcap use to (Linux) platform-specific code#564
Merged
natoscott merged 3 commits intohtop-dev:masterfrom Mar 22, 2021
Merged
Move libcap use to (Linux) platform-specific code#564natoscott merged 3 commits intohtop-dev:masterfrom
natoscott merged 3 commits intohtop-dev:masterfrom
Conversation
natoscott
added a commit
to natoscott/htop
that referenced
this pull request
Mar 17, 2021
Follow up on the two items of feedback from cgzones review. Related to htop-dev#564
natoscott
added a commit
to natoscott/htop
that referenced
this pull request
Mar 17, 2021
Follow up on the two items of feedback from cgzones review, and resolve a build failure picked up by CI on Mac OS X. Related to htop-dev#564
d43bf1c to
b25e6b5
Compare
BenBE
reviewed
Mar 18, 2021
Comment on lines
+33
to
+37
| #define PLATFORM_LONG_OPTIONS_USAGE \ | ||
| " --drop-capabilities[=none|basic|strict] Drop Linux capabilities when running as root\n" \ | ||
| " none - do not drop any capabilities\n" \ | ||
| " basic (default) - drop all capabilities not needed by htop\n" \ | ||
| " strict - drop all capabilities except those needed for core functionality\n" |
Member
Author
There was a problem hiding this comment.
I guess. Any better alternative you can suggest?
Member
There was a problem hiding this comment.
One could split the printf() call in htop.c:printHelpFlag() into
printf("%s " VERSION "\n"
COPYRIGHT "\n"
"Released under the GNU GPLv2.\n\n"
"-C --no-color Use a monochrome color scheme\n"
...
"-V --version Print version info\n",
name);
Platform_printLongOptionsUsage(name);
printf("\n"
"Long options may be passed with a single dash.\n\n"
"Press F1 inside %s for online help.\n"
"See 'man %s' for more information.\n",
name, name);but I am also fine with the current implementation, relying on -Wformat to alert on format string issues.
Member
Author
There was a problem hiding this comment.
@cgzones nice - I like that, it's cleaner and more flexible. Will implement shortly and then merge, I think that's the last thing here.
Comment on lines
+62
to
+64
| "Press F1 inside %s for online help.\n" | ||
| "See 'man %s' for more information.\n", | ||
| name, name, name); |
Member
There was a problem hiding this comment.
Why not use positional arguments here? Allows for re-use of the same argument.
Member
Author
There was a problem hiding this comment.
Ah, good idea! Trying it out though, I get...
htop.c: In function ‘printHelpFlag’:
htop.c:64:10: warning: ISO C does not support %n$ operand number formats [-Wformat=]
64 | name);
| ^~~~
cgzones
approved these changes
Mar 19, 2021
natoscott
added a commit
to natoscott/htop
that referenced
this pull request
Mar 22, 2021
The libcap code is Linux-specific so move it all below the linux/ platform subdirectory. As this feature has custom command-line long options I provide a mechanism whereby each platform can add custom long options that augment the main htop options. We'll make use this of this with the pcp/ platform in due course to implement the --host and --archive options there. Related to htop-dev#536
Follow up on the two items of feedback from cgzones review, and resolve a build failure picked up by CI on Mac OS X. Related to htop-dev#564
0d8e563 to
253ff23
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The libcap code is Linux-specific so move it all below
the linux/ platform subdirectory. As this feature has
custom command-line long options I provide a mechanism
whereby each platform can add custom long options that
augment the main htop options. We'll make use this of
this with the pcp/ platform in due course to implement
the --host and --archive options there.
Related to #536