+
Skip to content

Conversation

Misakait
Copy link
Contributor

@Misakait Misakait commented Oct 1, 2025

Summary

This PR fixes a compatibility bug in ptx where an extra leading space was added before the truncation marker in both roff (-G) and tex formats. The output now matches GNU ptx.

Related Issue

Closes #8783

Changes Made

  • Modified the trim_idx function to correctly trim leading whitespace from the "after" context before truncation calculations.
  • Added the regression test test_truncation_no_extra_space_in_after to verify the fix and prevent future regressions.

GNU ptx (Correct Behavior)
image
uutils/ptx Before Fix
image
uutils/ptx After Fix
PixPin_2025-10-02_04-39-44

How to Test

The bug can be verified with the following test case. After this fix, the output of uutils/ptx is identical to GNU ptx.

echo "Rust is funnnnnnnnnnnnnn" | cargo run -- -G -w 30

…n test (`test_truncation_no_extra_space_in_after`) has been added. Close#8783
Copy link

github-actions bot commented Oct 2, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/misc/usage_vs_getopt (fails in this run but passes in the 'main' branch)

Copy link

codspeed-hq bot commented Oct 2, 2025

CodSpeed Performance Report

Merging #8784 will not alter performance

Comparing Misakait:fix/ptx-truncation-space (4dc0585) with main (c883445)

Summary

✅ 65 untouched
⏩ 73 skipped1

Footnotes

  1. 73 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

…n test (`test_truncation_no_extra_space_in_after`) has been added. Close#8783
Copy link

github-actions bot commented Oct 2, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

@cakebaker cakebaker merged commit 9064619 into uutils:main Oct 2, 2025
97 checks passed
@cakebaker
Copy link
Contributor

Thanks for your PR!

@Misakait
Copy link
Contributor Author

Misakait commented Oct 2, 2025

Thanks for your PR!

You're welcome! Happy to contribute!

@Misakait Misakait deleted the fix/ptx-truncation-space branch October 3, 2025 12:09
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.

ptx: Extra space is added before truncation marker

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载