Skip to content

fix: age-inspect indefinitely hanging and also improves usage info and flags#712

Open
Turmaxx wants to merge 1 commit into
FiloSottile:mainfrom
Turmaxx:inspect
Open

fix: age-inspect indefinitely hanging and also improves usage info and flags#712
Turmaxx wants to merge 1 commit into
FiloSottile:mainfrom
Turmaxx:inspect

Conversation

@Turmaxx
Copy link
Copy Markdown

@Turmaxx Turmaxx commented May 23, 2026

This PR mainly fixes an issue where age-inspect would hang indefinitely, when invoked alone without arguments or a piped input.

This wont affect previous behavior.

$ age-inspect
Click to expand output
Usage:
    age-inspect [INPUT]
    age-inspect [--json] [INPUT]

Options:
    --json                      Output machine-readable JSON.
    -v, --version               Print the version.

INPUT defaults to standard input. "-" may be used as INPUT to explicitly
read from standard input.
$ age-inspect test.age
Click to expand output
test.age is an age file, version "age-encryption.org/v1".

This file is ASCII-armored.

This file is encrypted to the following recipient types:
  - "scrypt"

This file uses post-quantum encryption.

Size breakdown (assuming it decrypts successfully):

    Header                       150 bytes
    Armor overhead              1481 bytes
    Encryption overhead           32 bytes
    Payload                     3805 bytes
                        -------------------
    Total                       5468 bytes

Tip: for machine-readable output, use --json.
$ age-inspect --json test.age
Click to expand output
{
    "version": "age-encryption.org/v1",
    "postquantum": "yes",
    "armor": true,
    "stanza_types": [
        "scrypt"
    ],
    "sizes": {
        "header": 150,
        "armor": 1481,
        "overhead": 32,
        "min_payload": 3805,
        "max_payload": 3805,
        "min_padding": 0,
        "max_padding": 0
    }
}
$ cat test.age | age-inspect
Click to expand output
<stdin> is an age file, version "age-encryption.org/v1".

This file is ASCII-armored.

This file is encrypted to the following recipient types:
  - "scrypt"

This file uses post-quantum encryption.

Size breakdown (assuming it decrypts successfully):

    Header                       150 bytes
    Armor overhead              1481 bytes
    Encryption overhead           32 bytes
    Payload                     3805 bytes
                        -------------------
    Total                       5468 bytes

Tip: for machine-readable output, use --json.
$ cat test.age | age-inspect --json
Click to expand output
{
    "version": "age-encryption.org/v1",
    "postquantum": "yes",
    "armor": true,
    "stanza_types": [
        "scrypt"
    ],
    "sizes": {
        "header": 150,
        "armor": 1481,
        "overhead": 32,
        "min_payload": 3805,
        "max_payload": 3805,
        "min_padding": 0,
        "max_padding": 0
    }
}

This PR also improves the usage information and version flags a bit.

  • adds a v as an alternative version flag.
  • improves the usage information, by adding alternatve usage

- added `-v` flag
- updated usage information / help message
- added `else` logic to fix age-inspect hanging when invoked seperately,
it prints the usage information, when invoked with an age files it
inspects it and also when pipes it inspects it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant