Skip to content

Conversation

usamoi
Copy link
Contributor

@usamoi usamoi commented Mar 21, 2025

  • folding lower case letters to upper case for sorting, instead of folding upper case letters to lower case for sorting
  • correctly esacping break file like ()[]^
  • fixing --format option
  • rejecting three or more files if GNU extension is not enabled
  • allowing -b, --ignore-file and --only-file to accept - as input file

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/misc/stdbuf is no longer failing!
Congrats! The gnu test tests/misc/tee is no longer failing!

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/misc/stdbuf is no longer failing!

@sylvestre sylvestre requested a review from Copilot March 21, 2025 19:04
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes several issues with the ptx utility related to sorting, regex escaping, and option handling. It updates the ignore_case conversion to correctly fold lowercase letters to uppercase for sorting, improves the REGEX escaping logic for break files, and refines input/output operand handling when GNU extensions are disabled.

  • Change ignore_case conversion from lowercase to uppercase.
  • Replace custom REGEX character handling with regex::escape.
  • Revise option parsing for --format and file operands based on GNU extension settings.

Reviewed Changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.

File Description
src/uu/ptx/src/ptx.rs Updated flag handling for output format; streamlined regex escaping; fixed case conversion for sorting; improved operand validation
tests/by-util/test_ptx.rs Added tests for rejecting extra operands, regex escaping, and format options
Files not reviewed (2)
  • tests/fixtures/ptx/break_file_escape: Language not supported
  • tests/fixtures/ptx/break_file_regex_escaping.expected: Language not supported
Comments suppressed due to low confidence (2)

src/uu/ptx/src/ptx.rs:344

  • Changing the conversion to uppercase for ignore_case now correctly implements folding lower case letters for sorting. Please ensure that all sorting-related functionality and tests are updated to reflect this behavior.
word = word.to_uppercase();

src/uu/ptx/src/ptx.rs:253

  • The reworked handling of the '--format' option now uses get_one for parsing and then checks for -O/-T flags. Please verify that the precedence of these options is as intended and consider adding an inline comment to clarify the evaluation order.
if let Some(format) = matches.get_one::<String>(options::FORMAT) {

Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/misc/stdbuf is no longer failing!

@sylvestre sylvestre merged commit 8931d2c into uutils:main Mar 23, 2025
67 of 68 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.

2 participants