Fossil SCM
Editor command fails with spaces
995a864c5adf794…
· opened 15 years, 2 months ago
- Type
- Code_Defect
- Priority
- —
- Severity
- Important
- Resolution
- Open
- Subsystem
- —
- Created
- Feb. 2, 2011 2:43 p.m.
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: The diff above does not work. On the system on which I am typing this remark (a Mac) my editor is set to
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: you are right. pebkac. as for completeness ' doesn't work you will need \"