Skip to content

nut-driver-enumerator: preserve and decode ups.conf values once - #3635

Open
user01010111 wants to merge 2 commits into
networkupstools:masterfrom
user01010111:codex/nde-config-values
Open

nut-driver-enumerator: preserve and decode ups.conf values once#3635
user01010111 wants to merge 2 commits into
networkupstools:masterfrom
user01010111:codex/nde-config-values

Conversation

@user01010111

Copy link
Copy Markdown

With nutdrv_qx, port = "auto" # comment currently leaves the media
unclassified. NDE returns the comment as part of the value; its normalization,
section reads and echo calls also strip or reinterpret quotes and
backslashes. Escaped paths can therefore produce different values and
checksums under different shells.

Preserve syntax in normalized configuration text and decode the first value
token once in upsconf_getValue, using POSIX awk (already a dependency).
Double quotes group a token, unquoted hashes start comments, backslash
escapes the next character, and single quotes remain literal. Quoted tokens
can span physical lines; newlines are omitted as in C. Full and
section/driver/port caches now agree on the covered values and media.
Keep existing flag, missing-key and multiple-key output contracts and the
normalized-text checksum format with its final newline. Extend the existing
test script and distributed fixture, correct their known wrong expectations,
and document changed output and possible one-time reconciliation on upgrade.

This is the NDE follow-up to the parsing discussion in #3629. The C parser's
quoted-hash correction is a separate contribution.

Validation:

  • Unmodified upstream 2caa3c87501a1aba25a3070ad66757470bd1bf03
    reproduces unclassified quoted auto and corrupted backslash paths.
    The expanded harness records 66 failed checks across four macOS shells;
    the patched harness has no failures.
  • macOS ARM64: sh, bash, dash and ksh pass. Linux ARM64: sh, bash, dash,
    ksh93 and BusyBox ash pass, including quotes, hashes, backslashes,
    apostrophes, equals, empty/space values, continuations, flags, missing
    and repeated keys, full/SDP agreement, media and stable checksums.
  • BSD awk, gawk, mawk, BusyBox awk and gawk POSIX mode pass.
    All 26 direct comparisons match the separately corrected C parser,
    including the three quoted-hash cases rejected by unmodified C and
    two quoted-multiline cases. The previous NDE patch fails five checks
    against the added multiline regressions; the final patch passes.
  • Linux build, all 12 Automake tests, stylecheck, spellcheck and
    distcheck-light pass. Real manual pages and HTML release/upgrade notes
    are generated. The distribution check builds, tests, installs,
    uninstalls and cleans the extracted archive.
  • The six changed source files match the distribution. Its generated
    NDE and a staged systemd-package installation both pass the five-shell
    Linux harness. macOS build and all eight Automake tests pass after
    allowing the existing test to bind its localhost socket.

No physical UPS hardware was available for testing. Validation covered
NDE self-tests, deterministic parsing and checksum comparisons, direct
C-parser comparisons, and generated/staged software package checks.
Physical UPS models, firmware versions, and hardware combinations were
not tested.

Live systemd/SMF registration was not exercised; all NDE runs used
SERVICE_FRAMEWORK=selftest, temporary configuration and AUTO_START=no.
Legacy Solaris/illumos and other BSD platforms were not executed.

Relevant checklist:

  • Concrete behavior, scope, compatibility and limitations described.
  • Existing template, test harness and distribution wiring used.
  • Added text uses ASCII; the escaped-space fixture intentionally ends in a space.
  • NEWS, UPGRADING and the NDE manual describe the changed behavior.
  • Build, tests, generated/staged packages, spelling/style and distcheck-light pass.
  • AI use and model disclosed.
  • Human contributor review and acceptance of responsibility completed.
  • Human contributor consciously supplies DCO sign-off for this separate contribution.

AI assistance: OpenAI Codex with gpt-6-astra (high reasoning)
and gpt-daybreak-blue-latest (high reasoning).
The human contributor remains responsible for reviewing and submitting
the change.

Preserve quotes and backslashes during ups.conf normalization, then decode
the first value token when queried. Keep full and section caches consistent
for values, media classification and checksums, including quoted multiline
values. Document possible one-time reconciliation after upgrading.

Extend existing self-tests and fixtures. Validated across macOS/Linux
shells and awk implementations, corrected-C comparisons, generated/staged
packages, documentation checks and distcheck-light.

Related: networkupstools#3629

AI assistance: OpenAI Codex with gpt-6-astra (high reasoning)
and gpt-daybreak-blue-latest (high reasoning).
The human contributor remains responsible for reviewing and submitting
the change.

Signed-off-by: user01010111 <12504630+user01010111@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

A ZIP file with standard source tarball and another tarball with pre-built docs for commit cb02364 is temporarily available: NUT-tarballs-PR-3635.zip.

@AppVeyorBot

Copy link
Copy Markdown

Build nut 2.8.5.5261-master completed (commit 22a26b9bba by @user01010111)

@AppVeyorBot

Copy link
Copy Markdown

Use the explicit six C whitespace bytes in the value lexer because
Trusty's mawk 1.3.3 does not implement the named whitespace class.
Preserve the existing C locale, token rules and test expectations.

The existing Trusty runtime tests improve from 133 pass/3 fail to 136/0
under each of sh, bash and dash. A 256-byte oracle, modern shell/awk
checks, build, make check, staged package checks, spelling/style and
complete-manual distcheck-light pass. These runtime checks do not
reconstruct the exact Jenkins image; authenticated Jenkins failure logs
remain unavailable, so this does not claim every CI error is resolved.

Related: networkupstools#3635

AI assistance: OpenAI Codex with gpt-6-astra (high reasoning).
The human contributor remains responsible for reviewing and submitting
the change.

Signed-off-by: user01010111 <12504630+user01010111@users.noreply.github.com>
@AppVeyorBot

Copy link
Copy Markdown

Build nut 2.8.5.5264-master completed (commit 387998b592 by @user01010111)

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.

2 participants