Skip to content

paste: support posix delimiter escapes - #1056

Merged
briandfoy merged 1 commit into
briandfoy:masterfrom
mknos:paste-posix-delim
Sep 5, 2026
Merged

paste: support posix delimiter escapes#1056
briandfoy merged 1 commit into
briandfoy:masterfrom
mknos:paste-posix-delim

Conversation

@mknos

@mknos mknos commented Sep 5, 2026

Copy link
Copy Markdown
Contributor
  • Microsoft-365-Copilot static analysis found a crash in paste when the empty string is used as a delimiter
  • POSIX document suggests that -d '\0' is intended for an empty string delimiter [1]
  • Add a function to support the escapes defined in the POSIX document
  • GNU paste supports both -d '' and -d '\0' as meaning empty string delimiter; support both here for now
  • Bump version
  1. https://pubs.opengroup.org/onlinepubs/9799919799/utilities/paste.html

Previous crash:

%perl -Mdiagnostics paste -d '' paste paste
Use of uninitialized value $sep[0] in concatenation (.) or string at paste line
	81, <$fil> line 1 (#1)
    (W uninitialized) An undefined value was used as if it were already
    defined.  It was interpreted as a "" or a 0, but maybe it was a mistake.
    To suppress this warning assign a defined value to your variables.
    
    To help you figure out what was undefined, perl will try to tell you
    the name of the variable (if any) that was undefined.  In some cases
    it cannot do this, so it also tells you what operation you used the
    undefined value in.  Note, however, that perl optimizes your program
    and the operation displayed in the warning may not necessarily appear
    literally in your program.  For example, "that $foo" is usually
    optimized into "that " . $foo, and the warning will refer to the
    concatenation (.) operator, even though there is no . in
    your program.
    
Illegal modulus zero at paste line 82, <$fil> line 1 (#2)
    (F) You tried to divide a number by 0 to get the remainder.  Most
    numbers don't take to this kindly.
    
Uncaught exception from user code:
	Illegal modulus zero at paste line 82, <$fil> line 1.

* Microsoft-365-Copilot static analysis found a crash in paste when the empty string is used as a delimiter
* POSIX document suggests that -d '\0'  is intended for an empty string delimiter [1]
* Add a function to support the escapes defined in the POSIX document
* GNU paste supports both -d '' and -d '\0' as meaning empty string delimiter; support both here for now
* Bump version

1. https://pubs.opengroup.org/onlinepubs/9799919799/utilities/paste.html
@mknos
mknos deployed to housekeeping September 5, 2026 13:08 — with GitHub Actions Active
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — with GitHub Actions Inactive
@mknos
mknos temporarily deployed to automated_testing September 5, 2026 13:08 — 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: paste The paste command Status: needs verification issue needs to be verified Type: bug an existing feature does not work labels Sep 5, 2026
@briandfoy briandfoy removed the Type: enhancement improve a feature that already exists label Sep 5, 2026
@briandfoy briandfoy removed the Status: needs verification issue needs to be verified label Sep 5, 2026
@briandfoy
briandfoy merged commit 9240f69 into briandfoy:master Sep 5, 2026
23 of 24 checks passed
@briandfoy
briandfoy deployed to housekeeping September 5, 2026 15:51 — 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 5, 2026
@briandfoy

Copy link
Copy Markdown
Owner

changes: refactor delimiter handling to properly support \0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Program: paste The paste command 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