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

flatpak install will attempt to rebase a ref that's not yet installed #3754

Closed
refi64 opened this issue Jul 19, 2020 · 2 comments · Fixed by #4483
Closed

flatpak install will attempt to rebase a ref that's not yet installed #3754

refi64 opened this issue Jul 19, 2020 · 2 comments · Fixed by #4483
Assignees
Labels

Comments

@refi64
Copy link
Collaborator

refi64 commented Jul 19, 2020

Yup, this one is my bad. Example says it all:

flatpak install com.visualstudio.code.oss 
Looking for matches…
Found similar ref(s) for ‘com.visualstudio.code.oss’ in remote ‘flathub’ (user).
Use this remote? [Y/n]: 
Info: com.visualstudio.code.oss is end-of-life, in favor of app/com.visualstudio.code-oss/x86_64/stable
Replace it with app/com.visualstudio.code-oss/x86_64/stable? [Y/n]: 

com.visualstudio.code.oss permissions:
    ipc     network     pulseaudio     ssh-auth     x11     dri     file access [1]     dbus access [2]

    [1] host
    [2] org.freedesktop.Flatpak, org.freedesktop.Notifications


        ID                                  Branch          Op          Remote           Download
 1. [✓] com.visualstudio.code.oss           stable          i           flathub          68.7 MB / 80.5 MB

Installation complete.
error: Failed to rebase com.visualstudio.code.oss to app/com.visualstudio.code-oss/x86_64/stable: com.visualstudio.code.oss/x86_64/stable not installed

If the original ref isn't even installed yet, this shouldn't bother attempting to delete the old one. However, the rebase operation should still take place, otherwise any leftover data from the previous app won't be migrated over (which I'd think would be desired, though it's arguable). Ideally it could tell eol-rebase the state, but that would be an ABI break so I'll have to figure out a better way to do that...

@refi64 refi64 self-assigned this Jul 19, 2020
@mwleeds mwleeds added the bug label Jul 20, 2020
@mwleeds
Copy link
Collaborator

mwleeds commented Oct 12, 2021

This is not exactly the behavior I'm seeing with Flatpak 1.12.1 on Fedora 36 Rawhide. It still fails with that error message but it also installs the EOL version, its dependencies, the new version, and its dependencies:

[mwleeds@fedora ~]$ flatpak install com.visualstudio.code.oss
Looking for matches…
Info: com.visualstudio.code.oss//stable is end-of-life, in favor of app/com.visualstudio.code-oss/x86_64/stable
Replace it with app/com.visualstudio.code-oss/x86_64/stable? [Y/n]: 
Required runtime for com.visualstudio.code-oss/x86_64/stable (runtime/org.freedesktop.Sdk/x86_64/21.08) found in remote flathub
Do you want to install it? [Y/n]: 
Required runtime for com.visualstudio.code.oss/x86_64/stable (runtime/org.freedesktop.Sdk/x86_64/19.08) found in remote flathub
Do you want to install it? [Y/n]: 
Info: org.freedesktop.Sdk//19.08 is end-of-life, with reason:
   The Freedesktop SDK 19.08 runtime is no longer supported as of September 1, 2021. Please ask your application developer to migrate to a supported version
Info: org.freedesktop.Platform.GL.default//19.08 is end-of-life, with reason:
   The Freedesktop SDK 19.08 runtime is no longer supported as of September 1, 2021. Please ask your application developer to migrate to a supported version

com.visualstudio.code.oss permissions:
    ipc                  network      pulseaudio      ssh-auth      x11      dri      file access [1]
    dbus access [2]

    [1] host
    [2] org.freedesktop.Flatpak, org.freedesktop.Notifications

com.visualstudio.code-oss permissions:
    ipc        network              pulseaudio           ssh-auth      wayland      x11     dri
    devel      file access [1]      dbus access [2]

    [1] host
    [2] org.freedesktop.Flatpak, org.freedesktop.Notifications


        ID                                             Branch            Op           Remote            Download
 1. [✓] org.freedesktop.Platform.GL.default            19.08             i            flathub            88.6 MB / 89.1 MB
 2. [✓] org.freedesktop.Platform.GL.default            21.08             i            flathub           128.2 MB / 128.6 MB
 3. [✓] org.freedesktop.Platform.openh264              2.0               i            flathub             1.5 MB / 1.5 MB
 4. [✓] org.freedesktop.Sdk.Locale                     19.08             i            flathub            17.8 kB / 322.4 MB
 5. [✓] org.freedesktop.Sdk                            19.08             i            flathub           513.3 MB / 578.9 MB
 6. [✓] com.visualstudio.code.oss                      stable            i            flathub            76.6 MB / 80.5 MB
 7. [✓] org.freedesktop.Sdk.Locale                     21.08             i            flathub            17.7 kB / 329.7 MB
 8. [✓] org.freedesktop.Sdk                            21.08             i            flathub           393.3 MB / 473.0 MB
 9. [✓] com.visualstudio.code-oss                      stable            i            flathub            96.3 MB / 99.9 MB

Installation complete.
error: Failed to rebase com.visualstudio.code.oss to app/com.visualstudio.code-oss/x86_64/stable: com.visualstudio.code.oss/x86_64/stable not installed

@mwleeds
Copy link
Collaborator

mwleeds commented Oct 12, 2021

I'm working on a patch for this.

mwleeds added a commit that referenced this issue Oct 12, 2021
Currently if the user specifies a ref to install that has been renamed
via the end-of-life-rebased mechanism, for example "flatpak install
com.visualstudio.code.oss", Flatpak erroneously tries to install both
the old and new versions of the app. This happens because the code
handling end-of-life-rebase conditions is written assuming the rebased
app is being updated rather than installed for the first time.

Specifically, in FlatpakCliTransaction and FlatpakQuietTransaction, in
end_of_lifed_with_rebase(), we treat a failure of
flatpak_transaction_add_uninstall() as fatal and return FALSE from the
signal handler, which means that the install operation that triggered
the signal will not be skipped (see the docs for
FlatpakTransaction::end-of-lifed-with-rebase).

So, instead check for the FLATPAK_ERROR_NOT_INSTALLED error code and
ignore it, so that the installation of the old version of the renamed
app will be properly cancelled.

Fixes #3754
alexlarsson pushed a commit that referenced this issue Nov 15, 2021
Currently if the user specifies a ref to install that has been renamed
via the end-of-life-rebased mechanism, for example "flatpak install
com.visualstudio.code.oss", Flatpak erroneously tries to install both
the old and new versions of the app. This happens because the code
handling end-of-life-rebase conditions is written assuming the rebased
app is being updated rather than installed for the first time.

Specifically, in FlatpakCliTransaction and FlatpakQuietTransaction, in
end_of_lifed_with_rebase(), we treat a failure of
flatpak_transaction_add_uninstall() as fatal and return FALSE from the
signal handler, which means that the install operation that triggered
the signal will not be skipped (see the docs for
FlatpakTransaction::end-of-lifed-with-rebase).

So, instead check for the FLATPAK_ERROR_NOT_INSTALLED error code and
ignore it, so that the installation of the old version of the renamed
app will be properly cancelled.

Fixes #3754
mwleeds added a commit that referenced this issue Jan 4, 2022
Currently if the user specifies a ref to install that has been renamed
via the end-of-life-rebased mechanism, for example "flatpak install
com.visualstudio.code.oss", Flatpak erroneously tries to install both
the old and new versions of the app. This happens because the code
handling end-of-life-rebase conditions is written assuming the rebased
app is being updated rather than installed for the first time.

Specifically, in FlatpakCliTransaction and FlatpakQuietTransaction, in
end_of_lifed_with_rebase(), we treat a failure of
flatpak_transaction_add_uninstall() as fatal and return FALSE from the
signal handler, which means that the install operation that triggered
the signal will not be skipped (see the docs for
FlatpakTransaction::end-of-lifed-with-rebase).

So, instead check for the FLATPAK_ERROR_NOT_INSTALLED error code and
ignore it, so that the installation of the old version of the renamed
app will be properly cancelled.

Fixes #3754

(cherry picked from commit 3aa9a7f)
mwleeds added a commit that referenced this issue Jan 4, 2022
Currently if the user specifies a ref to install that has been renamed
via the end-of-life-rebased mechanism, for example "flatpak install
com.visualstudio.code.oss", Flatpak erroneously tries to install both
the old and new versions of the app. This happens because the code
handling end-of-life-rebase conditions is written assuming the rebased
app is being updated rather than installed for the first time.

Specifically, in FlatpakCliTransaction and FlatpakQuietTransaction, in
end_of_lifed_with_rebase(), we treat a failure of
flatpak_transaction_add_uninstall() as fatal and return FALSE from the
signal handler, which means that the install operation that triggered
the signal will not be skipped (see the docs for
FlatpakTransaction::end-of-lifed-with-rebase).

So, instead check for the FLATPAK_ERROR_NOT_INSTALLED error code and
ignore it, so that the installation of the old version of the renamed
app will be properly cancelled.

Fixes #3754

(cherry picked from commit 3aa9a7f)
alexlarsson pushed a commit that referenced this issue Jan 11, 2022
Currently if the user specifies a ref to install that has been renamed
via the end-of-life-rebased mechanism, for example "flatpak install
com.visualstudio.code.oss", Flatpak erroneously tries to install both
the old and new versions of the app. This happens because the code
handling end-of-life-rebase conditions is written assuming the rebased
app is being updated rather than installed for the first time.

Specifically, in FlatpakCliTransaction and FlatpakQuietTransaction, in
end_of_lifed_with_rebase(), we treat a failure of
flatpak_transaction_add_uninstall() as fatal and return FALSE from the
signal handler, which means that the install operation that triggered
the signal will not be skipped (see the docs for
FlatpakTransaction::end-of-lifed-with-rebase).

So, instead check for the FLATPAK_ERROR_NOT_INSTALLED error code and
ignore it, so that the installation of the old version of the renamed
app will be properly cancelled.

Fixes #3754

(cherry picked from commit 3aa9a7f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants