Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

diff: validation for -U and -C #308

Merged
merged 1 commit into from
Nov 2, 2023
Merged

Commits on Nov 2, 2023

  1. diff: validation for -U and -C

    * The -U option accepts the number -1 but perl dies
    
    perl diff -U -1  A B 
    --- A	Sat Oct 28 11:49:12 2023
    +++ B	Sat Oct 28 11:49:24 2023
    @@ -3104,-1 +3104,-1 @@
    Modification of non-creatable array value attempted, subscript -1 at diff line 383.
    
    * For -U 0, output matches GNU diff on my Linux system
    * OpenBSD diff command also accepts -U 0
    * "-U hello" is interpreted as -U 0 but this should be an error
    * Looking at the option parser, -C and -U have the same problem
    * Standards document doesn't mention -U, but has wording about -C value being a positive integer[1]
    * Follow OpenBSD diff and allow -U 0, but raise error for negative values (same treatment for -C)
    
    1. https://pubs.opengroup.org/onlinepubs/009604499/utilities/diff.html
    mknos authored Nov 2, 2023
    Configuration menu
    Copy the full SHA
    8c437ab View commit details
    Browse the repository at this point in the history