Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CECP: set feature 'debug' #16

Closed
unserializable opened this issue Feb 16, 2022 · 2 comments
Closed

CECP: set feature 'debug' #16

unserializable opened this issue Feb 16, 2022 · 2 comments
Assignees
Labels
1.0.2 Present in release bundle 1.0.2 bug Something isn't working enhancement New feature or request
Projects

Comments

@unserializable
Copy link
Owner

unserializable commented Feb 16, 2022

Lo and behold, apparently the debug comments output prefixed by '#' should actually be only sent after setting feature `ďebug=1`` -- https://www.gnu.org/software/xboard/engine-intf.html#9

debug (boolean, default 0)
    If debug=1, it means the engine wants to send debug output prefixed by '#', 
which WinBoard should ignore, except for including it in the winboard.debug file. 
As this feature is added to protocol 2 ony late, so that not all protocol-2 supporting
versions of WinBoard might implement it, it is important that engines check if WinBoard
accepts the feature. If the feature is rejected, engines must refrain from sending the
debug output, or do so at their own risk. 

Considering that so far the # debug comments are used whenever running under CECP is recognized, this has been working very well -- bring this in line with the specifications.

From http://hgm.nubati.net/newspecs.html

When an engine sends stuff the GUI does not understand, the result is in principle undefined, but GUI should
make its best attempt to ignore the entire non-compliant line. Valid reasons for not ignoring the line are
that the protocol has been extended to now attach a meaning to the engine utterance, or to treat it as a
different valid command, in order to cater to known engine bugs (like recognizing commands with typos). The
latter is really bad (but alas common) practice: XBoard even takes any line containing the word "Draw" as an
"offer draw" command. When an engine wants to print non-compliant messages (e.g. to aid debugging), it should
better use the debug feature to 'disarm' these message by starting them with '#' to make sure they cannot have
unexpected results. And even this might not protect you when the line contains system error messages like "not
found" or "permission denied"! 

This debug feature originated in 2008, post from July "WB protocol for engine comments" has HGM mentioning this as official mechanism from "WinBoard 4.3.13 on".

@unserializable unserializable added bug Something isn't working enhancement New feature or request labels Feb 16, 2022
@unserializable unserializable self-assigned this Feb 16, 2022
@unserializable unserializable added this to To do in 1.0.2 Feb 16, 2022
@unserializable
Copy link
Owner Author

After adding the debug=1, it can be seen that accepted debug is also sent by Xboard 4.9.1.

$ xboard -debug -debugfile 113-2.debug -fcp ./monchester
$ grep -E "[<>]first" 113-2.debug 
313 >first : xboard
522 <first : # Monchester 1.0.1-24-g97c50f4 ~(4403 kN/s)
522 <first : command : # received xboard
522 <first : feature myname="Monchester 1.0.1-24-g97c50f4" name=1 setboard=1 ping=1 debug=1 edit=0 memory=0 usermove=0 analyze=0 colors=0 sigint=0 sigterm=0 done=1
522 >first : accepted myname
522 >first : accepted name
522 >first : accepted setboard
522 >first : accepted ping
522 >first : accepted debug
522 >first : rejected edit
522 >first : accepted memory
522 >first : accepted usermove
522 >first : accepted analyze
522 >first : accepted colors
522 >first : accepted sigint
522 >first : accepted sigterm
522 >first : accepted done
523 >first : new
524 >first : level 0 1 1
524 >first : post
524 >first : hard
524 >first : ping 1
524 <first : #8:  R N B Q K B N R 
524 <first : #7:  P P P P P P P P 
524 <first : #6:  - - - - - - - - 
524 <first : #5:  - - - - - - - - 
524 <first : #4:  - - - - - - - - 
524 <first : #3:  - - - - - - - - 
524 <first : #2:  p p p p p p p p 
524 <first : #1:  r n b q k b n r 
524 <first : #-------------------
524 <first : #    A B C D E F G H       rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
524 <first : pong 1

@unserializable unserializable moved this from To do to In progress in 1.0.2 Feb 19, 2022
@unserializable
Copy link
Owner Author

Commit considered enough, fine-grained parsing of accepted debug not considered necessary.

@unserializable unserializable moved this from In progress to Done in 1.0.2 Feb 23, 2022
@unserializable unserializable added the 1.0.2 Present in release bundle 1.0.2 label Feb 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0.2 Present in release bundle 1.0.2 bug Something isn't working enhancement New feature or request
Projects
1.0.2
Done
Development

No branches or pull requests

1 participant