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

Errors not reported from flatpak install --noninteractive #2839

Closed
pwithnall opened this issue Apr 18, 2019 · 1 comment
Closed

Errors not reported from flatpak install --noninteractive #2839

pwithnall opened this issue Apr 18, 2019 · 1 comment
Labels
bug cli Issues involving the flatpak command help wanted

Comments

@pwithnall
Copy link
Collaborator

If anything in the FlatpakTransaction when running flatpak install returns an error, that error won’t be reported when running with --noninteractive. flatpak install will return a 0 exit status.

For example, if I set min-free-space=50000MB (a valid value, but more free space than I have on my system), then run:

$ flatpak install --user --noninteractive org.octave.Octave
Installing runtime/org.kde.Sdk/x86_64/5.12
$ echo $?
0
$ flatpak run org.octave.Octave
error: app/org.octave.Octave/x86_64/master not installed

If you run without --noninteractive, the error is correctly reported:

$ flatpak install --user flathub org.octave.Octave
…
error: Failed to install org.octave.Octave: min-free-space-size 50000MB would be exceeded

The problem is that FlatpakQuietTransaction doesn’t implement the operation_error vfunc, so flatpak_transaction_run() ends up returning FLATPAK_ERROR_ABORTED — but
flatpak-builtin-install.c explicitly squashes FLATPAK_ERROR_ABORTED errors, since it expects FlatpakCliTransaction to have already printed any relevant error.

The fix is to either not squash FLATPAK_ERROR_ABORTED when using FlatpakQuietTransaction, or implement operation_error in FlatpakQuietTransaction. I’m afraid I don’t have time to do either of those at the moment.

This is likely a problem with other builtin commands which use FlatpakQuietTransaction, but I’ve only tested with flatpak install.

This is with flatpak 0b20f3d4 (a recentish git master).

@mwleeds
Copy link
Collaborator

mwleeds commented Apr 18, 2019

When this is fixed, I believe #2757 will also be fixed because a FlatpakQuietTransaction is used there.

@mwleeds mwleeds added bug cli Issues involving the flatpak command help wanted labels Apr 18, 2019
alexlarsson added a commit to alexlarsson/flatpak that referenced this issue Apr 25, 2019
We need to handle operation_error and report errors, and for
fatal errors remember this and report a failure in run(), because
otherwise it returns ABORTED, which is treated as a failure (because
generally that meant the user chose "no" on some question).

Fixes flatpak#2839, flatpak#2757
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cli Issues involving the flatpak command help wanted
Projects
None yet
Development

No branches or pull requests

2 participants