Since `rpm` uses a call to `getopt` to process the command line, I checked the 
parameter list with the command line tool `getopt`.

    $ getopt -o "D:" -- -D11 -D 22 -D "33" -D "44 55" -D "66 77"
     -D '11' -D '22' -D '33' -D '44 55' -D '66 77' --

which gave the expected results (apart from adding an extra space between the 
flag and the value).

Running `getopt` with gdb and inspecting the argv array
```
Breakpoint 1, main (argc=11, argv=0x7fffffd7d8) at misc-utils/getopt.c:369
369 struct getopt_control ctl = {
(gdb) p argv[8]
$10 = 0x7fffffdd66 "-D44 55"
(gdb) p argv[9]
$11 = 0x7fffffdd6e "-D"
(gdb) p argv[10]
$12 = 0x7fffffdd71 "66 77"
(gdb)
```
shows that the quoting is done by the shell and not by getopt itself. The 
conclusion is that something similar must be done before calling getopt in rpm 
to process macro parameters with quotes.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2449#issuecomment-1576670293
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/2449/c1576670...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to