tianocore / edk2-edkrepo

Repository for the edkrepo utility
Other
21 stars 24 forks source link

Installing EdkRepo causes X11 to crash at startup on Raspberry Pi OS #163

Closed nate-desimone closed 1 year ago

nate-desimone commented 1 year ago

Installing EdkRepo on Raspberry Pi OS will cause X11 to crash during startup on the next reboot. This causes the desktop environment to become inaccessible.

The root cause for this issue is that the X11 startup script on Raspberry Pi will blindly run all scripts in /etc/profile.d using /bin/sh (which defaults to dash on Raspberry Pi) without any regard for the #! line at the start of the script. This seems like a bug in Raspberry Pi OS.

Attempting to execute the EdkRepo bash completions using dash will result in syntax errors. The reason for this is setting command completions requires one to use the COMREPLY variable, which is required to be an array. Arrays are a bash-specific extension that is not in the POSIX standard, so that syntax will be considered invalid.

Raspberry Pi OS installs a script in /etc/profile.d that will check if the current interpreter is bash and then run the command completion scripts in /usr/share/bash-completion/completions. Therefore, the workaround for this issue is to place the command completion script there. This also has the benefit of bash-completions providing a performance boost by only running completion scripts for the command that is currently being typed by the user.