Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cinnabar crashes with core dump rather than failing gracefully if upstream hg rejects push #338

Open
riastradh opened this issue Oct 27, 2024 · 1 comment

Comments

@riastradh
Copy link

#!/bin/sh

set -Ceux

hg init repo.hg
echo hello >repo.hg/README
hg -R repo.hg --config ui.username='a <b@c>' commit -Am 'initial tree'

git clone hg::"$(pwd)/repo.hg" repo.git
echo world >>repo.git/README
git -C repo.git -c user.name=e -c user.email=f@g commit -am 'updated tree'

# Inject an error.
cat >>repo.hg/.hg/hgrc <<EOF
[hooks]
pretxnclose = python:/nonexistent:fali
EOF

git -C repo.git push

Output:

...
+ git -C repo.git push
Bundling 1 changesets
Bundling 1 manifests
Bundling 1 revisions of 1 files
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: loading pretxnclose hook failed:
remote: transaction abort!
remote: rollback completed
remote: abort: No such file or directory: '/nonexistent'
fatal: called `Result::unwrap()` on an `Err` value: Error { kind: UnexpectedEof, message: "failed to fill whole buffer" }
Run the command again with `git -c cinnabar.check=traceback <command>` to see the full traceback.
error: git-remote-hg died of signal 6
error: failed to push some refs to 'hg::/home/riastradh/tmp/20241026/cinnatest/repo.hg'

Expected output: nothing involving unwrap on error value, no core dump, since the cause of the failed push is not (directly) a bug in Rust code but a refusal by the upstream repo.

@riastradh
Copy link
Author

Reproducer phrased as test case pushcrash.t attached.

riastradh pushed a commit to riastradh/git-cinnabar that referenced this issue Dec 9, 2024
This tests how git push to a remote hg repository reacts when hg
crashes.  Currently: by having git-cinnabar crash too.

glandium#338
riastradh pushed a commit to riastradh/git-cinnabar that referenced this issue Dec 9, 2024
If connection to upstream is hosed, consider nothing to have been
pushed.

fix glandium#338
riastradh pushed a commit to riastradh/git-cinnabar that referenced this issue Dec 15, 2024
riastradh pushed a commit to riastradh/git-cinnabar that referenced this issue Dec 15, 2024
If connection to upstream is hosed, consider nothing to have been
pushed.

fix glandium#338
riastradh pushed a commit to riastradh/git-cinnabar that referenced this issue Dec 18, 2024
riastradh pushed a commit to riastradh/git-cinnabar that referenced this issue Dec 18, 2024
If connection to upstream is hosed, consider nothing to have been
pushed.

fix glandium#338
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

No branches or pull requests

1 participant