Skip to content

Honor info --profiles for XCCDF tailoring files - #2484

Open
hakarrr wants to merge 2 commits into
OpenSCAP:mainfrom
hakarrr:fix-2043-tailoring-profiles
Open

hakarrr wants to merge 2 commits into
OpenSCAP:mainfrom
hakarrr:fix-2043-tailoring-profiles

Conversation

@hakarrr

@hakarrr hakarrr commented Nov 10, 2026

Copy link
Copy Markdown

Fixes #2043.

Honor oscap info --profiles tailoring.xml by using the existing terse ID:title printer instead of the normal document header, import time and verbose profile list. Terse listings of tailoring embedded in a source datastream also omit the benchmark hint, so their output contains only profile rows.

Profiles without a locally defined title print an empty title field rather than passing NULL to %s. This does not load a referenced benchmark or infer an inherited title. Normal oscap info output, --list-rules and --list-vars behavior are preserved.

Extend the existing info CLI test with checks for:

  • Standalone tailoring with a title, plus multiple profiles with multiline, absent and abstract-profile titles.
  • A missing referenced benchmark and an empty local profile list.
  • Terse datastream tailoring rows and unchanged normal verbose headers.

Validation on Linux with GCC 11.4 and a native CMake build:

  • The extended info test fails against the original implementation and passes with the change.
  • ctest --test-dir build -R 'API/XCCDF/(unittests|fix)|oscap_info_profiles' -j4 --output-on-failure: 97 passed, 3 skipped, 0 failed.
  • Native executable/library build and git diff --check pass.

Dependencies were supplied locally without tracked dependency or build-configuration changes. Documentation, Python/Perl bindings and oscap-docker were disabled. The three skips cover XCCDF transformation, offline remediation and platform-specific system information. The full project test suite and non-Linux builds were not run.

hakarrr and others added 2 commits November 10, 2026 23:20
Use terse ID:title rows for standalone tailoring files and omit the benchmark hint from terse datastream tailoring output. Leave normal verbose info unchanged and handle profiles without local titles safely.

Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Cover titled, multiline, untitled and abstract profiles, missing benchmark references, empty tailoring files and datastream tailoring listings. Retain normal info headers and existing rule/variable listing behavior.

Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

@hakarrr

hakarrr commented Nov 13, 2026

Copy link
Copy Markdown
Author

Could a maintainer review this info --profiles handling for XCCDF tailoring files? Please let me know if the behavior needs changing or if additional cases are needed before it can move forward. Thanks.

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.

The --profiles option does not work for tailoring files in info

1 participant