termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
12.98k stars 2.98k forks source link

[Bug]: libcurl 8.9.1 breaks transmission #21036

Closed imaami closed 1 day ago

imaami commented 1 month ago

Problem description

There's a change in libcurl 8.9.1 that causes transmission-daemon to exit within 30 seconds. The cause is unhandled SIGPIPE and the details are already covered here:

https://github.com/curl/curl/pull/14296#issuecomment-2263711275 https://github.com/curl/curl/issues/14344 https://github.com/transmission/transmission/issues/7035

It seems that currently the only way to fix it is to either downgrade libcurl or to revert this commit:

https://github.com/curl/curl/commit/17e6f06ea37136c36d2712b3433ef0d3b118ec0d

There is no mention yet about when to expect a proper fix upstream, so my hope is that you could roll back the Termux libcurl package to 8.9.0 until then. Transmission is literally unusable right now.

What steps will reproduce the bug?

With libcurl 8.9.1 and transmission 4.0.6, run transmission-daemon in the foreground and wait for approximately 15-30 seconds for it to exit by itself, then echo the return value.

$ transmission-daemon -f; echo $?
141

You should see exit code 141, which is 128 + SIGPIPE.

What is the expected behavior?

Being able to download Linux distro images via torrent.

System information

Termux Variables:
TERMUX_API_APP__VERSION_NAME=0.50.1+cff225e
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP__AM_SOCKET_SERVER_ENABLED=true
TERMUX_APP__APK_PATH=/data/app/~~GTf2vGq-aoi7qbz01ryAwQ==/com.termux-xZUfuOcqYlmBcLmueYdq0g==/base.apk
TERMUX_APP__APK_RELEASE=GITHUB
TERMUX_APP__FILES_DIR=/data/user/0/com.termux/files
TERMUX_APP__IS_DEBUGGABLE_BUILD=true
TERMUX_APP__IS_INSTALLED_ON_EXTERNAL_STORAGE=false
TERMUX_APP__PACKAGE_MANAGER=apt
TERMUX_APP__PACKAGE_NAME=com.termux
TERMUX_APP__PACKAGE_VARIANT=apt-android-7
TERMUX_APP__PID=22989
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c181,c257,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_APP__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c181,c257,c512,c768
TERMUX_APP__TARGET_SDK=28
TERMUX_APP__UID=10437
TERMUX_APP__USER_ID=0
TERMUX_APP__VERSION_CODE=118
TERMUX_APP__VERSION_NAME=0.118.0+4c4b84a
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0+4c4b84a
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirrors.sahilister.in/termux/termux-main stable main
# x11-repo (sources.list.d/x11.list)
deb https://mirrors.sahilister.in/termux/termux-x11 x11 main
# tur-repo (sources.list.d/tur.list)
deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous
Updatable packages:
All packages up to date
termux-tools version:
1.43.2
Android version:
13
Kernel build information:
Linux localhost 4.19.157-perf+ #1 SMP PREEMPT Thu Sep 7 05:33:32 CDT 2023 aarch64 Android
Device manufacturer:
motorola
Device model:
motorola edge 20 pro
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.window versionCode:15
com.termux.widget versionCode:13
com.termux.x11 versionCode:14
com.termux.gui versionCode:8
com.termux.styling versionCode:1000
com.termux.api versionCode:51
com.termux.boot versionCode:7
TomJo2000 commented 1 month ago

Reverting libcurl to 8.9.0 would be a giant pain in the ass. And patching it to revert the commit responsible doesn't sound especially appealing either.

I guess it comes down to 3 main questions

imaami commented 1 month ago

Reverting libcurl to 8.9.0 would be a giant pain in the ass. And patching it to revert the commit responsible doesn't sound especially appealing either.

I guess it comes down to 3 main questions

* Is there an upstream PR to fix this yet?

  * preferably with an ETA.

* Is `transmission` the only curl dependency effected?

* Are there viable workarounds from the `transmission` side of the issue?

No upstream PRs for libcurl or transmission exist yet, only the bug reports.

Apparently transmission-gtk suffers from the same problem, but that's hardly surprising. It's possible that there are other affected codebases out there, as libcurl 8.9.1 inadvertently alters the behavior of existing programs using it (depending on how they deal with signals generally), but I haven't heard of any so far.

There isn't a workaround unfortunately. Preventing the abrupt exit is only possible by catching SIGPIPE inside transmission-daemon or libcurl. Reverting the libcurl commit I mentioned is the least complicated fix right now as it only takes one commit diff and patch -Rp1 before build.

TomJo2000 commented 1 month ago

I think this comes dangerously close to a "Don't ship WIP"^1 scenario. Whatever we do about this issue should be coordinated with the upstream projects.

Biswa96 commented 1 month ago

I agree that we should wait for the changes in both upstream projects. Meanwhile, aria2c could be used with torrent files.

imaami commented 1 month ago

I think this comes dangerously close to a "Don't ship WIP"1 scenario. Whatever we do about this issue should be coordinated with the upstream projects.

Footnotes

1. https://dont-ship.it/ [↩](#user-content-fnref-1-978850acb11c3fc9962927135d84f531)

Whatever you decide to do as a package maintainer is at your discretion, as it should be of course. :) I do have one kind request though: would you happen to know where I can download the Termux aarch64 deb for libcurl 8.9.0? This left me empty-handed:

$ apt-get download --print-uris libcurl|cut -d"'" -f2|sed 's/8\.9\.1/8.9.0/'|xargs wget
--2024-08-03 21:26:23--  https://mirrors.sahilister.in/termux/termux-main/pool/main/libc/libcurl/libcurl_8.9.0_aarch64.deb
Resolving mirrors.sahilister.in (mirrors.sahilister.in)... 89.58.46.93, 2a03:4000:67:e6b::
Connecting to mirrors.sahilister.in (mirrors.sahilister.in)|89.58.46.93|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2024-08-03 21:26:23 ERROR 404: Not Found.
TomJo2000 commented 1 month ago

We don't keep older versions of packages around, but I (or you) can spin up a github actions run for the libcurl package with it reverted to 8.9.0

imaami commented 1 month ago

We don't keep older versions of packages around, but I (or you) can spin up a github actions run for the libcurl package with it reverted to 8.9.0

Much appreciated!

TomJo2000 commented 1 month ago

Much appreciated!

imaami commented 1 month ago

Heads up, there's a tentative upstream fix, and it looks like 8.9.2 8.10.0 should be just around the corner: https://github.com/curl/curl/commit/3eec5afbd0b6377eca893c392569b2faf094d970

TomJo2000 commented 1 month ago

Thanks for the heads up. If it's pending immediate release I think it should be fine to wait for that instead of cherry picking it for a 8.9.1-1 revision.

Though I can provide such a cherry pick in #21037 if desired.

imaami commented 1 month ago

Thanks for the heads up. If it's pending immediate release I think it should be fine to wait for that instead of cherry picking it for a 8.9.1-1 revision.

Though I can provide such a cherry pick in #21037 if desired.

I agree it's best to wait for an actual release for packaging, but I could test a patched build too just in case there's anything surprising there I should report to upstream.

fornwall commented 1 day ago

Closing this as curl 8.10 is out and packaged now.