Skip to content

nut-scanner: one load verdict per library at the default debug level - #3739

Merged
jimklimov merged 1 commit into
networkupstools:masterfrom
com6056:nut-scanner-load-report
Oct 14, 2026
Merged

jimklimov merged 1 commit into
networkupstools:masterfrom
com6056:nut-scanner-load-report

Conversation

@com6056

@com6056 com6056 commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #3654, as discussed there. Each nutscan_load_*_library() logs a line like Cannot load XML library (libneon.so.27) : file not found. XML search disabled. at debug level 0 for every name it tries, so since #3654 a missing library prints one line per candidate, and a library that loads on a later name still prints lines saying its search was disabled.

This moves those lines, and the loaders' library not found lines, to debug level 1 without the search disabled suffix, and nutscan_init() now prints one level-0 line per library that could not be loaded at all. A library that loads keeps its existing level-1 message, so a normal run prints nothing new. The flags in the loaders are untouched. A direct caller of the exported loaders (there are none in-tree) now only gets the level-1 lines.

Tested on Alpine edge, counting the library load lines nut-scanner -a prints at the default debug level:

Layout master this branch
Libraries in place, or renamed with the SONAME link kept 0 0
Only the versioned files, in a directory on the run-time linker path 3 0
libneon removed 5 1

The one line in the last case is Cannot load LibNeon, XML search disabled., and NUT_DEBUG_LEVEL=1 still shows every name tried and why it failed. make check and make spellcheck pass.

tests/NIT/nit.sh skips its nut-scanner check by matching the old per-name line, so I pointed it at the new summary line. I checked the pattern against real scanner output but did not run NIT itself.

I went with one static helper in nutscan-init.c rather than the per-library nutscan_report_*_library() ones from the thread, since the verdict needs no reason from the loader and the per-name text stays in each scan_*.c. Happy to switch if you'd rather have the helpers!

Disclosure per the template, this was written with Claude Code (Anthropic) using Claude Opus 5.5, with review passes from Claude Opus 5.5 and Claude Fable 5.1 subagents. I reviewed all of it.

General points

  • Described the changes in the PR submission or a separate issue, e.g.
    known published or discovered protocols, applicable hardware (expected
    compatible and actually tested/developed against), limitations, etc.

  • There may be multiple commits in the PR, aligned and commented with
    a functional change. Notably, coding style changes better belong in a
    separate PR, but certainly in a dedicated commit to simplify reviews
    of "real" changes in the other commits. Similarly for typo fixes in
    comments or text documents.

  • Use of coding helper tools and AI should be disclosed in the commit
    or PR comments (it is interesting to know which ones do a decent job).
    As with other contributions, a human is responsible and thanked for the
    quality and content of the change, and is presumed to have the right to
    post that code to be published further under the project's license terms.

  • Especially with involvement of AI, including modern IDE coding aid,
    please be sure to revise that proposed code and documentation changes
    follow NUT code style guide -- this helps portability across the decades
    worth of supported systems. Notably, avoid Unicode characters where ASCII
    text is expected (C sources and headers, manual pages and other acsiidoc
    inputs). Particularly AI is keen on adding mdash characters instead of
    plain ASCII double-dash (which renders into the long dash where applicable).

Frequent "underwater rocks" for general C code PRs

  • Coding style (including whitespace for indentations) follows precedent
    in the code of the file, and examples/guide in docs/developers.txt file.

General documentation updates

  • Added a bullet point into NEWS.adoc, possibly also UPGRADING.adoc
    if there is something packagers or custom-build users should take into
    account (new driver categories, configuration options, dependencies...)

  • Passed make spellcheck, updated spell-checking dictionary in the
    docs/nut.dict file if needed (did not remove any words -- the make
    rule printout in case of changes suggests how to maintain it).

…etworkupstools#3654]

Each nutscan_load_*_library() printed "Cannot load X library (name) :
reason. X search disabled." at debug level 0 for every failed attempt.
Now that nutscan_init() really tries each candidate name in turn, that
made a missing library print one line per name, and a library that
loads on a later name still claimed its search was disabled.

Move the per-attempt messages, and the loaders' "library not found"
messages, to debug level 1, where the name tried and the reason stay
available, and drop their "X search disabled" suffix since the scan
goes on to the next name. nutscan_init() now prints a single line per
library that could not be loaded at all. A library that loads keeps its
existing debug level 1 message, so a normal run prints nothing new.

tests/NIT/nit.sh excused a missing libupsclient by matching the old
per-attempt wording, so point that pattern at the new summary line.

Signed-off-by: Jordan Rodgers <com6056@gmail.com>
@com6056
com6056 force-pushed the nut-scanner-load-report branch from 6abcca7 to 02381c3 Compare October 10, 2026 21:21
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

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

@AppVeyorBot

Copy link
Copy Markdown

✅ Build nut 2.8.5.5630-master completed (commit 987da8705c by @com6056)

@AppVeyorBot

Copy link
Copy Markdown

✅ Build nut 2.8.5.5631-master completed (commit 6bf8522d21 by @com6056)

@jimklimov jimklimov added enhancement nut-scanner portability We want NUT to build and run everywhere possible labels Oct 14, 2026
@jimklimov jimklimov added this to the 2.8.6 milestone Oct 14, 2026
@jimklimov
jimklimov merged commit 6c177c8 into networkupstools:master Oct 14, 2026
125 of 137 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement nut-scanner portability We want NUT to build and run everywhere possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants