Bugs in patches for Patchmanager

Please mark (“select”) the everything in the second post of this thread between the ***Start*** and ***End*** markers, hit the "Quote button (needs JavaScript enabled), delete the first line (which contains [quote="olf, post:2, topic:8553"]), also delete the very last line (which only contains [/quote]), then fill out the resulting form.

Only file bugs for patches here (i.e., not bugs for the Patchmanager proper), but read this first:

  • Bugs which occur with patches offered as RPMs at Openrepos must be filed at their corresponding Openrepos page.
  • For bugs which occur with patches from the Web Catalog, check if the specific patch offers a “discussion” or “sources” link on its detailed patch information page in Patchmanager where you can file a bug report, otherwise please file it here.
1 Like

***Start***

PATCH NAME (Settings→Patchmanager→[Tap on patch] Name):
PATCH VERSION (Settings→Patchmanager→[Tap on patch] Version):
PATCHMANAGER VERSION (Settings→Patchmanager→[Top pulley] About):
HARDWARE (Settings→About product→Manufacturer & Product name):
SailfishOS VERSION (Settings→About product→Build):

BUG DESCRIPTION

STEPS TO REPRODUCE

ADDITIONAL INFORMATION

(Please consider which other pieces of information may be relevant, e.g. denote if this is not always reproducible, if it is a regression, attach relevant data such as log files or the systemd journal, provide screenshots etc.)

***End***

1 Like

Not sure if applicable, but I wonder about:

I have aarch64 device, and many patches fail with ‘couldn’t find file to patch’, because the unified_diff is written to patch /usr/lib/…, but I have /usr/lib64/…, so it seems that if I just change that code to “lib64”, then the patch should work. However, it still fails with the same message…
(I know I can manually apply with “patch” command, but I wonder why this isn’t working)…

Thanks

Definitely applicable, there is this bug already in progress https://github.com/sailfishos-patches/patchmanager/issues/71

What particular patch are you trying?

Hi Levone1, I have a pinephone and I want to install the force cover size patch. Patchmanager doesn’t work at all on the PP. Could you tell me how to manually apply with “patch” command, as mentioned above. TIA

@defactofactotum what patchmanager version do you have?

It doesn’t say on the About page! But I installed it last week so it should be 3.1.0…works ok on my xz2c but the pinephone just shows a spinner for web catalogue

devel-su patch -R -p1 -d / -i /usr/share/patchmanager/patches/(whatever_patch_directory)/unified_diff.patch

I’ve found 5 or 6 of recent patch updates that are coded for /usr/lib/… “smooth remorse…” "glass buttons…“return old pulley…” “home carousel…” et al.

Thanks, but syntax is not clear to me. Can you give an example for “(whatever_patch_directory)”?

go to /usr/share/patchmanager/patches and you’ll see directories for each of your installed patches…

still no luck

[defaultuser@PinePhone ~]$ devel-su patch -R -p1 -d / -i /usr/share/patchmanager/patches/eugenio-force-largecover
s/unified_diff.patch
Password:
patching file usr/share/lipstick-jolla-home-qt5/layers/HomeLayer.qml
Hunk #1 FAILED at 78.
Hunk #2 FAILED at 88.
2 out of 2 hunks FAILED – saving rejects to file usr/share/lipstick-jolla-home-qt5/layers/HomeLayer.qml.rej
patching file usr/share/lipstick-jolla-home-qt5/layers/SwitcherLayer.qml
…+ 4 more FAILED

Interesting - that patch works fine for me as-is… I think you might be using the old version from Openrepos… @ade has an updated version in PM web catalog…

How to use the patch command

First of all, let me make it clear that neither patch nor any of the patches are coming from the patchmanager app. Patchmanager merely manages installation of patches (Web Catalog) and uses the patch command to apply patches.
(I mention this just because people keep asking how to use the “patch tool” as if it were a component of patchmanager. It is not. patch is a standard UNIX tool completely unrelated to patchmanager. There are literally 40 36 years worth of examples out there on the web on how patch works, use your favourite search engine to learn more.)

