diff options
| author | Scott Gasch <[email protected]> | 2026-08-27 07:41:41 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2026-08-27 07:42:25 -0700 |
| commit | 4ce6a76b0946e4ba943d29c506c9e2fb00601efd (patch) | |
| tree | b072c6fe2a5e8527a28f5c821d76591e93fa86f6 /src/util.c | |
| parent | 7857096f39e16619a42ee85b4aa593abd846b74a (diff) | |
Baseline: uPositional data-calibrated fix, enprise/trapped hints, EBF/beta-cutoff/counter-move stats, script.c FPE fix.
No LMR, no counter-move-driven move ordering (both explored separately,
kept out for now -- counter-move measured worse, ~655->647 solved on
ecm879 @ sn=4M with a leaner tree beforehand). Futility pruning restored.
Verified: 647/879 solved, EBF 4.609 @ sn=4M; 684/879 solved, EBF 3.995
@ 20s/move, 1cpu, 256m hash (typhoon_baseline.log).
The counter-move table is still written and its stats still tracked
(dynamic.c) for diagnostic purposes, but generate.c no longer reads it
for move ordering, so it has no effect on search behavior in this
commit.
lmr_testing/ holds the in-flight graded-LMR + counter-move code (not
applied here) with notes on what was already tried and measured, so a
future session can resume without re-deriving it.
Diffstat (limited to 'src/util.c')
| -rwxr-xr-x | src/util.c | 35 |
1 files changed, 24 insertions, 11 deletions
@@ -891,7 +891,13 @@ BackupFile(CHAR *szFile) Routine description: Backup a file to file.000. If file.000 already exists, back it up - to file.001 etc... + to file.001 etc... szFile may include a directory path; the + numeric prefix is inserted before the basename, not the whole + path (a bare "%03u%s" prepend onto a full path like + "/usr/local/tmp/typhoon.log" produces the bogus relative path + "000/usr/local/tmp/typhoon.log", whose "000" directory component + doesn't exist -- that's what used to make this silently fail + whenever the logfile path had a directory in it). Note: this function is recursive and can require quite a lot of stack space. Also it is full of race conditions and should not be @@ -911,25 +917,32 @@ Return value: ULONG u; CHAR buf[SMALL_STRING_LEN_CHAR]; CHAR *p; + CHAR *szBase; + ULONG uDirLen; if (TRUE == SystemDoesFileExist(szFile)) { - if ((strlen(szFile) > 3) && - (isdigit(szFile[0])) && - (isdigit(szFile[1])) && - (isdigit(szFile[2]))) + szBase = strrchr(szFile, '/'); + szBase = (NULL != szBase) ? (szBase + 1) : szFile; + uDirLen = (ULONG)(szBase - szFile); + + if ((strlen(szBase) > 3) && + (isdigit(szBase[0])) && + (isdigit(szBase[1])) && + (isdigit(szBase[2]))) { - u = (szFile[0] - '0') * 100; - u += (szFile[1] - '0') * 10; - u += szFile[2] - '0' + 1; - p = &(szFile[3]); + u = (szBase[0] - '0') * 100; + u += (szBase[1] - '0') * 10; + u += szBase[2] - '0' + 1; + p = &(szBase[3]); } else { u = 0; - p = szFile; + p = szBase; } - snprintf(buf, ARRAY_LENGTH(buf), "%03u%s", u, p); + snprintf(buf, ARRAY_LENGTH(buf), "%.*s%03u%s", + (int)uDirLen, szFile, u, p); if (TRUE == SystemDoesFileExist(buf)) { BackupFile(buf); |
