You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
peports exits with code 0 (success) if file is not found #263
$ ./peports no-such-file;echo$?
peports: could not load file: no-such-file
0
It should exit with an error code instead.
Same, apparently, on other errors, for instance:
$ ./peports -i peports.c;echo$?
peports: unexpected end of input (slice): peports.c
0
Unrelated, while it pretends to parse standard options, it's not exactly POSIX getopt, for instance it doesn't understand -- to mark end-of-options, as in ./peports -i -- file.exe, and instead interprets it as an unknown options: peports: unknown option: -- (it does exit with an error code in this case, but incorrectly so).
The options parser also quietly skips - arguments, as in ./peports - < file.exe. This happens to work with one arg, because it ends up with no operands, which then uses fakeargv - which adds -, but it does not work correctly in other use cases, e.g. ./peports - file.exe, which is expected to first process stdin, then file.exe, but stdin is not processed because - is skipped.
Both issues would not happen with standard getopt or other compliant options parser, the former because the parser will eat the -- and then stop, and the latter because - is considered not-option (i.e. first-operand).
Thanks! Turns out it was just a little logic error tracking the error
status in the top-level argv loop. So only write errors stuck, via the
sticky output buffer flag.
I noticed your edit after I closed the issue. The option parsing issues
should be addressed by d3f34af. It needed an explicit check for "--", and
len<2 instead of len<1 when checking for options, which of course must be
at least 2 in length.
I'm planning to release a new w64dk this weekend (for GCC 15.2), so these
fixes will go out very soon!
Activity
skeeto commentedon Aug 9, 2025
skeeto commentedon Aug 9, 2025
avih commentedon Aug 9, 2025
Both seems OK now. Thanks.
Cute utility.
peports: Properly track the exit status on errors