chicken-hackers
[Top][All Lists]
Advanced

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

Re: [PATCH] stop run-time option processing after "--"


From: Peter Bex
Subject: Re: [PATCH] stop run-time option processing after "--"
Date: Mon, 13 Mar 2023 16:11:54 +0100

On Mon, Mar 13, 2023 at 10:37:30AM +0100, felix.winkelmann@bevuta.com wrote:
> Another problem with run-time option processing pointed out by
> florz. This allows passing arguments that look like run-time
> options, when preceded by "--".

This needs more thought - simply adding "--" to stop it from processing
options leaves us with ("--") as the first command-line argument.
In other words, "./my-program -:a100 -- foo" is seen as '("--" "foo")
when you ask for (command-line-arguments), while the intention probably
was '("foo").

Just dropping "--" from the arguments list is probably also not
desirable, because our option parser doesn't have any getopt-like
behaviour, so -xyz or --xyz aren't treated specially in any way.

Perhaps the safest here is to stop processing after reading ":-"
or some such (and discard it!) - that would be guaranteed to never
pass through to the program anyway, because it might be a runtime
option and already gets intercepted by the option parser.

Only potential issue is that it's not exactly standard when compared to
other programs...

What do y'all think?

Cheers,
Peter

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]