Skip to content

getopt error with single character options #1837

Closed
@mcandre

Description

@mcandre

getopt works fine for long options, but borks on short options. I've tried multiple syntaxes, including Unix and Windows CLI conventions; the docs don't even suggest which one Rust getopt expects.

Code:

https://github.com/mcandre/ios7crypt/tree/master/rust

Trace:

$ make

$ ./ios7crypt --encrypt monkey
082c4340021c1c

$ ./ios7crypt -e monkey
rust: upcall fail 'bounds check', src/libstd/getopts.rs:314
rust: domain main @0x7ff608817600 root task failed

$ ./ios7crypt -emonkey
rust: upcall fail 'Argument to option 'e' missing.', ios7crypt.rs:115
rust: domain main @0x7f8dda017600 root task failed

$ ./ios7crypt -e=monkey
rust: upcall fail 'Argument to option 'e' missing.', ios7crypt.rs:115
rust: domain main @0x7fd3fa017600 root task failed

$ ./ios7crypt --e monkey
rust: upcall fail 'Unrecognized option: 'e'.', ios7crypt.rs:115
rust: domain main @0x7fe853816200 root task failed

$ ./ios7crypt /e monkey
Usage: ./ios7crypt [options]
-e --encrypt <password> Encrypt
-d --decrypt <hash> Decrypt
-t --test       Unit test
-h --help       Usage

$ ./ios7crypt /e:monkey
Usage: ./ios7crypt [options]
-e --encrypt <password> Encrypt
-d --decrypt <hash> Decrypt
-t --test       Unit test
-h --help       Usage

$ ./ios7crypt /e=monkey
Usage: ./ios7crypt [options]
-e --encrypt <password> Encrypt
-d --decrypt <hash> Decrypt
-t --test       Unit test
-h --help       Usage

It seems that getopt expects -e monkey syntax, but experiences an internal error:

rust: upcall fail 'bounds check', src/libstd/getopts.rs:314

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions