Fix/man page - #11
Merged
Merged
Conversation
Man pages must be named <name>.<section>; the file shipped and installed as smart-restart.man1, which man(1) cannot locate. Rename doc/smart-restart.man1 to doc/smart-restart.1, update MAN_FILE and the sources tarball path in the Makefile, and match the new name in the spec %files entry with a smart-restart.1* glob. Also bump the stale Makefile MINOR to 3 to match the v0.3 tag.
VinzSpring
force-pushed
the
fix/man-page
branch
from
August 18, 2026 11:46
fd927ce to
f316a3e
Compare
Hook discovery parsed ls output, printing "ls: cannot access ..." to stderr on every dnf transaction when no optional hook files exist, and word-splitting broke on filenames containing whitespace (SC2207). Use nullglob array assignment instead, and set GLOBSORT=name so hook ordering stays name-sorted even if the caller's environment sets a different glob sort order (bash >= 5.3).
VinzSpring
force-pushed
the
fix/man-page
branch
from
August 18, 2026 12:07
f316a3e to
99d766a
Compare
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.
Fix man page naming and clean up restart hook discovery
Problem
man smart-restartfails with "No manual entry for smart-restart" onsystems with the package installed. Man pages must be named
<name>.<section>(e.g.smart-restart.1), but the page ships andinstalls as
smart-restart.man1, whichman(1)cannot locate.Additionally, every dnf transaction prints harmless but noisy errors
when no optional hook files are installed (the default):
Changes
Commit 1 — Fix man page naming so
man smart-restartworksdoc/smart-restart.man1todoc/smart-restart.1MAN_FILEand thesourcestarball path in theMakefile%filesentry to%{_mandir}/man1/smart-restart.1*(the glob covers compressed and uncompressed installs)
MINORin theMakefilefrom 2 to 3 to match thev0.3 tag
Commit 2 — Make restart hook discovery quiet and deterministic
ls-parsing hook discovery with nullglob arrayassignment. An unmatched glob now yields a cleanly empty array with
no stderr output, and filenames containing whitespace no longer
word-split into bogus entries (shellcheck SC2207).
GLOBSORT=namebefore the globs. Since bash 5.3, an exportedGLOBSORTin the caller's environment changes pathname expansionorder (e.g. by mtime, or reversed); setting it to
nameexplicitlykeeps hook execution order deterministic. This is a harmless no-op
on older bash.
previous
ls | sort -nwas effectively name-sorted too (sort -nnever found a leading number in absolute paths and fell back to
byte-wise comparison).
Background on the previous hook discovery
The previous implementation built the hook arrays from
$(ls ... | sort -n). A few subtleties there motivated the change:reaches
lsliterally, producing the stderr noise above on everydnf transaction, while the arrays stay empty via
ls's emptystdout.
a hook filename containing whitespace splits into multiple entries
(the pattern shellcheck SC2207 describes).
-nhad no observable effect: every line shares the samedirectory prefix (
$CONF_PATH/), sosort -nparses the identicalleading numeric key from all lines, every comparison ties, and
ordering falls back to byte-wise whole-line comparison — i.e. the
resulting order was already name order. That's why the nullglob
replacement preserves ordering exactly.
The glob-array form gets the same result with fewer moving parts and
no per-transaction subprocesses.
Testing
make testpasses (all 17 tests)bash -n bin/smart-restart.shpasses/etc/smart-restart-conf.d, the script produces nooutput and the hook arrays are empty
tests/conf, hooks are discovered in the expected order(
0001-*before0002-*)make DEST_DIR=$(mktemp -d) installstagesusr/share/man/man1/smart-restart.1and no*.man1fileinstalls cleanly,
rpm -Vpasses, and the dnf post-transaction hookfires and runs the script on a
dnf reinstalltransaction