You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Shahaf <d....@daniel.shahaf.name> on 2020/03/17 19:50:17 UTC

Re: svn commit: r1875312 - /subversion/site/publish/docs/release-notes/1.14.html

hartmannathan@apache.org wrote on Tue, 17 Mar 2020 18:36 -0000:
> 1.14 release notes: Document escaping of pathname args to $SVN_EDITOR
> 
> * docs/release-notes/1.14.html
>   (editor-filename-escaping): New section. Documents the pathname escaping
>     implemented in r1874057, r1874093, and r1875230.

Thanks!

> +<p>When invoking the user-defined <tt>$SVN_EDITOR</tt>, such as during

The editor may be configured in other ways: --editor-cmd,
--config-option=…:editor-cmd, $EDITOR.

Suggest to say "When invoking the user-defined editor", with or without
listing some of the ways in which the editor command may be specified.

> +interactive conflict resolution, Subversion now performs escaping of any
> +special characters in the pathname of the file to be edited. (See
> +<a href="http://svn.apache.org/r1874057">r1874057</a>,
> +<a href="http://svn.apache.org/r1874093">r1874093</a>, and
> +<a href="http://svn.apache.org/r1875230">r1875230</a>.)</p>
> +
> +<p>Note that escaping is performed only on the pathname argument.
> +<tt>$SVN_EDITOR</tt> itself is not escaped: As before, the editor is invoked
> +through the shell and the user must properly escape/quote
> +<tt>$SVN_EDITOR</tt>. See the related FAQ
> +<a href="https://subversion.apache.org/faq.html#svn-editor">"How do I deal
> +with spaces in the editor path?  Also, how can I define command line options
> +for the editor?"</a></p>

Add full stop after the closing quotation mark?

Add an example?  (An example is worth a thousand words…)

Cheers,

Daniel

> +</div> <!-- editor-filename-escaping -->
> +
>  <div class="h4" id="conflict-resolver">
>  <h4>Improvements to the interactive conflict resolver
>    <a class="sectionlink" href="#conflict-resolver"
> 
> 


