Skip to content

install-lib.sh: an empty recorded account renders as '''' in the removal refusal #60

Description

@ghostpsalm

What's wrong

Follow-up to #33. That issue's slice 2 made the two state-mismatch refusals render both
account names through printf '%q', so invisible whitespace becomes visible. The message
still wraps each name in its own literal single quotes, which is deliberate: an ordinary
whitespace-free name passes %q unchanged, so the common refusal reads exactly as it did
before.

An empty recorded name does not. printf '%q' '' produces '', and nested inside the
message's own quotes that renders as four consecutive apostrophes:

refusing to remove dchost: install state records host account ''''

Baseline (before #33) printed ''.

How it is reached

read_install_state resets HOST_ACCOUNT to empty when install.state is absent
(install-lib.sh:220). An uninstall on a box that has a matching passwd/GECOS entry but
no state file therefore reaches host_account_removable's rail 5 (install-lib.sh:305-306)
with an empty recorded name.

Severity

Cosmetic/low. The refusal is correct and the operator is still stopped for the right reason;
the message just reads as a typo rather than as "nothing is recorded".

Fix direction

Either drop the message's own literal quotes at that site and let %q supply the only
quoting, or special-case the empty recorded name with an explicit marker
(e.g. (no account recorded)).

Proof asked for

A test driving host_account_removable with no install.state present, asserting the
refusal reads as one empty-string marker rather than four consecutive apostrophes.

Provenance

Found by the seraph during issue #33's run (finding-a2f036af25f7, invocation
inv-006-7ba40bbc), verified with cat -A. Filed rather than fixed in that run: the finding
asks for a new test, and whoever writes a test must not be whoever satisfies it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions