Re: [vim/vim] fix(cli): parsing bug - require exact match for longopt name (PR #21088)
h_east (Vim Github Repository) <[email protected]>
| Newsgroups | gmane.editors.vim.devel |
|---|---|
| Message-ID | <vim/vim/pull/21088/[email protected]> |
h-east left a comment (vim/vim#21088) The diagnosis is right: `--servername=test` slips past `early_arg_scan()`, which already compares exactly (`main.c:1906`), and is then matched by the prefix comparison in `command_line_scan()` (`main.c:2268`), which reacts by skipping the next argument. Two things need work. ### Only half of the mismatch is fixed `--servername` is compared exactly in both places after this change, which is why the reported case works. `--clientserver` is not: `early_arg_scan()` still has `STRNICMP(argv[i], "--clientserver", 14)` at `main.c:1923`. So `--clientserverx socket` is still consumed there, sets `clientserver_method` and eats the following argument, and only afterwards is rejected by `command_line_scan()`. It takes effect before it is refused. Both places should agree. `--remote` at `main.c:1913` must stay a prefix comparison, since `--remote-wait` and friends depend on it. ### The test depends on the locale `Unknown option argument` is wrapped in `N_()` (`main.c:60`). `lang mess C` in `runtest.vim:155` only affects the Vim running the tests; the Vim started through `system()` inherits `$LANG`, so the test fails wherever translations are installed and the environment is not English. Set `$LC_ALL` to "C" around the call, or rely on `v:shell_error` alone. Smaller points on the same test: `GetVimCommand()` already yields `-u NONE` and `--not-a-term` (`util/shared.vim:349-355`), so `-Nu NONE` is redundant; `2>&1` is shell syntax and `CheckNotGui` does not exclude the Windows console; and only `--servername=test` is exercised, not `--clientserver=socket`. ### Two notes `serversend` at `main.c:2269` has no implementation anywhere - not in `early_arg_scan()`, the usage message or `runtime/doc/remote.txt`. It silently swallows its argument today and still will after this change. Worth deleting rather than tightening, probably as a separate patch. `--servername=test` now aborts startup instead of being quietly mishandled. That is defensible - `remote.txt:62` only ever specified the form with a space - but it deserves a line in the commit message. -- Reply to this email directly or view it on GitHub: https://github.com/vim/vim/pull/21088#issuecomment-5346695194 You are receiving this because you are subscribed to this thread. Message ID: <vim/vim/pull/21088/[email protected]> -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/pull/21088/c5346695194%40github.com.