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

"setoption name debug log file value" does not close previous debug log file #3650

Closed
jomega-github opened this issue Aug 11, 2021 · 0 comments

Comments

@jomega-github
Copy link

Windows 10

Running stockfish in a command window and issuing the command
setoption name debug log file value c:\users\jomeg\sf.log
correctly starts a debug log to that file. However, I'd expect the command
setoption name debug log file value
to close the file. I expect that because it seems the intension of the uci doc and the code at
misc.cpp#126 which is the code to close the file.

However, the file never closes, and you cannot open another file with the setoption command either.
I know it does not close because any attempt to delete it fails (until stockfish is exited).

I believe the problem is in ucioption.cpp#167, which is...

if ( (type != "button" && v.empty())
|| (type == "check" && v != "true" && v != "false")
|| (type == "spin" && (stof(v) < min || stof(v) > max)))
return *this;

Since the type of this option is "string" and the value of v is indeed empty (verified by single stepping in a debugger)
the return happens immediately and hence the on_change() function does not get called, and hence the code
misc.cpp#126 to trigger closing the file never happens.

jomega-github added a commit to jomega-github/Stockfish that referenced this issue Aug 13, 2021
Fix issue official-stockfish#3650 "setoption name debug log file value" does not close previous debug log file.
Joachim26 pushed a commit to Joachim26/StockfishNPS that referenced this issue Mar 28, 2023
Fix handling of empty strings in uci options and reassigning of the log file

Fixes official-stockfish#3650

Closes official-stockfish#3655

No functional change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant