Closed guijan closed 1 year ago
Are there any other (maintained) platform where scrot (and it's dependencies) can build and work that doesn't have getsubopt()
?
From the ifdef here, I get the feeling that this has been fixed on newer androids.
#if defined __ANDROID__ && __ANDROID_API__ < 26
I'm a bit reluctant towards trying to work around OS bugs that have already been fixed (though I'm not dismissing the idea entirely). But if that's not the case, or if there's other platform where getsubopt is also an issue then we can probably roll our own.
API level 26 is Android 8: https://apilevels.com/ Termux currently requires Android 7: https://f-droid.org/en/packages/com.termux/
Gnulib is usually a good place to figure out this stuff, it appears the only platforms that don't have getsubopt()
are Windows and Android <= 7.1: https://www.gnu.org/software/gnulib/manual/html_node/getsubopt.html
Of course, we don't currently run on Windows, only Cygwin.
Gnulib is usually a good place to figure out this stuff
Good tip, thanks. Will be useful in the future.
it appears the only platforms that don't have getsubopt() are Windows and Android <= 7.1
Since this is a problem with a single version (that's supported by termux) of a single platform, which already has been fixed on newer versions, I think we can let termux patch it as long as they still support android 7 (I couldn't find any info on how long they plan on supporting android 7 on their site/wiki. According to wikipedia last security update android 7 received was 2019-10).
If this was a non-standard function or a bug that won't ever be fixed (e.g linux CLOCK_MONOTONIC
) then I would've decided differently.
Then we can top it off by adding Termux to the CI, this can be done with Cirrus: https://github.com/guijan/libobsd/blob/2e24b5fa9ffb639c191dab5cffd487f8ff95d267/.cirrus.yml#L73-L81
Which android/bionic version is that? If it's >= 8 then we should be able to add it to the CI without a problem.
Turns out the Termux docker image by kcubeterm (a Termux developer) I use is outdated, I remember at some point the official version seemed to be abandoned, I guess it has been picked up again.
In the official Termux docker image, the commit message that created the libc.so they use says "System components are imported from Android 9 GSI" so I assume it's Android 9.
I noticed Termux (provides a linux+bionic libc command-line system on Android) needs to patch scrot to package it: https://github.com/termux/termux-packages/tree/e4dd29ceab807893de07c3d56453cbf9a97e0b61/x11-packages/scrot
This is because bionic does not have
getsubopt()
. We should port scrot to Termux by feature testing if the local system hasgetsubopt()
and then conditionally including a local implementation if not. Then we can top it off by adding Termux to the CI, this can be done with Cirrus: https://github.com/guijan/libobsd/blob/2e24b5fa9ffb639c191dab5cffd487f8ff95d267/.cirrus.yml#L73-L81