[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

How do we deal with spaces in the editor path on Windows?

From: Yasuhito FUTATSUKI <futatuki_at_yf.bsdclub.org>
Date: Tue, 6 Oct 2020 18:12:02 +0900

Hi,

While I tested the filename transcoding issue in
svn_cmdline__file_edit_externally() on Windows, I found that I couldn't
specifiy SVN_EDITOR path contains a space even if I tried the method
described in FAQ[1].

[1] https://subversion.apache.org/faq.html#svn-editor

e.g. (Using CP65001)
[[[
C:\Users\futatuki\work\svn-test\wc2>prompt $N$G
C>set SVN_EDITOR="C:\Program Files (x86)\Vim\vim82\vim.exe" -R
C>svn propedit svn:ignore .
'C:Program' is not recognized as an iternal or external command,
oprable program or batch file.
svn: E200012: system('"C:\Program Files (x86)\Vim\vim82\vim.exe" -R "svn-prop.tmp"') returned 1
]]]
(I don't really want modify svn:ignore, so I specified "-R".)

If I modified svn_cmdline__edit_string_externally() not to escape edit
file name, "svn propedit svn:ignore ." could execute editor successfully.
(attached file unbreak-svn_cmdline__edit_string_externally-on-win-patch.txt)

Is it related the behavor of "cmd.exe /c ..." described on
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd ?

"""
If you specify /c or /k, cmd processes, the remainder of string, and
the quotation marks are preserved only if all of the following
conditions are met:

    You don't also use /s.

    You use exactly one set of quotation marks.

    You don't use any special characters within the quotation marks
    (for example: & < > ( ) @ ^ | ).

    You use one or more white-space characters within the quotation
    marks.

    The string within quotation marks is the name of an executable file.

If the previous conditions aren't met, string is processed by examining
the first character to verify whether it is an opening quotation mark.
If the first character is an opening quotation mark, it is stripped
along with the closing quotation mark. Any text following the closing
quotation marks is preserved.
"""

...and how do we deal this? Does quoting whole command string with ""
resolve it?

Thanks,

-- 
Yasuhito FUTATSUKI <futatuki_at_yf.bsclub.org>

  • text/plain attachment: stored
Received on 2020-10-06 11:12:43 CEST

This is an archived mail posted to the Subversion Dev mailing list.