New XBoard alpha version. Please test!

Discussion of chess software programming and technical issues.

Moderator: Ras

Michel
Posts: 2292
Joined: Mon Sep 29, 2008 1:50 am

Re: New XBoard alpha version. Please test!

Post by Michel »

No sorry.

I am working on 1.54b with has a few enhancements. I particular it tries to detect if an engine has crashed and allows engine names with spaces. I will finish it tomorrow. Linux only for the moment since I had a harddisk crash and my windows development environment is gone. I have to create a new windows setup.
Michel
Posts: 2292
Joined: Mon Sep 29, 2008 1:50 am

Re: New XBoard alpha version. Please test!

Post by Michel »

ust a not-found message, which is taken by XBoard as a fatal-error message.
Yes this was my attempt at showing that the code for changing the xboard fatal error message with a user generated one already exists.

In my next version I have taking this hack out and replaced it with appropriate tellusererror messages.

It doesn't matter as long as I can get rid of the dreaded "polyglot exited unexpectedly" messages :D
User avatar
hgm
Posts: 28433
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: New XBoard alpha version. Please test!

Post by hgm »

Well, note that in reaction to our previous discussion I changed the engine-invoking code in XBoard to:

Code: Select all

    p = buf;
    for (;;) {
        while(*p == ' ') p++;
        if (p == NULL) break;
        argv[i++] = p;
        if(*p == '"' || *p == '\'')
             p = strchr(++argv[i-1], *p);
        else p = strchr(p, ' ');
        if (p == NULL) break;
        *p++ = NULLCHAR;
    }
This should allow XBoard to handle a limited form of quoting, where escaping quotes within a quoted argument is not possible. But because there are two kinds of quotes, using one kind within the other is. And as a side effect it will now consider stretches of spaces as a single argument delimiter, rather than inserting NULL arguments.

This would allow us to use the adapter command

Code: Select all

polyglot -noini -ec "%%cp" -ed "%%d"
where the argument to -ec will then be passed as a single argv[] element. And it will be possible to pass

Code: Select all

xboard -fcp "'super engine' --io-mode uci" -fUCI
This will translate on expansion to

Code: Select all

polyglot -noini -ec "'super engine' --io-mode uci" -ed "."
and be chopped up by XBoard as

Code: Select all

polyglot
-noini
-ec
'super engine' --io-mode uci'
-ed
.
so that Polyglot only has to handle the quotes around 'super engine' to realize it should chop up the engine command line as

Code: Select all

super engine
--io-mode
uci
before passing it to execv.

The said changes are all for the development version of XBoard; the upcoming 4.4.2 will still use the old system of polyglot_1st.ini files. According to our new release policy we only include bug fixes in the 4.4.x series, and no patches aimed at changing the behavior. The latter will only be applied to the development branch, which eventually will fork off a 4.5.x branch when it conatins a large-enough stable core of novelties. The changes we are discussing now are all for the 4.5.x branch.

(Btw, I am considering changing the syntax of the adapter command to do away with the double %, and simply write

Code: Select all

polyglot -noini -ec "%fcp" -ed "%fd"
for easier understanding, and make the substitution of a leading "first" or "f" by "second" or "s" on any option name not starting with "font" or "flip" for the second engine automatic. But that won't affect Polyglot, of course. It is just to make life a little easier for people that would want to change the engine command.)
Michel
Posts: 2292
Joined: Mon Sep 29, 2008 1:50 am

Re: New XBoard alpha version. Please test!

Post by Michel »

Thanks for the change in the quoting mechanism. :-)

With PG 1.4.54b and the latest xboard it is now possible to use engine commands with spaces in them. E.g.

xboard -fcp '"./Rybka\ v2.2n2.mp.w32.exe"' -fUCI

Explanation:

The shell strips off the outer single quotes from the -fcp argument and passes
"./Rybka\ v2.2n2.mp.w32.exe" to xboard.

xboard (emulating a shell) strips off the remaining double quotes and invokes polyglot as follows

