ifupdown-ng / ifupdown-ng

flexible ifup/ifdown implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multicall binary doesn't work with program-specific options

awilfox opened this issue · comments

awilcox on gwyn [pts/11 Wed 18 14:01] ifupdown-ng: ./ifupdown ifparse -F yaml-raw 
./ifupdown: unrecognized option: F
-F: applet not found
usage: ifupdown <applet> [options]

Built-in applets:
        ifctrstat, ifdown, ifparse, ifquery, ifup, ifupdown
awilcox on gwyn [pts/11 Wed 18 14:01] ifupdown-ng: ./ifupdown ifparse -AF yaml-raw
./ifupdown: unrecognized option: A
ifparse - redisplay interface configuration

Usage:
  ifparse [options] <interfaces>
  ifparse [options] --all

Global options:
  -h, --help                          this help
  -V, --version                       show this program's version

Matching interfaces:
  -a, --auto                          only match against interfaces hinted as 'auto'
  -I, --include PATTERN               only match against interfaces matching PATTERN
  -X, --exclude PATTERN               never match against interfaces matching PATTERN

Execution:
  -f, --force                         force (de)configuration
  -i, --interfaces FILE               use FILE for interface definitions
  -l, --no-lock                       do not use a lockfile to serialize state changes
  -n, --no-act                        do not actually run any commands
  -v, --verbose                       show what commands are being run
  -E, --executor-path PATH            use PATH for executor directory
  -S, --state-file FILE               use FILE for state

Program-specific options:
  -F, --format                        output format to use
  -A, --all                           show all interfaces
  -U, --allow-undefined               allow querying undefined (virtual) interfaces

For more information: man 8 ifparse

It appears that something is reordering argv incorrectly:

This GDB was configured as "powerpc64-foxkit-linux-musl".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ifupdown...
(gdb) set args ifparse -F yaml-raw
(gdb) break main
Breakpoint 1 at 0x408c: file cmd/multicall.c, line 79.
(gdb) break multicall_main
Breakpoint 2 at 0x41e0: file cmd/multicall.c, line 103.
(gdb) run
Starting program: /home/awilcox/Code/ifupdown-ng/ifupdown ifparse -F yaml-raw

Breakpoint 1, main (argc=4, argv=0x3ffffffff3a8) at cmd/multicall.c:79
79              argv0 = basename(argv[0]);
(gdb) p *(argv)
$1 = 0x3ffffffff6ee "/home/awilcox/Code/ifupdown-ng/ifupdown"
(gdb) p *(argv+1)
$2 = 0x3ffffffff716 "ifparse"
(gdb) p *(argv+2)
$3 = 0x3ffffffff71e "-F"
(gdb) p *(argv+3)
$4 = 0x3ffffffff721 "yaml-raw"
(gdb) c
Continuing.
/home/awilcox/Code/ifupdown-ng/ifupdown: unrecognized option: F

Breakpoint 2, multicall_main (argc=4, argv=0x3ffffffff3a8) at cmd/multicall.c:103
103             if (argc < 2)
(gdb) p *(argv)
$5 = 0x3ffffffff6ee "/home/awilcox/Code/ifupdown-ng/ifupdown"
(gdb) p *(argv+1)
$6 = 0x3ffffffff71e "-F"
(gdb) p *(argv+2)
$7 = 0x3ffffffff716 "ifparse"
(gdb) p *(argv+3)
$8 = 0x3ffffffff721 "yaml-raw"

This occurred on ppc64 and x86_64 based Adélie Linux with:

musl-1.2.0-r1 ppc64 {musl} (MIT) [installed]
zsh-5.8-r0 ppc64 {zsh} (Zsh AND BSD-3-Clause AND GPL-2.0+ AND GPL-2.0-only AND Artistic-1.0-Perl AND MIT AND GPL-1.0+) [installed]