sailfishos-patches / patchmanager

Patchmanager for SailfishOS
https://openrepos.net/content/patchmanager/patchmanager
Other
21 stars 22 forks source link

[Suggestion] The preload library should complain when the daemon is in "appsNeedRestart" state #443

Open nephros opened 1 year ago

nephros commented 1 year ago

DESCRIPTION

Consider:

  1. PM applies patch foo version 1.0 which affects file1, file2, and file3.
  2. a process X is launched, opening the three files, getting redirected as usual by the preload library.
  3. PM applies patch foo version 1.1 which affects file1, file2, but no longer file3.
  4. Assuming the patch has the correct metadata, PM will know that process X should be restarted, but the user might opt to not do it.

The process X may now have a version of file3 in use that shouldn't exist any more. E.g. a QML program might Qt.resolvedUrl("file3"). This will work after 2., but fail after 3.

Also it may have been initialized with the state of things in the files from after 1., but reading the same files after 3. will serve new content.

It's easy (?) to see that this can confuse processes.

ADDITIONAL INFORMATION

The PM daemon has a state where it "recommends" affected processes ("services") to be restarted.

Communication between the preload library and the daemon should include that information, and the preload library should log a warning if it discovers that it's redirecting to files which have been "patched twice".

Olf0 commented 1 year ago

I suppose step 3 is a really rare case (borderline to artificial), but AFAIU your considerations are fully correct.

Additionally step 4 "the user ignores the strong suggestion to restart the patched service / program" is required for ultimately that service / program not working correctly … until the next reboot. Which lets the whole issue appear to be a rare corner case.

Hence one valid approach is IMO not to address this technically, but to emphasise that things my not work correctly if the suggestion to restart the service / program is not obeyed.