argv[0] polyglot
argv[1] -noini
argv[2] -ec
argv[3] ./Rybka\ v2.2n2.mp.w32.exe

Polyglot passes the EngineCommand ./Rybka\ v2.2n2.mp.w32.exe to wordexp
(which handles shell quoting and expansion) which replaces it by ./Rybka v2.2n2.mp.w32.exe

Finally polyglot executes execvp with parameters

argv[0] ./Rybka v2.2n2.mp.w32.exe

(execvp invokes wine of course but that is another story).
User avatar
hgm
Posts: 28433
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: New XBoard alpha version. Please test!

Post by hgm »

OK, so through wordexp Polyglot will fully handle all kinds of quoting and escaping. Not that I will set the default adapter command to already contain quoting around the -fcp and -fd arguments (just like in WinBoard):

Code: Select all

polyglot -noini -ec "%fcp" -ed "%fd"
,

so that you actually will not have to use the nested quoting on the -fcp argument on the XBoard command line: the double quotes will be added automatically.
User avatar
hgm
Posts: 28433
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: New XBoard alpha version. Please test!

Post by hgm »

Michel wrote:Ok. The current situation is really bad.

It is really a trivial thing to implement. The object representing the engine should get a new member "telluser_error_seen" which should be set after a tellusererror and reset after any other type of input.

When xboard encounters a fatal error it should suppress its usual fatal error dialog boxes when the flag telluser_error_seen is true for that engine.

I would still prefer it if there was some dedicated way for an engine to report a fatal error, but at least the above approach would make the user experience better.
Hmm, it is not that simple. If I suppress all fatal-error popups, XBoard does not exit either. We want it to exit when the user closes the error popup.

A second complication is that during automatic testing, you do not want WinBoard to wait for a user action before it quits. This would hang the tournament. There is an option -popupExitMessage that controls if WinBoard should wait for a box to be closed. The behavior of DisplayFatalError depends on that, and the matter if we take an immediate exit or wait for the user to close the tellusererror popup must also depend on it.
Last edited by hgm on Mon Nov 30, 2009 8:48 pm, edited 1 time in total.
Michel
Posts: 2292
Joined: Mon Sep 29, 2008 1:50 am

Re: New XBoard alpha version. Please test!

Post by Michel »

Hmm, it is not that simple. If I suppress all fatal-error popups, XBoard does not exit either. We want it to exit when the user closes the error popup.
Well there is the tellusererror popup which has to be closed....
User avatar
hgm
Posts: 28433
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: New XBoard alpha version. Please test!

Post by hgm »

OK, the version now at http://home.hccnet.nl/h.g.muller/xboard ... 2_i386.deb might do what you want. It is still advisable do have a little delay between sending the tellusererror and actually quitting, or the broken-pipe popup might actually occur before the tellusererror command is processed.
Michel
Posts: 2292
Joined: Mon Sep 29, 2008 1:50 am

Re: New XBoard alpha version. Please test!

Post by Michel »

I tested it and it seems to work fine. Thanks a lot :D. The broken pipes error message
still appears sometimes (as you predicted) but it is now below the tellusererror dialog
which is not really a problem.

I did not try inserting a delay yet since I don't know how long the delay should be and it probably depends on the computer. I will try with one or two tenth's of a second. Longer would probably not be desirable.
User avatar
hgm
Posts: 28433
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: New XBoard alpha version. Please test!

Post by hgm »

I think the broken-pipe message is given when a write to the engine fails. So it depends on if XBoard is still writing. After writing "protover 2" it should start waiting for input. So perhaps when you wait doing anything untill you have at least seen the "protover 2", even when it is already clear from the command line that you are doomed, it might be possible to avoid the message without any delay.

Problem is that v1 interfaces would never send you the "protover 2". So perhaps it would be better to wait for "xboard", knowing that v2 interfaces send them practically at the same time. (XBoard does it with the same write call, actually.)