Anyway, to test whether a patch works (note the --dry-run, and you don’t need devel-su for this):

patch -p1 -d / --dry-run -i /usr/share/patchmanager/patches/(whatever_patch_directory)/unified_diff.patch

If you get any errors here, the problem is in all likelyhood with the unified_diff.patch and you should take it up with the author of that patch, or try to fix things yourself.

IF the test seems to work, you can apply it manually (same command without --dry-run):

devel-su patch -p1 -d / -i /usr/share/patchmanager/patches/(whatever_patch_directory)/unified_diff.patch

NOTE this will actually change system files on disk. If you were to apply the patch using patchmanager, it would not change system files on disk. This means if you apply patches this way, you have to take care to remove them again manually, even and especially when trying to use patchmanager later.

To remove/unapply an applied patch, use (same as applying but with -R):

devel-su patch -p1 -R -d / -i /usr/share/patchmanager/patches/(whatever_patch_directory)/unified_diff.patch

Again, this can only unapply patches you have applied manually using the method above, NOT unapply patches applied through patchmanager.

In closing let me repeat that if you apply patches this way you are:

  • changing system files on disk, and are from now on responsible on unchanging them or restoring them
  • can easily make some apps or the whole home screen, even the whole system not work
  • get to keep any broken pieces
  • and naturally, the patch tool does not magically make patches work. if a patch doesn’t apply, it’s for a reason and no amount of “devel-su copy paste random things from the internet” will make it work.
4 Likes

Issue for patches on 64bit system

Currently the majority of patches out these are developed and tested on/for 32bit systems.
Some of them have a problem on 64bit systems where they do not apply due to library paths being different.

This is a known problem, a solution on the patchmanager side is in the works. No timeschedule though wrt a release at the moment

See progress of Patchmanger Issue #71 about this.

In the mean time, this is how to fix such a patch:

  1. Verify that the patch is actually failing due to 64bit. Inspect the patch file, if the files changed are under /usr/lib (usually that is /usr/lib/qt5/qml), this might be the problem we are seeing.
  2. Back up the original patch file
  3. Verify that for each file under /usr/lib in the patch, a corresponding file exists on your system under /usr/lib64
  4. Open the patch file in an editor, and change all occurrences of /usr/lib to /usr/lib64. Be very careful not to change the format of the .diff file in any other way than correcting the paths.
  5. Save the patch and try again to apply it

Note that if you are using patchmanager to apply patches, the patch file must be named unified_diff.patch. No other names will work.

It’s probably best if you start by renaming the patch from /usr/share/patchmanager/patches/patchname to /usr/share/patchmanager/patches/patchname-mine, and edit the corresponding names in the new patch.json file. This way you have both the old and the new versions available and visible in patchmanager.

3 Likes

Thanks Nephros for this detailed explanation. I’ll try editing the patch later on.

Unless you want to unapply the patch the -R is wrong here.
Also note the possibility of using --dry-run I describe in the longer comment above.

After trying to patch fails, you will have to clean up the mess left behind before you can try again.

A failed patch usually leaves behind these files:

filename
filename.orig
filename.rej

filename containes the changed file up to the point where the patch failed (so it contains what was successfully changed). filename.orig is the onmodified original file. filename.rej contains the part of the patch that could not be applied. If you can read the diff format, you can try to apply those changes manually using an editor.

Sorry for posting here as its not exactly a bug - but did anyone manage to get @coderus launcher_combined patch to work on 4.2 ? or if someone could give me a hint what hat tov be done to make that happen - if its something easy as just changing a version number or a dir I might be able to manager that - if it comes to serious coding though … :wink:

1 Like

launcher_combined patch

Oh god, that one…
There was some effort of reviving it in this thread

May I kindly ask to take discussions about that particular patch to a separate topic, I’m a bit traumatized how talking about it derailed the linked post (in the sense that it was supposed to be about PM3 and SFOS4 but became about both things simultaneously ).