Skip to content

storage_sync_prepare_push returns 13 with nothing on stdout or stderr #835

Description

@fujibee

storage_sync_prepare_push can fail with exit 13 and print nothing at all — not
on stdout, not on stderr. The caller is left with a number and no sentence.

Measured

Found while building a control for #829. A jq that emits CRLF poisons the
$( )-captured prepare fields, so the driver refuses — correctly. What it does
not do is say so:

rc=13
--- stderr ---
(empty)
--- stdout ---
(empty)

Both streams captured to files, both zero bytes.

Why it matters here specifically

13 is not a rare path. grep -c 'return 13' in
scripts/drivers/storage/sqlite-sync.sh finds it used for several distinct
conditions — a failed storage_init, a prepared/pending mismatch, a schema
problem — and they are indistinguishable from outside. An operator, or a test
author, sees one number for several causes and no text for any of them.

This is what made the #829 control hard to write: the control was failing, the
driver was refusing for a reason the test had created, and there was nothing to
read. The time went into bisecting a silence.

The shape

Same family as #802: a failure became a value, and nothing was recorded. The
difference is that here the value is returned rather than swallowed, so the
call does stop — what is missing is only the sentence. That makes it cheaper to
fix than #802's cases and no less worth fixing.

Suggested direction

Each return 13 site says which condition it is, on stderr, before returning.
The message does not need to be long; it needs to name the check. Two of them
already have text nearby in comments that would serve as the sentence.

Not proposed: changing the exit code, or splitting 13 into several. The callers
read the number and the number is part of the contract; this is about the text
beside it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions