NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/59443: getopt/getopt_long prints errors when +/- is present before :



[2025-05-26 06:40:01+0000] Thomas Klausner via gnats:
The following reply was made to PR lib/59443; it has been noted by GNATS.

From: Thomas Klausner <wiz%gatalith.at@localhost>
To: NetBSD bugtracking <gnats-bugs%NetBSD.org@localhost>
Cc:
Subject: Re: lib/59443: getopt/getopt_long prints errors when +/- is present
before :
Date: Mon, 26 May 2025 08:39:54 +0200

On Sun, May 25, 2025 at 06:30:00PM +0000, contact+netbsd.org%hacktivis.me@localhost wrote:
> >Synopsis:       getopt/getopt_long prints errors when +/- is present before :

Perhaps it's too early in the morning, but can you please also
describe what behaviour you expected instead, and why?

Thanks,
 Thomas

Yeah, no problem, I expected the following to happen instead:

    $ OPTSTR=":" ./getopt_test -f
    $ OPTSTR="+:" ./getopt_test -f
    $ OPTSTR="-:" ./getopt_test -f

    $ OPTSTR=":" ./getopt_long_test -f
    $ OPTSTR="+:" ./getopt_long_test -f
    $ OPTSTR="-:" ./getopt_long_test -f
    $ OPTSTR=":" ./getopt_long_test --foobar
    $ OPTSTR="+:" ./getopt_long_test --foobar
    $ OPTSTR="-:" ./getopt_long_test --foobar

And as far as I can tell, this code seems like it should match the expected behavior: https://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdlib/getopt_long.c?rev=1.28

Best regards



Home | Main Index | Thread Index | Old Index