Plan 9 from Bell Labs’s /usr/web/sources/contrib/mospak/abaco-modern/README

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


abaco-modern: patches modernizing the 9legacy abaco browser

Ten patches that bring the 9legacy abaco(1) web browser to a more
usable state on the modern web, without rewriting it.  The patches
fix NOTES-listed bugs in text selection and double-clicking, wire
up html(2) parser fields abaco ignored, flip the default character
set to UTF-8, enable webfs cookie storage so logged-in sites work,
mark failed fetches distinctly from in-flight ones in the status
area, and guard getbase against the relative-BASE-href crash.

The set is intentionally narrow: no new subsystems, no parser
replacement, no reflow layer.  Everything builds on what abaco and
libhtml already ship.

CHANGES
    v1 — 2026-04-24 (initial)
        abaco-html2-wiring                Wire html(2) fields
                                          parsehtml already fills
                                          but abaco ignores: hr
                                          attrs, image placeholders,
                                          select defaults, maxlength,
                                          form-field percent-encoding,
                                          fragment anchors, link
                                          titles in status, hanging
                                          list indent, row
                                          backgrounds, cell valign,
                                          table captions, image
                                          maps, frame borders/margins,
                                          meta refresh.
        abaco-doubleclick-typo            text.c:727 one-char fix in
                                          textclickmatch call; fixes
                                          bracket/quote matching.
        abaco-pagedoubleclick-guard       page.c:595 nil guard on
                                          l->next; fixes crash on
                                          double-click past the last
                                          line of the last page.
        abaco-pageselect-ordering         page.c:541 same-line drag
                                          ordering via linewhich;
                                          fixes "complement selection"
                                          under 1-2 px mouse-Y wobble.
        abaco-wind-dangling-edit          wind.c:39 delete copy-paste
                                          leftover fragment.  No
                                          behaviour change.
        abaco-util-strcpy-bound           util.c:956 strcpy → snprint;
                                          defensive tightening
                                          against oversized -t flag.
        abaco-charset-utf8-default        main.c:38 default fallback
                                          charset flipped iso-8859-1
                                          → utf-8.  -t flag still
                                          overrides.
        abaco-cookies-enable              urls.c:93 enable webfs's
                                          sendcookies/acceptcookies
                                          per connection so RFC 6265
                                          cookie jar works.
        abaco-error-surface-prefix        page.c:276,296 prefix
                                          failure-path messages with
                                          "error: " to distinguish
                                          from in-flight status.

    v2 — 2026-04-25
        abaco-base-href-guard             util.c:366 validurl-guard
                                          p->doc->base in getbase;
                                          falls through to the page
                                          URL when BASE href is
                                          relative or nil.  Stops
                                          crash on pages that set
                                          <BASE HREF="/foo">
                                          (libhtml's aurlval stores
                                          the relative value
                                          unresolved; the proper
                                          fix is in libhtml).

Scope limits
    - Bug fixes and low-risk wiring only.  No new rendering
      subsystems.  No CSS support (beyond what html(2) already
      parses), no JavaScript, no reflow.  abaco's single-pass
      Lay / Box / Line layout is preserved.
    - Modern HTTPS interop is delegated to the tls-modern-client
      patch series.  These abaco patches assume tls-modern-client
      is already applied if HTTPS is a requirement.
    - No change to webfs, libsec, or the /mnt/web file interface.
      abaco-cookies-enable uses webfs's existing cookie machinery;
      it does not add a new ABI.

Files
    abaco-html2-wiring.patch          html(2) field wiring
    abaco-doubleclick-typo.patch      text.c bracket/quote typo
    abaco-pagedoubleclick-guard.patch page.c nil-deref guard
    abaco-pageselect-ordering.patch   page.c same-line ordering
    abaco-wind-dangling-edit.patch    wind.c cleanup
    abaco-util-strcpy-bound.patch     util.c strcpy bound
    abaco-charset-utf8-default.patch  main.c utf-8 default
    abaco-cookies-enable.patch        urls.c webfs cookie flags
    abaco-error-surface-prefix.patch  page.c error: prefix
    abaco-base-href-guard.patch       util.c relative-BASE guard
    test/abaco-html4-tests/           HTML 4 test page set
    test/TESTING.md                   test procedure
    test/EXPLANATIONS.md              per-page explanations

Apply order
    The patches are independent (order does not affect result) but
    presented in the order above for readability.  Inside the VM,
    from /:

        cd /
        patches=(abaco-html2-wiring abaco-doubleclick-typo \
            abaco-pagedoubleclick-guard abaco-pageselect-ordering \
            abaco-wind-dangling-edit abaco-util-strcpy-bound \
            abaco-charset-utf8-default abaco-cookies-enable \
            abaco-error-surface-prefix abaco-base-href-guard)
        for(p in $patches)
            ape/patch -p0 < /path/to/abaco-modern/$p.patch

Rebuild
    Patches touch sys/src/cmd/abaco/{html.c, main.c, page.c, tabs.c,
    text.c, urls.c, util.c, wind.c, NOTES} only.  No libhtml change,
    no kernel change, no reboot.

        cd /sys/src/cmd/abaco && mk clean && mk install

    New /$cputype/bin/abaco; run it.

Prerequisites
    A 9legacy CD / source tree (the canonical 9legacy.iso or an
    install therefrom) has everything needed.  Sanity-check:

        test -d /sys/src/cmd/abaco        # abaco source present
        test -d /sys/src/libhtml          # libhtml source present

    For HTTPS interop, apply tls-modern-client first (see
    contrib/tls-modern-client/ and <https://9p.io/sources/contrib/
    mospak/tls-modern-client/>).  These abaco patches do not depend
    on tls-modern-client for HTTP pages; HTTPS is only relevant for
    the subset of test pages served over TLS.

Verification
    test/abaco-html4-tests/ ships a 12-page HTML 4 test set
    exercising the html(2) wiring patch.  See test/TESTING.md for
    the before/after procedure.

    For the bugfix patches (doubleclick-typo, pagedoubleclick-guard,
    pageselect-ordering) interactive testing in rio is the acceptance
    gate — described per-patch in each patch header.

    Real-hardware smoke suggestions:

        abaco http://example.com/        trivial baseline
        abaco http://9legacy.org/        plain-HTML site
        abaco https://9legacy.org/       HTTPS (needs tls-modern-client)

Rollback
    Reverse order, -R flag:

        cd /
        rpatches=(abaco-base-href-guard abaco-error-surface-prefix \
            abaco-cookies-enable abaco-charset-utf8-default \
            abaco-util-strcpy-bound abaco-wind-dangling-edit \
            abaco-pageselect-ordering abaco-pagedoubleclick-guard \
            abaco-doubleclick-typo abaco-html2-wiring)
        for(p in $rpatches)
            ape/patch -R -p0 < /path/to/abaco-modern/$p.patch

    Then rebuild libhtml and abaco as above.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.