SchoofsKelvin / vscode-sshfs

Extension for Visual Studio Code: File system provider using SSH
GNU General Public License v3.0
543 stars 36 forks source link

Couldn't detect the home directory for 'configuration' #294

Closed hexDoor closed 2 years ago

hexDoor commented 2 years ago

After some painful debugging with a student, I just wanted to draw attention to a potential race condition(?) which is causing the error in the title.

As part of an introductory programming task, the student had placed a command to execute a MOTD-like C binary in their .bashrc whenever it gets sourced to generate some coloured ASCII art into stdout.

Since the issue immediately goes away upon removing this command and reappears when putting it back in, I reckon the output from the echo Home: ~ is being corrupted with the ASCII art. https://github.com/SchoofsKelvin/vscode-sshfs/blob/35272590e4cbfdee5938c9c8c324594b393af9c2/src/connection.ts#L25

I don't know if there's an elegant fix for it other than to save output to a file in /tmp and reading from it but that should be a good start.

SchoofsKelvin commented 2 years ago

Fixed in 860f65a and released in v1.23.0 of the extension. If your student installed it from the marketplace, it should auto-update, or at least give you a quick "Update to 1.23.0" button in the extensions tab.

Instead of expecting the output to be of the exact format Home: <path>, it now echoes ::sshfs:home:<path>\n which it'll look for, no longer being affected by whether .bashrc (or similar) echoes anything before/after the "magic pattern".