Skip to content

sysusers: Preserve fields after empty quoted tokens - #2534

Merged
cgwalters merged 1 commit into
bootc-dev:mainfrom
ddy314:fix/sysusers-empty-quoted-fields
Oct 5, 2026
Merged

cgwalters merged 1 commit into
bootc-dev:mainfrom
ddy314:fix/sysusers-empty-quoted-fields

Conversation

@ddy314

@ddy314 ddy314 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

An empty quoted column currently ends tokenization. For example, u service 123 "" /home/service /bin/sh loses both the home directory and shell.

Distinguish an empty quoted token from exhausted input, and treat empty optional fields as absent while continuing to parse the remaining columns. Empty user and group names remain errors.

Validation:

  • The new regression test fails on the base revision and passes with the fix.
  • cargo test -p bootc-sysusers --locked: 13 tests passed.
  • cargo fmt --all -- --check.
  • cargo clippy -p bootc-sysusers --all-targets --locked --no-deps -- -D warnings passed. Including dependency linting encounters an existing collapsible_if warning in crates/utils/src/path.rs on Rust 1.96.

@bootc-bot
bootc-bot Bot requested a review from jeckersb October 3, 2026 07:03
An empty quoted field still consumes a column. Preserve the remaining
input and treat empty optional fields as absent, so home and shell
values are not silently dropped. Keep rejecting empty user/group names.

Signed-off-by: Natsu <139412824+ddy314@users.noreply.github.com>
@ddy314
ddy314 force-pushed the fix/sysusers-empty-quoted-fields branch from a19b433 to 1dfc9ed Compare October 3, 2026 07:05
@ddy314
ddy314 marked this pull request as ready for review October 3, 2026 07:06
@cgwalters
cgwalters requested a balanced review from Copilot October 5, 2026 15:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Empty quoted entry types now bypass parse validation and are silently ignored.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Fixes sysusers tokenization so empty quoted optional fields do not discard subsequent columns.

Changes:

  • Distinguishes exhausted input from empty quoted tokens.
  • Treats empty optional fields as absent.
  • Adds regression coverage for empty fields and names.
File Description
crates/​sysusers/​src/​lib.rs Updates token parsing and adds regression tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

} else {
Some((first, rest))
}
Some((first, rest))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems valid and insightful, albeit obscure. Can be a followup.

@cgwalters
cgwalters merged commit 5b0ab9c into bootc-dev:main Oct 5, 2026
92 of 96 checks passed
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.

3 participants