Re: svn commit: r1875312 - /subversion/site/publish/docs/release-notes/1.14.html

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Nathan Hartman wrote on Thu, 19 Mar 2020 00:42 +00:00:
> On Wed, Mar 18, 2020 at 8:29 PM Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> > (Or we could change the C code
> > to add the "--" between the editor command and the filename, but that might
> > break somebody's proverbial spacebar heating.)
> 
> I don't think we should do that because an editor that doesn't support
> a "--" option could have problems. I don't see it in nano's manpage on
> my debian box for example.

Well, anyone who uses such an editor would have to write a wrapper
script that removes the "--".

Thanks for r1875404,

Daniel

Re: svn commit: r1875312 - /subversion/site/publish/docs/release-notes/1.14.html

Posted by Nathan Hartman <ha...@gmail.com>.
On Wed, Mar 18, 2020 at 8:29 PM Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> Nathan Hartman wrote on Wed, 18 Mar 2020 23:59 +00:00:
> > <p>For example, suppose that <tt>$SVN_EDITOR</tt> is set as follows:</p>
> >
> > <pre>SVN_EDITOR='vim -N'
> >     export SVN_EDITOR
> > </pre>
>
> Should this read «SVN_EDITOR='vim -N --'»?

Probably. Else, a filename that starts with '-' would cause problems with vim.

But:

> (Or we could change the C code
> to add the "--" between the editor command and the filename, but that might
> break somebody's proverbial spacebar heating.)

I don't think we should do that because an editor that doesn't support
a "--" option could have problems. I don't see it in nano's manpage on
my debian box for example.

Cheers,
Nathan

Re: svn commit: r1875312 - /subversion/site/publish/docs/release-notes/1.14.html

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Nathan Hartman wrote on Wed, 18 Mar 2020 23:59 +00:00:
> On Wed, Mar 18, 2020 at 2:42 PM Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> > Nathan Hartman wrote on Wed, 18 Mar 2020 13:42 -0400:
> > > On Tue, Mar 17, 2020 at 3:50 PM Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> > > > Suggest to say "When invoking the user-defined editor", with or without
> > > > listing some of the ways in which the editor command may be specified.
> > > > Add an example?  (An example is worth a thousand words…)
> > >
> > > Thanks for your suggestions.
> > >
> > > How about something along these lines:
> >
> > Thanks, much better :-)
> >
> > To clarify, what I thought specifically was to give examples of
> > problematic filename and of an editor command that uses shell.  For
> > example, a screenshot:
> >
> > [[[
> > % svn up
> > Updating '.':
> > C    foo bar.txt
> > Updated to revision 2.
> > Summary of conflicts:
> >   Text conflicts: 1
> > Merge conflict discovered in file 'foo bar.txt'.
> > Select: (p) Postpone, (df) Show diff, (e) Edit file, (m) Merge,
> >         (s) Show all options: <b>e</b>
> > ]]]
> >
> > As to an editor command, I guess something as simple as
> > «--editor-cmd='vim -N'» would suffice to get the point across.
> 
> Yes, I think that's a good idea. May I use your "screenshot" as-is?
> 

Certainly.

> Something like this:

+1, LGTM.

> <p>For example, suppose that <tt>$SVN_EDITOR</tt> is set as follows:</p>
> 
> <pre>SVN_EDITOR='vim -N'
>     export SVN_EDITOR
> </pre>

Should this read «SVN_EDITOR='vim -N --'»?  (Or we could change the C code
to add the "--" between the editor command and the filename, but that might
break somebody's proverbial spacebar heating.)

Cheers,

Daniel

Re: svn commit: r1875312 - /subversion/site/publish/docs/release-notes/1.14.html

Posted by Nathan Hartman <ha...@gmail.com>.
On Wed, Mar 18, 2020 at 2:42 PM Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> Nathan Hartman wrote on Wed, 18 Mar 2020 13:42 -0400:
> > On Tue, Mar 17, 2020 at 3:50 PM Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> > > Suggest to say "When invoking the user-defined editor", with or without
> > > listing some of the ways in which the editor command may be specified.
> > > Add an example?  (An example is worth a thousand words…)
> >
> > Thanks for your suggestions.
> >
> > How about something along these lines:
>
> Thanks, much better :-)
>
> To clarify, what I thought specifically was to give examples of
> problematic filename and of an editor command that uses shell.  For
> example, a screenshot:
>
> [[[
> % svn up
> Updating '.':
> C    foo bar.txt
> Updated to revision 2.
> Summary of conflicts:
>   Text conflicts: 1
> Merge conflict discovered in file 'foo bar.txt'.
> Select: (p) Postpone, (df) Show diff, (e) Edit file, (m) Merge,
>         (s) Show all options: <b>e</b>
> ]]]
>
> As to an editor command, I guess something as simple as
> «--editor-cmd='vim -N'» would suffice to get the point across.

Yes, I think that's a good idea. May I use your "screenshot" as-is?

Something like this:

[[[

<div class="h4" id="editor-filename-escaping">
<h4>Escaping/quoting of pathname arguments to the user-defined editor
  <a class="sectionlink" href="#log-search"
     title="Link to this section">&para;</a>
</h4>

<p>When invoking the user-defined editor, such as during interactive conflict
resolution, Subversion now performs escaping of any special characters in the
pathname of the file to be edited. This corrects a problem that would occur
previously when the file to be edited (and/or the path leading to it)
contained spaces or other special characters. (See
<a href="http://svn.apache.org/r1874057">r1874057</a>,
<a href="http://svn.apache.org/r1874093">r1874093</a>, and
<a href="http://svn.apache.org/r1875230">r1875230</a>.)</p>

<p>Note that escaping is performed only on the pathname argument. As before,
the editor itself is invoked through the shell and the user must properly
quote/escape the command line used to launch it. This is intentional, as it
allows the user to construct a shell command which itself contains command
line arguments. See the related
<a href="https://subversion.apache.org/faq.html#svn-editor">FAQ entry</a> for
more on spaces and/or command line options in the editor path.</p>

<p>The user-defined editor can be specified in the following ways, in this
order of precedence:</p>

<ul>
  <li>The <tt>--editor-cmd</tt> command-line option</li>
  <li>The <tt>$SVN_EDITOR</tt> environment variable</li>
  <li>The <tt>editor-cmd</tt> runtime configuration option</li>
  <li>The <tt>$VISUAL</tt> environment variable</li>
  <li>The <tt>$EDITOR</tt> environment variable</li>
</ul>

<p>The escaped pathname of the file to be edited is passed to the editor as
its last command line argument.</p>

<p>For example, suppose that <tt>$SVN_EDITOR</tt> is set as follows:</p>

<pre>SVN_EDITOR='vim -N'
    export SVN_EDITOR
</pre>

<p>Furthermore, suppose 'svn up' finds a text conflict in a file called
<tt>foo bar.txt</tt>:</p>

<pre>
$ svn up
Updating '.':
C    foo bar.txt
Updated to revision 2.
Summary of conflicts:
  Text conflicts: 1
Merge conflict discovered in file 'foo bar.txt'.
Select: (p) Postpone, (df) Show diff, (e) Edit file, (m) Merge,
        (s) Show all options: <b>e</b>
</pre>

<p>When Subversion launches the editor, the space in <tt>vim -N</tt> will
<strong>not</strong> be escaped, allowing vim to be invoked with <tt>-N</tt>
as its first argument, but the space in <tt>foo bar.txt</tt>
<strong>will</strong> be escaped.</p>

</div> <!-- editor-filename-escaping -->

]]]

Cheers,
Nathan

Re: svn commit: r1875312 - /subversion/site/publish/docs/release-notes/1.14.html

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Nathan Hartman wrote on Wed, 18 Mar 2020 13:42 -0400:
> On Tue, Mar 17, 2020 at 3:50 PM Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> > hartmannathan@apache.org wrote on Tue, 17 Mar 2020 18:36 -0000:  
> > > +<p>When invoking the user-defined <tt>$SVN_EDITOR</tt>, such as during  
> >
> > The editor may be configured in other ways: --editor-cmd,
> > --config-option=…:editor-cmd, $EDITOR.
> >
> > Suggest to say "When invoking the user-defined editor", with or without
> > listing some of the ways in which the editor command may be specified.
> > Add an example?  (An example is worth a thousand words…)  
> 
> Thanks for your suggestions.
> 
> How about something along these lines:
> 

Thanks, much better :-)

