fix(boot,make): the HTTPS banner lied, and HTTPS_HOST could silently no-op (#128) - #129
Merged
Merged
Conversation
…no-op (#128) "Wikipedia build still connects to foo.bar" had two independent causes. Neither is a bad hostname, and the connection was correct throughout — http_host_target drives both the SNI copy and net_dns_resolve, and always did. 1. THE BANNER WAS A HARDCODED LITERAL. do_https_get printed "HTTPS GET WWW.FOO.BAR..." unconditionally, so a `make HTTPS_HOST=en.wikipedia.org` build announced foo.bar on screen while fetching wikipedia perfectly well. The only thing an operator can see said the build knob had done nothing. It now prints the real host, assembled at runtime from http_host_target and fed through ascii_chrout — the host is ASCII, and raw ASCII lowercase renders as PETSCII graphics in the default charset (issue #28), which would have turned "en.wikipedia.org" into line noise. 2. `make HTTPS_HOST=<other>` COULD DO NOTHING AND EXIT 0. macOS ships GNU Make 3.81, which compares mtimes at 1-second resolution, so a boot.o rebuilt in the same second as the previous link is not newer than the PRG and the link is SKIPPED. Measured: `make` then `make HTTPS_HOST=en.wikipedia.org` back-to-back printed nothing, exited 0, and left a PRG still carrying the old host. This flag is documented as not needing `make clean`, so it has to be right without one. Two fixes were tried and measured before the third worked: - delete boot.o only (the old rule): link skipped, stale PRG. The bug. - delete boot.o AND the PRG from inside the recipe: WORSE. make stats its targets before that recipe runs and caches the result, so it used the cached "exists, same second" view, skipped the link anyway, and left NO PRG at all — still exit 0. - compare-and-invalidate at Makefile PARSE time, which runs before make builds its file database. Absence is not a timestamp comparison; that is the whole point. The Makefile's own comment here already recorded the same-second relink as a known, accepted caveat ("check the PRG hash when a build matters") and noted that deleting $(PRG) in the recipe does not fix it. That prose is retired for this flag. It still stands for BACKEND= and the other flags, which have no equivalent hook — `make clean` remains the remedy there. Also in this change: - $(PRG)'s recipe removes its target before linking. ld65 writes nothing when a memory area overflows, so a failed link left the PREVIOUS image on disk while every rig loads build/c64-https.prg by path (tools/uci/rig_https_wiki.py:135) — the operator runs a stale image and reports "the knob did nothing" instead of "the build failed". .DELETE_ON_ERROR does NOT cover this and was tried first: it deletes a target only if the recipe CHANGED it, and here the file is never touched. Verified both ways. .DELETE_ON_ERROR is kept for the partial-write case it does cover, with an honest comment about what it does not. - That explanation lives ABOVE the rule, not in the recipe body: make echoes recipe comment lines into every build's stdout, and prose containing the word "overflows" is exactly what scripts grep build output for. The first draft produced a five-profile false FAIL in my own harness. Verification: - Same-second host switch, no `make clean`: 3/3 runs produce a PRG carrying en.wikipedia.org with no foo.bar left in it; switching back is also clean; an unchanged-flags `make` still runs zero compile/link commands. - All five profiles build the reporter's command with the real host in the image (byte-checked, not just linked). - A deliberately overflowing link now leaves no PRG at all. - tools/test_http.py in VICE: 66/66 uci, 61/61 ip65. tools/test_tls_handshake.py 21/21. Bare pytest: 31 passed. Not covered: no hardware run, so the on-screen banner is verified by byte inspection of the image and by the primitives it reuses (print_string + ascii_chrout, the issue #28 path), not by reading a real C64 screen. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Aug 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #128.
"Wikipedia build still connects to foo.bar" turned out to have two independent causes, and neither is a bad hostname. The connection was correct throughout —
http_host_targetdrives both the SNI copy andnet_dns_resolve, and always did.1. The banner was a hardcoded literal
do_https_getprinted"HTTPS GET WWW.FOO.BAR..."unconditionally. So amake HTTPS_HOST=en.wikipedia.orgbuild announced foo.bar on screen while fetching wikipedia perfectly well — and the only thing an operator can see said the knob had done nothing.It now prints the real host, assembled at runtime from
http_host_targetand fed throughascii_chrout(the host is ASCII, and raw ASCII lowercase renders as PETSCII graphics in the default charset — issue #28 — which would turnen.wikipedia.orginto line noise).2.
make HTTPS_HOST=<other>could do nothing and exit 0macOS ships GNU Make 3.81, which compares mtimes at 1-second resolution. A
boot.orebuilt in the same second as the previous link is not "newer" than the PRG, so the link is skipped. Measured:makethenmake HTTPS_HOST=en.wikipedia.orgback-to-back printed nothing, exited 0, and left a PRG still carrying the old host.This flag is documented as not needing
make clean, so it has to be right without one. Three shapes, all measured:boot.oonly (the old rule)boot.o+ PRG inside the recipeThe Makefile's own comment already recorded the same-second relink as a known, accepted caveat ("check the PRG hash when a build matters") and noted that deleting
$(PRG)in the recipe does not fix it. That prose is now retired for this flag. It still stands forBACKEND=and the others, which have no equivalent hook —make cleanremains the remedy there.Also in this change
$(PRG)'s recipe removes its target before linking. ld65 writes nothing when a memory area overflows, so a failed link left the previous image on disk — and every rig loadsbuild/c64-https.prgby path (rig_https_wiki.py:135). The operator then runs a stale image and reports "the knob did nothing" instead of "the build failed"..DELETE_ON_ERRORdoes not cover this and was tried first: it deletes a target only if the recipe changed it, and here the file is never touched. It's kept for the partial-write case it does cover, with an honest comment about what it doesn't.Verification
make clean: 3/3 runs produce a PRG carryingen.wikipedia.orgwith nofoo.barleft in it. Switching back is clean, and an unchanged-flagsmakestill runs zero compile/link commands.tools/test_http.pyin VICE: 66/66 uci, 61/61 ip65.tools/test_tls_handshake.py: 21/21. Barepytest: 31 passed.Not covered: no hardware run. The on-screen banner is verified by byte inspection of the image and by the primitives it reuses (
print_string+ascii_chrout, the issue #28 path), not by reading a real C64 screen.🤖 Generated with Claude Code