-
Notifications
You must be signed in to change notification settings - Fork 2
Description
On Unixish (Unix, Linux, BSD...) platforms, when the argument to the command stage contains a long option (an option that begins with --), the pipeline compiler treats the option as thebeginning of a comment stage, though no stage separator precedes it.
Oddly, the pipeline runner parses the command argument correctly. (?)
Example:
$ cat shortOptionTest.njp
pipe (testShortOption debug 192)
command ls -l /dev/disk/by-label |
console
rc=0
$ pipc shortOptionTest
pipe (testShortOption debug 192) command ls -l /dev/disk/by-label | console
rc=0
$ java testShortOption
Arg command_1 = ls -l /dev/disk/by-label
Arg console_2 =
command_1 selectInput (1) no streams to select rc=0
command_1 selectOutput (1) selecting an unconnected or severed stream rc=0
total 0
lrwxrwxrwx 1 root root 10 Oct 14 01:29 16.0_EFI -> ../../sdb1
lrwxrwxrwx 1 root root 10 Oct 14 01:29 16.0_FsRoot -> ../../sdb2
lrwxrwxrwx 1 root root 10 Oct 14 01:29 16.0_Local -> ../../sdb7
lrwxrwxrwx 1 root root 10 Oct 14 01:29 16.0_Opt -> ../../sdb6
lrwxrwxrwx 1 root root 10 Oct 14 01:30 16.0_Temp -> ../../dm-0
lrwxrwxrwx 1 root root 10 Oct 14 01:30 16.0_Var -> ../../dm-1
lrwxrwxrwx 1 root root 10 Oct 14 01:30 cr_swap -> ../../dm-2
lrwxrwxrwx 1 root root 9 Oct 15 02:19 openSUSE-Leap-15.6-DVD-x86_64710 -> ../../sr0
command_1 selectInput (0) no streams to select rc=0
console_2 peekto stream 0 severed rc=12
rc=0
The ls -l command is correctly parsed, but
$ cat longOptionTest.njp
pipe (testLongOption debug 192)
command ls --format=long /dev/disk/by-label |
console
rc=0
$ pipc longOptionTest
pipe (testLongOption debug 192) command ls
rc=0
$ java testLongOption
Arg command_1 = ls
command_1 selectInput (1) no streams to select rc=0
command_1 selectOutput (0) no streams to select rc=0
command_1 selectOutput (1) no streams to select rc=0
command_1 selectInput (0) no streams to select rc=0
rc=0
fails because --format=long is treated as a comment stage; likewise,
$ cat longOptionTest.njp
pipe (testLongOption debug 192)
literal ls --format=long /dev/disk/by-label|
command |
console
rc=0
$ pipc longOptionTest
pipe (testLongOption debug 192) literal ls
rc=0
$ java testLongOption
literal_1 Error - no output stream connected rc=11
literal_1 Error - no output stream connected rc=11
Arg literal_1 = ls
Arg literal_1 = ls
literal_1 Error - no output stream connected rc=11
literal_1 Error - no output stream connected rc=11
RC=11
RC=11
rc=0
also fails because the literal passed to the command stage contains --. Conversely,
$ pipe '(testLongOption debug 192)
> literal ls --format=long /dev/disk/by-label|
> command |
> console'
Arg literal_1 = ls --format=long /dev/disk/by-label
Arg command_2 =
Arg console_3 =
total 0
command_2 selectInput (1) selecting an unconnected or severed stream rc=0
command_2 selectOutput (1) selecting an unconnected or severed stream rc=0
lrwxrwxrwx 1 root root 10 Oct 14 01:29 16.0_EFI -> ../../sdb1
lrwxrwxrwx 1 root root 10 Oct 14 01:29 16.0_FsRoot -> ../../sdb2
lrwxrwxrwx 1 root root 10 Oct 14 01:29 16.0_Local -> ../../sdb7
lrwxrwxrwx 1 root root 10 Oct 14 01:29 16.0_Opt -> ../../sdb6
lrwxrwxrwx 1 root root 10 Oct 14 01:30 16.0_Temp -> ../../dm-0
lrwxrwxrwx 1 root root 10 Oct 14 01:30 16.0_Var -> ../../dm-1
lrwxrwxrwx 1 root root 10 Oct 14 01:30 cr_swap -> ../../dm-2
lrwxrwxrwx 1 root root 9 Oct 15 02:19 openSUSE-Leap-15.6-DVD-x86_64710 -> ../../sr0
command_2 peekto stream 0 severed rc=12
console_3 peekto stream 0 severed rc=12
rc=0
works correctly.
openSUSE Leap version 15.6
NetRexx portable processor 5.01-GA build 4-20250502-1546
Copyright (c) RexxLA, 2011,2025. All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.