Witko / nvidia-xrun

Utility to run separate X with discrete nvidia graphics with full performance
GNU General Public License v2.0
488 stars 69 forks source link

nvidia-xinitrc errored with [[:not found #138

Open BobbyWibowo opened 4 years ago

BobbyWibowo commented 4 years ago

I found out that [[ is a bash-builtin, meaning it's not available if the xinit script is being executed with sh.

I'm on KDE neon 5.17.1 (Ubuntu 18.04 LTS), and from my tests, it appears that nvidia-xinitrc seems to always be executed without bash, so I kept on getting the [[: not found errors.

I noticed that the script file starts with #!/usr/bin/env bash, but that didn't seem to be doing anything anyway.

I wonder if it's just an Ubuntu thing?

noctuid commented 4 years ago

nvidia-xrun runs the user xinitrc with sh which is dash on Ubuntu. You need to either modify it to run your user nvidia-xinitrc directly or modify your user nvidia-xinitrc to run another file directly (e.g. ./xinitrc) or not use bashisms.

BobbyWibowo commented 4 years ago

Yeah, I eventually settled with not using bashisms specifically for the xinitrc file, before posting this issue. Overall it's been working great ever since.

Was just mainly wondering if it was just an Ubuntu thing, either due to it having an older version of X, or whatever I dunno. And kinda hoping the devs would perhaps take it into account for future developments of the script (if Ubuntu is ever planned on being supported - though I guess it never really was to begin with?).

noctuid commented 4 years ago

It's because Ubuntu uses dash as /bin/sh. This project could change /etc/X11/xinitrc/nvidia-xinitrc to execute the user's config directly instead of calling sh. It looks like the project may have been abandoned though.

st3r4g commented 4 years ago

I noticed that the script file starts with #!/usr/bin/env bash, but that didn't seem to be doing anything anyway.

It seems to be honored only if nvidia-xinitrc is made executable. After giving the file permissions 755 it was executed under bash instead of the default sh, and that fixed the issue.