To clarify, what I thought specifically was to give examples of
problematic filename and of an editor command that uses shell.  For
example, a screenshot:

[[[
% svn up 
Updating '.':
C    foo bar.txt
Updated to revision 2.
Summary of conflicts:
  Text conflicts: 1
Merge conflict discovered in file 'foo bar.txt'.
Select: (p) Postpone, (df) Show diff, (e) Edit file, (m) Merge,
        (s) Show all options: <b>e</b>
]]]

As to an editor command, I guess something as simple as
«--editor-cmd='vim -N'» would suffice to get the point across.

WDYT?

Cheers,

Daniel

Re: svn commit: r1875312 - /subversion/site/publish/docs/release-notes/1.14.html

Posted by Nathan Hartman <ha...@gmail.com>.
On Tue, Mar 17, 2020 at 3:50 PM Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> hartmannathan@apache.org wrote on Tue, 17 Mar 2020 18:36 -0000:
> > +<p>When invoking the user-defined <tt>$SVN_EDITOR</tt>, such as during
>
> The editor may be configured in other ways: --editor-cmd,
> --config-option=…:editor-cmd, $EDITOR.
>
> Suggest to say "When invoking the user-defined editor", with or without
> listing some of the ways in which the editor command may be specified.
> Add an example?  (An example is worth a thousand words…)

Thanks for your suggestions.

How about something along these lines:

[[[

<div class="h4" id="editor-filename-escaping">
<h4>Escaping/quoting of pathname arguments to the user-defined editor
  <a class="sectionlink" href="#log-search"
     title="Link to this section">&para;</a>
</h4>

<p>When invoking the user-defined editor, such as during interactive conflict
resolution, Subversion now performs escaping of any special characters in the
pathname of the file to be edited. This corrects a problem that would occur
previously when the file to be edited (and/or the path leading to it)
contained spaces or other special characters. (See
<a href="http://svn.apache.org/r1874057">r1874057</a>,
<a href="http://svn.apache.org/r1874093">r1874093</a>, and
<a href="http://svn.apache.org/r1875230">r1875230</a>.)</p>

<p>Note that escaping is performed only on the pathname argument. As before,
the editor itself is invoked through the shell and the user must properly
quote/escape the command line used to launch it. This is intentional, as it
allows the user to construct a shell command which itself contains command
line arguments.</p>

<p>The user-defined editor can be specified in the following ways, in this
order of precedence:</p>

<ul>
  <li>The <tt>--editor-cmd</tt> command-line option</li>
  <li>The <tt>$SVN_EDITOR</tt> environment variable</li>
  <li>The <tt>editor-cmd</tt> runtime configuration option</li>
  <li>The <tt>$VISUAL</tt> environment variable</li>
  <li>The <tt>$EDITOR</tt> environment variable</li>
</ul>

<p>The escaped pathname of the file to be edited is passed to the editor as
its last command line argument.</p>

<p>See the related <a href="https://subversion.apache.org/faq.html#svn-editor"
>FAQ entry</a> for more on spaces and/or command line options in the editor
path.</p>

</div> <!-- editor-filename-escaping -->

]]]

Cheers,
Nathan