Skip to content

cut: correct delimiter usage in regex - #1055

Merged
briandfoy merged 1 commit into
briandfoy:masterfrom
mknos:cut-delim-regex
Sep 4, 2026
Merged

cut: correct delimiter usage in regex#1055
briandfoy merged 1 commit into
briandfoy:masterfrom
mknos:cut-delim-regex

Conversation

@mknos

@mknos mknos commented Sep 4, 2026

Copy link
Copy Markdown
Contributor
  • A backslash is a valid field delimiter for cut, but it caused an error here because it was unintentionally interpreted into the regex
  • Some existing scripts use \Q & \E pair in the regex to avoid this kind of problem; do it here too
  • This was found when testing against other versions

Comparison with Linux system cut(1), before patch.

% echo "yo\\1" | cut -d\\ -f 1
yo
% echo "yo\\1" | perl -Mdiagnostics cut -d\\ -f 1
Trailing \ in regex m/\/ at cut line 155, <> line 1 (#1)
    (F) The regular expression ends with an unbackslashed backslash.
    Backslash it.   See perlre.
    
Uncaught exception from user code:
	Trailing \ in regex m/\/ at cut line 155, <> line 1.
	main::handle_f(1, "\\", undef) called at cut line 38

* A backslash is a valid field delimiter for cut, but it caused an error here because it was unintentionally interpreted into the regex
* Some existing scripts use \Q & \E pair in the regex to avoid this kind of problem; do it here too
* This was found when testing against other versions
@mknos
mknos deployed to housekeeping September 4, 2026 14:00 — with GitHub Actions Active
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 4, 2026 14:00 — with GitHub Actions Inactive
@github-actions github-actions Bot added Type: enhancement improve a feature that already exists Priority: low get to this whenever Program: cut The cut program Status: needs verification issue needs to be verified Type: bug an existing feature does not work labels Sep 4, 2026
@briandfoy briandfoy removed Type: enhancement improve a feature that already exists Status: needs verification issue needs to be verified labels Sep 4, 2026
@briandfoy
briandfoy merged commit b345448 into briandfoy:master Sep 4, 2026
23 of 24 checks passed
@briandfoy
briandfoy deployed to housekeeping September 4, 2026 20:18 — with GitHub Actions Active
@github-actions github-actions Bot added Status: accepted The fix is accepted and removed Priority: low get to this whenever labels Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Program: cut The cut program Status: accepted The fix is accepted Type: bug an existing feature does not work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants