Bug #13246
openyacc -V: return code 1; lex -V: expects input on stdin
0%
Description
Hello,
Actual results:
openindiana:~$ uname -a SunOS openindiana 5.11 illumos-549e0fd315 i86pc i386 i86pc illumos openindiana:~$ yacc -V; echo "yacc returned with code: '$?'" yacc: Software Generation Utilities (SGU) Solaris-ELF (4.0) command line: fatal: cannot open input file yacc returned with code: '1' openindiana:~$ lex -V lex: Software Generation Utilities (SGU) Solaris-ELF (4.0) ^C openindiana:~$ echo $? 130 openindiana:~$
yacc seems to expect an input file when invoked with the -V (show version) option. Thus it exits with return code 1 instead of 0 and prints a redundant error message. This breaks certain scripts (e.g. cmake) that depend on the return code to determine whether a command is working. lex on the other hand just prints the version and proceeds with reading from stdin, making it necessary to cancel it.
Expected results:
Something like this:
$ yacc -V; echo "yacc returned with code: '$?'" yacc - 1.9 20130304 yacc returned with code: '0' $ lex -V; echo "Return code: '$?'" lex 2.5.37 Return code: '0' $
I'm pretty sure, few people expect any command being invoked with a flag to show its version to actually do anything else besides just showing the version.
Updated by Joshua M. Clulow over 1 year ago
- Project changed from OpenIndiana Distribution to illumos gate
- Target version deleted (
2020.10)
I'm moving this to the illumos-gate project as I believe this would affect any distribution that ships the yacc
or lex
from cmd/sgs
.