Skip to content

Improve the manpages & lint them in github#11339

Open
sylvestre wants to merge 4 commits intouutils:mainfrom
sylvestre:manpages
Open

Improve the manpages & lint them in github#11339
sylvestre wants to merge 4 commits intouutils:mainfrom
sylvestre:manpages

Conversation

@sylvestre
Copy link
Contributor

No description provided.

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/rm/many-dir-entries-vs-OOM is now being skipped but was previously passing.

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/printf/printf-surprise is now being skipped but was previously passing.
Congrats! The gnu test tests/tail/tail-n0f is now passing!

@sylvestre sylvestre force-pushed the manpages branch 2 times, most recently from 22b8e12 to c8db906 Compare March 15, 2026 19:56
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/cp/link-heap is now being skipped but was previously passing.
Note: The gnu test tests/seq/seq-epipe is now being skipped but was previously passing.
Congrats! The gnu test tests/tail/tail-n0f is now passing!

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/expand/bounded-memory is now being skipped but was previously passing.
Note: The gnu test tests/printf/printf-surprise is now being skipped but was previously passing.
Congrats! The gnu test tests/tail/tail-n0f is now passing!

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/date/resolution (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/tail/tail-n0f is now passing!

@sylvestre sylvestre force-pushed the manpages branch 3 times, most recently from 6fca3ad to 6691464 Compare March 15, 2026 22:17
@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/timeout/timeout-group. tests/timeout/timeout-group is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/basenc/bounded-memory is now being skipped but was previously passing.
Note: The gnu test tests/csplit/csplit-heap is now being skipped but was previously passing.
Congrats! The gnu test tests/tail/tail-n0f is now passing!

@sylvestre sylvestre marked this pull request as ready for review March 15, 2026 22:32
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/date/resolution (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/tail/retry is no longer failing!
Note: The gnu test tests/tail/tail-n0f is now being skipped but was previously passing.
Congrats! The gnu test tests/cut/bounded-memory is now passing!
Congrats! The gnu test tests/expand/bounded-memory is now passing!

@cakebaker
Copy link
Contributor

I don't know if you have seen it: the newly added tests fail in the CI :|

- Fix TH header: uppercase command names and remove invalid date format
- Remove trailing whitespace from all manpage lines
- Fix redundant .br paragraph macros that cause mandoc warnings
- Post-process manpage output to ensure compliance with mandoc standards
Add a new workflow that builds and validates all manpages using mandoc -T lint.
The workflow runs on PRs and pushes that modify manpage-related files and
validates both English and French manpages in parallel.
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/misc/io-errors is no longer failing!
Note: The gnu test tests/tail/tail-n0f is now being skipped but was previously passing.

- Move manpage post-processing logic into post_process_manpage() function
- Add comprehensive unit tests for all post-processing functionality
- Improve .br macro handling to correctly fix mandoc warnings
- Tests cover TH header fixes, whitespace removal, and .br pattern fixes
@sylvestre sylvestre force-pushed the manpages branch 2 times, most recently from d91e685 to b8c10fa Compare March 18, 2026 07:49
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)

@sylvestre
Copy link
Contributor Author

@cakebaker looks good this time :)

src/bin/uudoc.rs Outdated
skip_indices.insert(i);
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I struggled with this code, it seems unnecessarily complex :|

I have rewritten it to do the same thing in a single pass:

    let lines: Vec<&str> = result.lines().map(str::trim_end).collect();
    let mut fixed_lines: Vec<&str> = Vec::with_capacity(lines.len());

    for i in 0..lines.len() {
        let line = lines[i];

        if line == ".br" {
            let preceded_by_empty_line = i > 0 && lines[i - 1].is_empty();
            let followed_by_empty_line = i + 1 < lines.len() && lines[i + 1].is_empty();
            let followed_by_br = i + 1 < lines.len() && lines[i + 1] == ".br";

            if preceded_by_empty_line || followed_by_empty_line || followed_by_br {
                // skip this ".br"
                continue;
            }
        }

        fixed_lines.push(line);
    }

Cargo.toml Outdated
Comment on lines +485 to +486
jiff = { workspace = true, optional = true }
regex = { workspace = true, optional = true }
Copy link
Contributor

Choose a reason for hiding this comment

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

A detail: I would keep the alphabetic order.

src/bin/uudoc.rs Outdated
/// - Removes .br before empty lines to avoid "br before sp" warnings
/// - Removes .br after empty lines to avoid "br after sp" warnings
/// - Fixes escape sequences (e.g., \\\\0 to \\0) to avoid "undefined escape" warnings
fn post_process_manpage(manpage: String, date: Option<&str>) -> String {
Copy link
Contributor

Choose a reason for hiding this comment

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

It might make sense to use &str as type for date so that you use the same code path for both testing and non-testing.

- Enhanced post-processing to remove .br macros that appear before empty lines
- This fixes 'WARNING: skipping paragraph macro: br before sp' from mandoc
- Also handles the common pattern of .br-empty-.br by removing both .br macros
- Added comprehensive test cases for the new patterns
- All mandoc 'br before sp' warnings are now resolved
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.

2 participants