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

GPU: Un-hardcode /bin/bash location #74

Merged
merged 1 commit into from
May 2, 2024
Merged

GPU: Un-hardcode /bin/bash location #74

merged 1 commit into from
May 2, 2024

Conversation

HeroBrine1st
Copy link

@HeroBrine1st HeroBrine1st commented May 2, 2024

What I tested

  • Verified no regressions to existing functionality.
    It is assumed there's no side-effects in this change, so I did no regression tests as they're not needed.
  • Tested on the following Gnome Shell versions: 45.5, 46.1

Changes

This PR changes hardcoded /bin/bash to /usr/bin/env bash in GPU module, fixing non-working GPU module for non-FHS distributions such as NixOS.

Actually tested with direct patch to NixOS package, but this PR is so small it doesn't need throrough testing.

The NixOS override I use for now
{gnomeExtensions}: gnomeExtensions.system-monitor-next.overrideAttrs (old: {
  patches = old.patches ++ [
    ./usr-bin-env.patch
  ];
})

Mentioned patch is (the same as in this PR):

--- a/extension.js
+++ b/extension.js
@@ -2161,7 +2161,7 @@ const Gpu = class SystemMonitor_Gpu extends ElementBase {
         // Run asynchronously, to avoid shell freeze
         try {
             let path = this.extension.path;
-            let script = ['/bin/bash', path + '/gpu_usage.sh'];
+            let script = ['/usr/bin/env', 'bash', path + '/gpu_usage.sh'];

             // Create subprocess and capture STDOUT
             let proc = new Gio.Subprocess({argv: script, flags: Gio.SubprocessFlags.STDOUT_PIPE});

Also tested this patch on Arch Linux (FHS distribution) - GPU module works as expected.

Warning: I did not test this patch on master branch, I did only on latest (66) version from e.g.o


This change is Reviewable

Signed-off-by: HeroBrine1st Erquilenne <[email protected]>
@HeroBrine1st
Copy link
Author

HeroBrine1st commented May 2, 2024

Another (and probably better) option is to not use /bin/bash in command and instead place it in shebang. /bin/sh is already there and is actually patched by nix builder, but I don't think zip tarball can include file permissions, so it would be a regression for e.g.o users.

@HeroBrine1st
Copy link
Author

HeroBrine1st commented May 2, 2024

I forgot to check other PRs. This PR conflicts with #71, but those two can be easily merged as both are small. IDK how to make a PR that depends on another PR so I leave this as-is.

If you want me to merge this with #71, just tell me.

Copy link
Owner

@mgalgs mgalgs left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @HeroBrine1st)

Copy link
Owner

@mgalgs mgalgs left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @HeroBrine1st)

@mgalgs mgalgs merged commit 65886ea into mgalgs:master May 2, 2024
1 check passed
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