vim-lsp-settings icon indicating copy to clipboard operation
vim-lsp-settings copied to clipboard

Fix Windows installation when username has space in it

Open chaos95 opened this issue 3 years ago • 2 comments

This change modifies run_unzip.cmd and run_gzip.cmd to wrap invocations and paths in quotes.

This prevents issues arising where a user's home directory has spaces in it due to their username, such as 'C:\Users\FirstName LastName', which causes commands to fail because they parse the different parts of the path as separate arguments.

This change is not a complete solution - there are still quite a few individual installer scripts that make use of %~dp0 without quotes, but these central changes to unzip and gzip should solve the problem for at least a few people. I would be happy to submit future PRs for the individual installers as time permits.

chaos95 avatar Oct 26 '22 03:10 chaos95

I suspect that this modification will make it even worse.

Current implementation:

test.c

#include <stdio.h>

int
main(int argc, char* argv[]) {
  int i = 0;
  for (i = 0; i < argc; i++) {
    puts(argv[i]);
  }
  return 0;
}

test.bat

@echo off
.\test.exe %*
C:\test>test.bat "foo bar"
foo bar

And with change

test.bat

@echo off
.\test.exe "%*"
C:\test>test.bat "foo bar"
foo
bar

mattn avatar Oct 26 '22 03:10 mattn

True. I think it might be sufficient to wrap the commands in quotes and leave the arguments unquoted. For all of the invocations of unzip.cmd that I can see, the arguments are relative paths, so there are no spaces in them. But because the path to unzip.cmd itself might contain spaces, that still needs to be quoted. I'll update the PR shortly :)

chaos95 avatar Oct 31 '22 01:10 chaos95