flatpak / flatpak-builder

Tool to build flatpaks from source
GNU Lesser General Public License v2.1
139 stars 93 forks source link

[Bug]: flatpak-builder may hang when applying patch fails #446

Open nanonyme opened 2 years ago

nanonyme commented 2 years ago

Checklist

flatpak-builder version

1.2.0

Flatpak version

1.12.2

How to reproduce

Spotted on Flathub builder

HEAD is now at 918ff46a659 Merge pull request #20783 from enen92/edlcutinfo
FB: Running: git rev-parse --verify --quiet 918ff46a659fc12502e42cd7db62eaf250e07493:.gitmodules
Applying patch kodi.sh.in.patch
FB: Running: patch -p1 -i /srv/buildbot/worker/build-x86_64-2/build/kodi.sh.in.patch
patching file tools/Linux/kodi.sh.in
Applying patch addon-manifest.xml.patch
FB: Running: patch -p1 -i /srv/buildbot/worker/build-x86_64-2/build/addon-manifest.xml.patch
patching file system/addon-manifest.xml
patch: **** malformed patch at line 85: +  <addon optional="true">visualization.waveform</addon>
]2;flatpak-builder: Cleanup kodiError: module kodi: Child process exited with code 2
FB: Unmounting read-only fs: fusermount -uz /srv/buildbot/worker/build-x86_64-2/build/.flatpak-builder/rofiles/rofiles-9DggoE
dbus-daemon[1691385]: Reloaded configuration

https://flathub.org/builds/#/builders/8/builds/8829

Expected Behavior

flatpak-builder aborts build, cleans up and exits with failure code

Actual Behavior

flatpak-builder hangs

Additional Information

No response

hadess commented 10 months ago

I've seen this when patch application wants to go interactive:

patching file deps/wxWidgets/wxWidgets.cmake
Reversed (or previously applied) patch detected!  Assume -R? [n]
TingPing commented 10 months ago

I guess passing -f is one way to make patch never ask questions.

Erick555 commented 10 months ago

Wouldn't there be silent failures in such case? -f is to force the patch even if it looks wrong which is opposite of what we need - always fail immediately.

nanonyme commented 10 months ago

Would it work to give /dev/null as stdin to patch to make it not ask for input?

Erick555 commented 10 months ago

This suggests -f will exit with non-zero code when patching wrong file. I'm not sure about:

Assume that the user knows exactly what he or she is doing, and do not ask any questions. Skip patches whose headers do not say which file is to be patched; patch files even though they have the wrong version for the Prereq: line in the patch; and assume that patches are not reversed even if they look like they are. This option does not suppress commentary; use -s for that.