Ticket Hash: | 995a864c5adf79456808d8f2bcd44c4959f46136 | |||
Title: | Editor command fails with spaces | |||
Status: | Closed | Type: | Code_Defect | |
Severity: | Important | Priority: | ||
Subsystem: | Resolution: | Open | ||
Last Modified: | 2011-02-04 11:32:41 | |||
Version Found In: | b6a4e8592d58ead7878f4a072fc6c4da71c7ea97 | |||
Description: | ||||
The fix for bug [8d073be8808beaa7b614b6d489e729dfb51ac114] only seems to have fixed the issue for the gdiff command. If editor contains spaces, executing it still fails.
C:\Docs\Projects\01. Lean SDMC>fossil commit c:/Program Files/Vim/vim73/gvim.exe "C:/<snipped>/ci-comment-5 260D688DBC8.txt" 'c:/Program' is not recognized as an internal or external command, operable program or batch file. c:\Docs\Bin\fossil.exe: editor aborted Diff below fixes this, but a better solution would probably be to extend the portable_system command to cover all uses of fossil_system --- src/checkin.c +++ src/checkin.c @@ -442,11 +442,11 @@ #if defined(_WIN32) blob_add_cr(&text); #endif blob_write_to_file(&text, zFile); if( zEditor ){ - zCmd = mprintf("%s \"%s\"", zEditor, zFile); + zCmd = mprintf("\"%s\" \"%s\"", zEditor, zFile); printf("%s\n", zCmd); if( fossil_system(zCmd) ){ fossil_panic("editor aborted"); } blob_reset(&text); drh added on 2011-02-04 03:28:14 UTC: fossil setting editor 'open -e -n -W' In other words, the command is "open" and that command is getting three command-line arguments, -e, -n, and -W. If these are quoted, then the shell will think that I am trying to run a command named "open -e -n -W" which is the wrong thing to do. If the editor setting contains a space, then the quotes should be included in the editor setting itself: fossil setting editor '"c:/Program Files/Vim/vim73/gvim.exe"' mjanssen added on 2011-02-04 11:32:41 UTC: |