Skip to content

hosts 1.1.0

Latest

Choose a tag to compare

@github-actions github-actions released this 30 Jul 05:10
7d52894

check can now repair what it finds, for the findings where the repair is not a
guess.

Added

  • check --fix repairs five of the eleven rules: duplicate-entry, by removing
    the later line; duplicate-name, by taking the redundant name off the line
    and dropping the line if that leaves it with nothing but an address;
    missing-loopback and missing-loopback6, by adding the entry above the
    first entry the file has, or at the end when it has none; and
    missing-trailing-newline.

    The other six are left alone deliberately, and that line is the feature. An
    address or a name that does not parse cannot be repaired without inventing
    one. conflicting-ip is the one that tempts: two lines send a name to two
    addresses, and which of them is wanted is knowledge the file does not contain.
    control-character is left because stripping bytes out of a line in silence
    would destroy the evidence of what happened to it.

    It is a write like the others: it takes the lock before the read, backs up
    first, honours --dry-run and --no-backup, and asks before touching more
    than one line unless --yes is given. A file with nothing to fix is not
    written to at all. A line the fix did not touch is byte for byte what it was,
    which is the existing guarantee rather than a new one.

  • summary.fixed in the JSON output of check, counting what was repaired,
    and always present so the shape of the document does not depend on the flags.
    The schema version stays at 1: fields are added within a version, and a
    reader should ignore what it does not recognise. --fix with --dry-run is
    refused under --json, because the preview is a diff on standard output and
    would leave the document unparseable.

  • A fuzzing pass over the fix itself: hostile input is fixed, the result is
    still a file the program reads, and fixing it a second time changes nothing.

  • A recorded demonstration, in the README and at the top of the documentation
    site: an add, two rm and the ls between each. demo/session.sh runs the
    commands it prints, against a scratch file rather than /etc/hosts so that
    recording needs no privilege, and demo/record.sh turns it into
    docs/demo.gif. Keeping the recipe in the repository means the picture can be
    regenerated when output changes instead of quietly going stale.

Changed

  • After a fix the file is read and scanned again rather than the earlier
    findings being renumbered onto it. Removing lines moves everything below them,
    so a leftover finding would otherwise have been reported against a line that
    is now something else, and a message naming another line would have named the
    wrong one. Scanning again makes every number and message right by
    construction, and reports anything a fix itself introduced.

  • The documentation site leads with what the program is for. It gained an
    opening statement, the demonstration, the apt command with a button that
    copies it, and a navigation bar that follows the page and links to the
    sections, in place of three links to other pages. The stylesheet is still one
    hand-written file with no external asset and no font loaded from anywhere
    else. Every documented section is unchanged.

  • The workflows use actions that run on Node 24. The ones in use targeted Node
    20, which the runners have deprecated and were forcing onto 24 anyway: they
    worked, and one day they would not have. checkout went to v7 and the two
    Pages actions to v5, further along than expected, so the versions were
    looked up and the moving major tags checked rather than guessed at.

Fixed

  • The navigation bar of the documentation site stays on screen. It was the last
    child of the header, and a sticky element is confined to its containing block,
    so it came unstuck the moment the header scrolled past.

  • Every released version is installable from the apt repository, not only the
    most recent one. dpkg-scanpackages reports one version per package unless
    told otherwise, so earlier .deb files were being published and then left
    out of the index: present but not installable, which is not what "the index
    is rebuilt from every release" was meant to mean.