Skip to content

Non-ASCII single -O drops hts-log.txt into a mangled twin directory on Windows#636

Merged
xroche merged 3 commits into
masterfrom
fix-630-pathlog-utf8
Jul 18, 2026
Merged

Non-ASCII single -O drops hts-log.txt into a mangled twin directory on Windows#636
xroche merged 3 commits into
masterfrom
fix-630-pathlog-utf8

Conversation

@xroche

@xroche xroche commented Jul 18, 2026

Copy link
Copy Markdown
Owner

A single -O sets both path_html and path_log, so httrack -O café url sends the logs through path_log too. argv is UTF-8, so path_log holds UTF-8 bytes, but the two-file log branch in hts_main_internal() still created its directory and opened hts-log.txt/hts-err.txt through the ANSI structcheck()/fopen(). On Windows those read the bytes as the codepage and dropped the logs into a second, mangled caf<mojibake>/ directory beside the mirror. This routes that branch through the same UTF-8 wrappers #628 used for the mirror root (structcheck_utf8/FOPEN/UNLINK/fexist_utf8), so the logs land under café/ with the mirror. On a UTF-8 filesystem the wrappers resolve to the same calls, so only Windows changes.

This is the log half of #630. I left the cache half out on purpose: relocating hts-cache is a much larger, coupled change, because the cache is written through minizip's own ANSI fopen and cleaned up through an ANSI opendir, so half-converting it would split or break the cache rather than move it. That wants its own PR, and #630 should stay open for it.

Test 69 mirrors into a single non-ASCII -O and asserts the audits read hts-log.txt from that directory. Like test 64 it only bites on the Windows CI leg, where the two encodings differ; on Linux the change is a no-op and the whole suite stays green.

xroche and others added 3 commits July 18, 2026 07:36
… keeps hts-log.txt out of a mangled twin

A single -O sets both path_html and path_log (htscoremain.c:411), so
`httrack -O café url` sends the logs through path_log. Since argv is UTF-8,
path_log holds UTF-8 bytes, but the two-file log branch created its directory
and opened hts-log.txt/hts-err.txt with the ANSI structcheck()/fopen(), which on
Windows read those bytes as the codepage and dropped the logs into a second,
mangled caf<mojibake>/ directory next to the mirror. #628 fixed the same class
for the mirror root; this routes the log block through structcheck_utf8()/FOPEN()
/UNLINK()/fexist_utf8() so the logs land under café/ with the mirror. On a UTF-8
filesystem the wrappers are the same calls, so only Windows changes.

The cache half of #630 (hts-cache still opened ANSI, via minizip's own fopen and
an ANSI opendir) is a larger, separate conversion and is left for a follow-up.

A local-crawl test mirrors into a single non-ASCII -O and asserts the audits
read hts-log.txt from that directory; it bites on the Windows CI leg where the
encoding differs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
Resolve tests/Makefile.am: keep 66_engine-port80-strip (#632) alongside this
branch's test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
Resolve tests/Makefile.am: keep 66 (#632), 67 (#633) and this branch's 69.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
@xroche
xroche merged commit dbad05f into master Jul 18, 2026
21 checks passed
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 this pull request may close these issues.

1 participant