On 1/13/2016 1:27 AM, Ross Berteig wrote:

On 1/12/2016 8:28 PM, Andy Bradford wrote:
Thus said Ross Berteig on Tue, 12 Jan 2016 15:53:08 -0800:

   * amend-comment-5.1
   * amend-comment-5.2
   * amend-comment-5.3
   * amend-comment-5.4

These  are  due  to  "ed"  missing  in  your  environment.  Is  there  a
similar tool  that exists  for Windows  that could  be used  to automate
``interactive'' edits to a file? This exercises Fossil's ability to fork
a process  defined in the  EDITOR variable that  edits a file,  and then
save the result as a comment on a commit.

Aha. That makes sense, while I've got lots of random classic Unix tools
laying around on my Windows PC (usually via builds from GnuWin32) it
looks like I have sed but not ed. One easy answer for me is likely to
just go get a ported ed and try that, which will probably just work.

TL;DR: On Windows, after installing GnuWin32's port of ed and making sure that there isn't a global setting for "editor" and that VISUAL is not set in the environment, these cases now pass.


Interesting.

First, I notice that amend.test says

    if {[catch {exec which ed} result]} { .... }

but I didn't see the "Install ed for..." message at all. And now I see why: I wasn't running tester.tcl -verbose, and the block of output included for a failed test by -quiet didn't include either that message or the revised amended comment of "ed required" as a hint.

I installed ed from GnuWin32. Now amend.test takes the other branch and attempts to do f amend --edit-comment. Which opened notepad, not ed. Which seemed more than a little surprising.

I tried this at the command prompt, and fossil again opened NOTEPAD, ignoring the content of the EDITOR variable. Which raises the question, does setting EDITOR actually work on Windows?

Or, as it turns out, is there another reason?

Looking in checkin.c, the function prompt_for_user_comment() first looks for a setting named "editor", then the environment variables "VISUAL" and "EDITOR", then on Windows it explicitly uses notepad and otherwise uses stdin. I checked, and I didn't have either EDITOR or VISUAL already set. Setting VISUAL didn't prevent notepad either.

Turns out that from some bit of paranoia when I first installed fossil on this machine back in the dark ages, I made a global setting for editor.

My advice: don't do that.

After saying fossil unset editor --global, amend.test now passes completely.


Possibly a better answer would be to replace the use of ed with
something private to the test suite and eliminate a dependency on an
external tool. If EDITOR can contain a complex command line, which it
should since "ed -s" is allowed, perhaps a portable way out is to set
EDITOR to "tclsh edlike.tcl" and provide just enough functionality there
for the tests, which could be tweaked to suit.

Even if we do this, which in daylight still seems like a good idea for portability, amend.test probably ought to defend against a global setting for "editor".

--
Ross Berteig                               r...@cheshireeng.com
Cheshire Engineering Corp.           http://www.CheshireEng.com/
+1 626 303 1602
_______________________________________________
fossil-dev mailing list
fossil-dev@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/fossil-dev

Reply via email to