Qutebrowser bug with prefers-color-scheme

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Qutebrowser bug with prefers-color-scheme

Anindya Mukherjee
Hi,

Qutebrowser has a bug on OpenBSD which causes the prefers-color-scheme
setting to not work correctly (e.g., test sites show that it is not
supported, etc.). The problem is a hard-coded library filename for
libQt5WebEngineCore.so.5 in
/usr/local/lib/python3.8/site-packages/qutebrowser/misc/elf.py. I worked
with The-Compiler and a fix has been committed upstream:
https://github.com/qutebrowser/qutebrowser/commit/eb6f1cf9898cb431af9d2812ec40f811e37f57f0
Would it be possible to backport this into the current port? I have
tested the patch on my system and it fixes the issue. To test, simply
set colors.webpage.preferred_color_scheme = dark and load
https://www.openbsd.org/faq/. It will be displayed using the light
scheme without this fix, regardless of the above setting.

OTOH 2.2 is not too far off and updating to that won't need maintaining
a patch. I'm not sure what is the best way to proceed.

Regards,
Anindya

Reply | Threaded
Open this post in threaded view
|

Re: Qutebrowser bug with prefers-color-scheme

Anindya Mukherjee
On Mon, Apr 05, 2021 at 07:56:54PM -0700, Anindya Mukherjee wrote:

> Hi,
>
> Qutebrowser has a bug on OpenBSD which causes the prefers-color-scheme
> setting to not work correctly (e.g., test sites show that it is not
> supported, etc.). The problem is a hard-coded library filename for
> libQt5WebEngineCore.so.5 in
> /usr/local/lib/python3.8/site-packages/qutebrowser/misc/elf.py. I worked
> with The-Compiler and a fix has been committed upstream:
> https://github.com/qutebrowser/qutebrowser/commit/eb6f1cf9898cb431af9d2812ec40f811e37f57f0
> Would it be possible to backport this into the current port? I have
> tested the patch on my system and it fixes the issue. To test, simply
> set colors.webpage.preferred_color_scheme = dark and load
> https://www.openbsd.org/faq/. It will be displayed using the light
> scheme without this fix, regardless of the above setting.
>
> OTOH 2.2 is not too far off and updating to that won't need maintaining
> a patch. I'm not sure what is the best way to proceed.
>
> Regards,
> Anindya

Incidentally, setting QUTE_DARKMODE_VARIANT=qt_515_2 also works around
the bug by forcing the library version to what we know is the correct
one for OpenBSD.

Reply | Threaded
Open this post in threaded view
|

Re: Qutebrowser bug with prefers-color-scheme

Dimitri Karamazov
In reply to this post by Anindya Mukherjee
On Mon, Apr 06, 2021 at 03:08:45AM -0000, Anindya Mukherjee wrote:

>On Mon, Apr 05, 2021 at 07:56:54PM -0700, Anindya Mukherjee wrote:
>> Hi,
>>
>> Qutebrowser has a bug on OpenBSD which causes the prefers-color-scheme
>> setting to not work correctly (e.g., test sites show that it is not
>> supported, etc.). The problem is a hard-coded library filename for
>> libQt5WebEngineCore.so.5 in
>> /usr/local/lib/python3.8/site-packages/qutebrowser/misc/elf.py. I worked
>> with The-Compiler and a fix has been committed upstream:
>> https://github.com/qutebrowser/qutebrowser/commit/eb6f1cf9898cb431af9d2812ec40f811e37f57f0
>> Would it be possible to backport this into the current port? I have
>> tested the patch on my system and it fixes the issue. To test, simply
>> set colors.webpage.preferred_color_scheme = dark and load
>> https://www.openbsd.org/faq/. It will be displayed using the light
>> scheme without this fix, regardless of the above setting.
>>
>> OTOH 2.2 is not too far off and updating to that won't need maintaining
>> a patch. I'm not sure what is the best way to proceed.
>>
>> Regards,
>> Anindya
>
>Incidentally, setting QUTE_DARKMODE_VARIANT=qt_515_2 also works around
>the bug by forcing the library version to what we know is the correct
>one for OpenBSD.

Should've CC'd me. Do you've any idea about the release date for 2.2?
Hopefully this will do in the meanwhile.

Build & Run tested on amd64.

regards,
  Dimitri

Index: Makefile
===================================================================
RCS file: /cvs/ports/www/qutebrowser/Makefile,v
retrieving revision 1.28
diff -u -p -r1.28 Makefile
--- Makefile 2 Apr 2021 14:24:40 -0000 1.28
+++ Makefile 6 Apr 2021 04:06:59 -0000
@@ -4,6 +4,7 @@ COMMENT = keyboard-focused browser with
 
 MODPY_EGG_VERSION = 2.1.1
 DISTNAME = qutebrowser-${MODPY_EGG_VERSION}
+REVISION = 0
 
 HOMEPAGE = https://www.qutebrowser.org/
 
@@ -25,6 +26,9 @@ RUN_DEPENDS = devel/desktop-file-utils
  x11/py-qt5${MODPY_FLAVOR} \
  www/py-jinja2${MODPY_FLAVOR} \
  www/py-qtwebengine${MODPY_FLAVOR}
+
+post-patch:
+ sed -i s,so.5,so.1.0, ${WRKSRC}/qutebrowser/misc/elf.py
 
 post-install:
  ${INSTALL_DATA_DIR} ${PREFIX}/share/applications/

Reply | Threaded
Open this post in threaded view
|

Re: Qutebrowser bug with prefers-color-scheme

Anindya Mukherjee
On Tue, Apr 06, 2021 at 04:51:30AM +0000, Dimitri Karamazov wrote:

> On Mon, Apr 06, 2021 at 03:08:45AM -0000, Anindya Mukherjee wrote:
> >On Mon, Apr 05, 2021 at 07:56:54PM -0700, Anindya Mukherjee wrote:
> >> Hi,
> >>
> >> Qutebrowser has a bug on OpenBSD which causes the prefers-color-scheme
> >> setting to not work correctly (e.g., test sites show that it is not
> >> supported, etc.). The problem is a hard-coded library filename for
> >> libQt5WebEngineCore.so.5 in
> >> /usr/local/lib/python3.8/site-packages/qutebrowser/misc/elf.py. I worked
> >> with The-Compiler and a fix has been committed upstream:
> >> https://github.com/qutebrowser/qutebrowser/commit/eb6f1cf9898cb431af9d2812ec40f811e37f57f0
> >> Would it be possible to backport this into the current port? I have
> >> tested the patch on my system and it fixes the issue. To test, simply
> >> set colors.webpage.preferred_color_scheme = dark and load
> >> https://www.openbsd.org/faq/. It will be displayed using the light
> >> scheme without this fix, regardless of the above setting.
> >>
> >> OTOH 2.2 is not too far off and updating to that won't need maintaining
> >> a patch. I'm not sure what is the best way to proceed.
> >>
> >> Regards,
> >> Anindya
> >
> >Incidentally, setting QUTE_DARKMODE_VARIANT=qt_515_2 also works around
> >the bug by forcing the library version to what we know is the correct
> >one for OpenBSD.
>

> Should've CC'd me. Do you've any idea about the release date for 2.2?
> Hopefully this will do in the meanwhile.

Sorry, I'll keep that in mind for the future. Not sure about the exact
date for 2.2 release but I was told by the developer that it is "soon".
I'll ask him.

>
> Build & Run tested on amd64.
>
> regards,
>   Dimitri
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/www/qutebrowser/Makefile,v
> retrieving revision 1.28
> diff -u -p -r1.28 Makefile
> --- Makefile 2 Apr 2021 14:24:40 -0000 1.28
> +++ Makefile 6 Apr 2021 04:06:59 -0000
> @@ -4,6 +4,7 @@ COMMENT = keyboard-focused browser with
>  
>  MODPY_EGG_VERSION = 2.1.1
>  DISTNAME = qutebrowser-${MODPY_EGG_VERSION}
> +REVISION = 0
>  
>  HOMEPAGE = https://www.qutebrowser.org/
>  
> @@ -25,6 +26,9 @@ RUN_DEPENDS = devel/desktop-file-utils
>   x11/py-qt5${MODPY_FLAVOR} \
>   www/py-jinja2${MODPY_FLAVOR} \
>   www/py-qtwebengine${MODPY_FLAVOR}
> +
> +post-patch:
> + sed -i s,so.5,so.1.0, ${WRKSRC}/qutebrowser/misc/elf.py
>  
>  post-install:
>   ${INSTALL_DATA_DIR} ${PREFIX}/share/applications/

Thanks for the quick response and the patch! I tried it and it works as
expected.

Regards,
Anindya

Reply | Threaded
Open this post in threaded view
|

Re: Qutebrowser bug with prefers-color-scheme

Stuart Henderson
In reply to this post by Anindya Mukherjee
On 2021/04/05 19:56, Anindya Mukherjee wrote:

> Hi,
>
> Qutebrowser has a bug on OpenBSD which causes the prefers-color-scheme
> setting to not work correctly (e.g., test sites show that it is not
> supported, etc.). The problem is a hard-coded library filename for
> libQt5WebEngineCore.so.5 in
> /usr/local/lib/python3.8/site-packages/qutebrowser/misc/elf.py. I worked
> with The-Compiler and a fix has been committed upstream:
> https://github.com/qutebrowser/qutebrowser/commit/eb6f1cf9898cb431af9d2812ec40f811e37f57f0
> Would it be possible to backport this into the current port? I have
> tested the patch on my system and it fixes the issue. To test, simply
> set colors.webpage.preferred_color_scheme = dark and load
> https://www.openbsd.org/faq/. It will be displayed using the light
> scheme without this fix, regardless of the above setting.
>
> OTOH 2.2 is not too far off and updating to that won't need maintaining
> a patch. I'm not sure what is the best way to proceed.
>
> Regards,
> Anindya
>

The fix is not correct, it should not check for existence of the file, just
try to dlopen libQt5WebEngineCore.so (no version).

See dlopen(3) "When a shared library is specified without a version ..."

Reply | Threaded
Open this post in threaded view
|

Re: Qutebrowser bug with prefers-color-scheme

Anindya Mukherjee
On Tue, Apr 06, 2021 at 09:16:29AM +0100, Stuart Henderson wrote:

> On 2021/04/05 19:56, Anindya Mukherjee wrote:
> > Hi,
> >
> > Qutebrowser has a bug on OpenBSD which causes the prefers-color-scheme
> > setting to not work correctly (e.g., test sites show that it is not
> > supported, etc.). The problem is a hard-coded library filename for
> > libQt5WebEngineCore.so.5 in
> > /usr/local/lib/python3.8/site-packages/qutebrowser/misc/elf.py. I worked
> > with The-Compiler and a fix has been committed upstream:
> > https://github.com/qutebrowser/qutebrowser/commit/eb6f1cf9898cb431af9d2812ec40f811e37f57f0
> > Would it be possible to backport this into the current port? I have
> > tested the patch on my system and it fixes the issue. To test, simply
> > set colors.webpage.preferred_color_scheme = dark and load
> > https://www.openbsd.org/faq/. It will be displayed using the light
> > scheme without this fix, regardless of the above setting.
> >
> > OTOH 2.2 is not too far off and updating to that won't need maintaining
> > a patch. I'm not sure what is the best way to proceed.
> >
> > Regards,
> > Anindya
> >
>
> The fix is not correct, it should not check for existence of the file, just
> try to dlopen libQt5WebEngineCore.so (no version).
>
> See dlopen(3) "When a shared library is specified without a version ..."
>

Thanks, this makes sense. In fact in my own C code I do exactly what you
suggested. I'll chat with upstream to see if this can be done in the
python code and avoid looping through a file list.

Regards,
Anindya

Reply | Threaded
Open this post in threaded view
|

Re: Qutebrowser bug with prefers-color-scheme

Stuart Henderson
Ohhhh I see what it's doing. Yeuch.

'This is a "best effort" parser. If it errors out, we instead end up
relying on the PyQtWebEngine version, which is the next best thing.'

This suggests that the fallback is not working correctly. We aren't doing
anything funny with the PyQtWebEngine version.


--
  Sent from a phone, apologies for poor formatting.
On 6 April 2021 09:41:02 Anindya Mukherjee <[hidden email]> wrote:

> On Tue, Apr 06, 2021 at 09:16:29AM +0100, Stuart Henderson wrote:
>> On 2021/04/05 19:56, Anindya Mukherjee wrote:
>> > Hi,
>> >
>> > Qutebrowser has a bug on OpenBSD which causes the prefers-color-scheme
>> > setting to not work correctly (e.g., test sites show that it is not
>> > supported, etc.). The problem is a hard-coded library filename for
>> > libQt5WebEngineCore.so.5 in
>> > /usr/local/lib/python3.8/site-packages/qutebrowser/misc/elf.py. I worked
>> > with The-Compiler and a fix has been committed upstream:
>> >
>> https://github.com/qutebrowser/qutebrowser/commit/eb6f1cf9898cb431af9d2812ec40f811e37f57f0
>> > Would it be possible to backport this into the current port? I have
>> > tested the patch on my system and it fixes the issue. To test, simply
>> > set colors.webpage.preferred_color_scheme = dark and load
>> > https://www.openbsd.org/faq/. It will be displayed using the light
>> > scheme without this fix, regardless of the above setting.
>> >
>> > OTOH 2.2 is not too far off and updating to that won't need maintaining
>> > a patch. I'm not sure what is the best way to proceed.
>> >
>> > Regards,
>> > Anindya
>> >
>>
>> The fix is not correct, it should not check for existence of the file, just
>> try to dlopen libQt5WebEngineCore.so (no version).
>>
>> See dlopen(3) "When a shared library is specified without a version ..."
>>
>
> Thanks, this makes sense. In fact in my own C code I do exactly what you
> suggested. I'll chat with upstream to see if this can be done in the
> python code and avoid looping through a file list.
>
> Regards,
> Anindya

Reply | Threaded
Open this post in threaded view
|

Re: Qutebrowser bug with prefers-color-scheme

Anindya Mukherjee
On Tue, Apr 06, 2021 at 10:26:49AM +0100, Stuart Henderson wrote:
> Ohhhh I see what it's doing. Yeuch.
>
> 'This is a "best effort" parser. If it errors out, we instead end up relying
> on the PyQtWebEngine version, which is the next best thing.'
>
> This suggests that the fallback is not working correctly. We aren't doing
> anything funny with the PyQtWebEngine version.

For some reason the fallback reports Chromium version as 87.x instead of
83.x which we have. Debug output (just below the logo):
http://ix.io/2V9a

I haven't looked into this further to see exactly why PyQt reports the
wrong version. QtWebEngine is reported as 5.15.4 instead of 5.15.2.

>
>
> --
>  Sent from a phone, apologies for poor formatting.
> On 6 April 2021 09:41:02 Anindya Mukherjee <[hidden email]> wrote:
>
> > On Tue, Apr 06, 2021 at 09:16:29AM +0100, Stuart Henderson wrote:
> > > On 2021/04/05 19:56, Anindya Mukherjee wrote:
> > > > Hi,
> > > >
> > > > Qutebrowser has a bug on OpenBSD which causes the prefers-color-scheme
> > > > setting to not work correctly (e.g., test sites show that it is not
> > > > supported, etc.). The problem is a hard-coded library filename for
> > > > libQt5WebEngineCore.so.5 in
> > > > /usr/local/lib/python3.8/site-packages/qutebrowser/misc/elf.py. I worked
> > > > with The-Compiler and a fix has been committed upstream:
> > > > https://github.com/qutebrowser/qutebrowser/commit/eb6f1cf9898cb431af9d2812ec40f811e37f57f0
> > > > Would it be possible to backport this into the current port? I have
> > > > tested the patch on my system and it fixes the issue. To test, simply
> > > > set colors.webpage.preferred_color_scheme = dark and load
> > > > https://www.openbsd.org/faq/. It will be displayed using the light
> > > > scheme without this fix, regardless of the above setting.
> > > >
> > > > OTOH 2.2 is not too far off and updating to that won't need maintaining
> > > > a patch. I'm not sure what is the best way to proceed.
> > > >
> > > > Regards,
> > > > Anindya
> > > >
> > >
> > > The fix is not correct, it should not check for existence of the file, just
> > > try to dlopen libQt5WebEngineCore.so (no version).
> > >
> > > See dlopen(3) "When a shared library is specified without a version ..."
> > >
> >
> > Thanks, this makes sense. In fact in my own C code I do exactly what you
> > suggested. I'll chat with upstream to see if this can be done in the
> > python code and avoid looping through a file list.
> >
> > Regards,
> > Anindya
>

Reply | Threaded
Open this post in threaded view
|

Re: Qutebrowser bug with prefers-color-scheme

Stuart Henderson
On 2021/04/06 03:13, Anindya Mukherjee wrote:

> On Tue, Apr 06, 2021 at 10:26:49AM +0100, Stuart Henderson wrote:
> > Ohhhh I see what it's doing. Yeuch.
> >
> > 'This is a "best effort" parser. If it errors out, we instead end up relying
> > on the PyQtWebEngine version, which is the next best thing.'
> >
> > This suggests that the fallback is not working correctly. We aren't doing
> > anything funny with the PyQtWebEngine version.
>
> For some reason the fallback reports Chromium version as 87.x instead of
> 83.x which we have. Debug output (just below the logo):
> http://ix.io/2V9a
>
> I haven't looked into this further to see exactly why PyQt reports the
> wrong version. QtWebEngine is reported as 5.15.4 instead of 5.15.2.

Seems that it is picking up the version number of PyQtWebEngine, not QtWebEngine.

If the QtWebEngine version number isn't available from PyQtWebEngine then
I suppose it could look for the highest-numbered library version instead and
use that for the ELF parser..not ideal but at least that should stay working
when QtWebEngine is updated.

Reply | Threaded
Open this post in threaded view
|

Re: Qutebrowser bug with prefers-color-scheme

Dimitri Karamazov
On Tue, Apr 06, 2021 at 11:41:11AM +0100, Stuart Henderson wrote:

> On 2021/04/06 03:13, Anindya Mukherjee wrote:
> > On Tue, Apr 06, 2021 at 10:26:49AM +0100, Stuart Henderson wrote:
> > > Ohhhh I see what it's doing. Yeuch.
> > >
> > > 'This is a "best effort" parser. If it errors out, we instead end up relying
> > > on the PyQtWebEngine version, which is the next best thing.'
> > >
> > > This suggests that the fallback is not working correctly. We aren't doing
> > > anything funny with the PyQtWebEngine version.
> >
> > For some reason the fallback reports Chromium version as 87.x instead of
> > 83.x which we have. Debug output (just below the logo):
> > http://ix.io/2V9a
> >
> > I haven't looked into this further to see exactly why PyQt reports the
> > wrong version. QtWebEngine is reported as 5.15.4 instead of 5.15.2.
>
> Seems that it is picking up the version number of PyQtWebEngine, not QtWebEngine.
>
> If the QtWebEngine version number isn't available from PyQtWebEngine then
> I suppose it could look for the highest-numbered library version instead and
> use that for the ELF parser..not ideal but at least that should stay working
> when QtWebEngine is updated.
>
This patch does the job of finding library with the highest version quite well.
I've tested with the plurality of some base library versions.

regards,
  Dimitri

Index: Makefile
===================================================================
RCS file: /cvs/ports/www/qutebrowser/Makefile,v
retrieving revision 1.28
diff -u -p -r1.28 Makefile
--- Makefile 2 Apr 2021 14:24:40 -0000 1.28
+++ Makefile 6 Apr 2021 13:54:37 -0000
@@ -4,6 +4,7 @@ COMMENT = keyboard-focused browser with
 
 MODPY_EGG_VERSION = 2.1.1
 DISTNAME = qutebrowser-${MODPY_EGG_VERSION}
+REVISION = 0
 
 HOMEPAGE = https://www.qutebrowser.org/
 
Index: patches/patch-qutebrowser_misc_elf_py
===================================================================
RCS file: patches/patch-qutebrowser_misc_elf_py
diff -N patches/patch-qutebrowser_misc_elf_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-qutebrowser_misc_elf_py 6 Apr 2021 13:54:37 -0000
@@ -0,0 +1,18 @@
+$OpenBSD$
+
+Fix QtWebEngine version detection on OpenBSD
+
+Index: qutebrowser/misc/elf.py
+--- qutebrowser/misc/elf.py.orig
++++ qutebrowser/misc/elf.py
+@@ -316,8 +316,8 @@ def parse_webenginecore() -> Optional[Versions]:
+     else:
+         library_path = pathlib.Path(QLibraryInfo.location(QLibraryInfo.LibrariesPath))
+
+-    # PyQt bundles those files with a .5 suffix
+-    lib_file = library_path / 'libQt5WebEngineCore.so.5'
++    library_name = sorted(list(pathlib.Path(library_path).glob('libQt5WebEngineCore.so*')))
++    lib_file = library_path / library_name[-1].as_posix()
+     if not lib_file.exists():
+         return None
+

Reply | Threaded
Open this post in threaded view
|

Re: Qutebrowser bug with prefers-color-scheme

Dimitri Karamazov
In reply to this post by Stuart Henderson
On Tue, Apr 06, 2021 at 11:41:11AM +0100, Stuart Henderson wrote:

> On 2021/04/06 03:13, Anindya Mukherjee wrote:
> > On Tue, Apr 06, 2021 at 10:26:49AM +0100, Stuart Henderson wrote:
> > > Ohhhh I see what it's doing. Yeuch.
> > >
> > > 'This is a "best effort" parser. If it errors out, we instead end up relying
> > > on the PyQtWebEngine version, which is the next best thing.'
> > >
> > > This suggests that the fallback is not working correctly. We aren't doing
> > > anything funny with the PyQtWebEngine version.
> >
> > For some reason the fallback reports Chromium version as 87.x instead of
> > 83.x which we have. Debug output (just below the logo):
> > http://ix.io/2V9a
> >
> > I haven't looked into this further to see exactly why PyQt reports the
> > wrong version. QtWebEngine is reported as 5.15.4 instead of 5.15.2.
>
> Seems that it is picking up the version number of PyQtWebEngine, not QtWebEngine.
>
> If the QtWebEngine version number isn't available from PyQtWebEngine then
> I suppose it could look for the highest-numbered library version instead and
> use that for the ELF parser..not ideal but at least that should stay working
> when QtWebEngine is updated.
>
This patch has been accepted upstream.
`https://github.com/qutebrowser/qutebrowser/pull/6364`

Build & Run Tested on amd64.

regards,
  Dimitri

Index: Makefile
===================================================================
RCS file: /cvs/ports/www/qutebrowser/Makefile,v
retrieving revision 1.28
diff -u -p -r1.28 Makefile
--- Makefile 2 Apr 2021 14:24:40 -0000 1.28
+++ Makefile 6 Apr 2021 18:49:44 -0000
@@ -4,6 +4,7 @@ COMMENT = keyboard-focused browser with
 
 MODPY_EGG_VERSION = 2.1.1
 DISTNAME = qutebrowser-${MODPY_EGG_VERSION}
+REVISION = 0
 
 HOMEPAGE = https://www.qutebrowser.org/
 
Index: patches/patch-qutebrowser_misc_elf_py
===================================================================
RCS file: patches/patch-qutebrowser_misc_elf_py
diff -N patches/patch-qutebrowser_misc_elf_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-qutebrowser_misc_elf_py 6 Apr 2021 18:49:44 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+Fix QtWebEngine version detection on OpenBSD
+
+Index: qutebrowser/misc/elf.py
+--- qutebrowser/misc/elf.py.orig
++++ qutebrowser/misc/elf.py
+@@ -316,9 +316,12 @@ def parse_webenginecore() -> Optional[Versions]:
+     else:
+         library_path = pathlib.Path(QLibraryInfo.location(QLibraryInfo.LibrariesPath))
+
+-    # PyQt bundles those files with a .5 suffix
+-    lib_file = library_path / 'libQt5WebEngineCore.so.5'
+-    if not lib_file.exists():
++    library_name = sorted(library_path.glob('libQt5WebEngineCore.so*'))
++    if not library_name:
++        log.misc.debug(f"No QtWebEngine .so found in {library_path}")
+         return None
++    else:
++        lib_file = library_name[-1]
++        log.misc.debug(f"QtWebEngine .so found at {lib_file}")
+
+     try:

Reply | Threaded
Open this post in threaded view
|

Re: Qutebrowser bug with prefers-color-scheme

Stuart Henderson
In reply to this post by Dimitri Karamazov
On 2021/04/06 14:06, Dimitri Karamazov wrote:

> On Tue, Apr 06, 2021 at 11:41:11AM +0100, Stuart Henderson wrote:
> > On 2021/04/06 03:13, Anindya Mukherjee wrote:
> > > On Tue, Apr 06, 2021 at 10:26:49AM +0100, Stuart Henderson wrote:
> > > > Ohhhh I see what it's doing. Yeuch.
> > > >
> > > > 'This is a "best effort" parser. If it errors out, we instead end up relying
> > > > on the PyQtWebEngine version, which is the next best thing.'
> > > >
> > > > This suggests that the fallback is not working correctly. We aren't doing
> > > > anything funny with the PyQtWebEngine version.
> > >
> > > For some reason the fallback reports Chromium version as 87.x instead of
> > > 83.x which we have. Debug output (just below the logo):
> > > http://ix.io/2V9a
> > >
> > > I haven't looked into this further to see exactly why PyQt reports the
> > > wrong version. QtWebEngine is reported as 5.15.4 instead of 5.15.2.
> >
> > Seems that it is picking up the version number of PyQtWebEngine, not QtWebEngine.
> >
> > If the QtWebEngine version number isn't available from PyQtWebEngine then
> > I suppose it could look for the highest-numbered library version instead and
> > use that for the ELF parser..not ideal but at least that should stay working
> > when QtWebEngine is updated.
> >
> This patch does the job of finding library with the highest version quite well.
> I've tested with the plurality of some base library versions.

Thanks, this seems like the least-worst option available, I've committed it.

Reply | Threaded
Open this post in threaded view
|

Re: Qutebrowser bug with prefers-color-scheme

Anindya Mukherjee
In reply to this post by Dimitri Karamazov
On Tue, Apr 06, 2021 at 02:06:46PM +0000, Dimitri Karamazov wrote:

> On Tue, Apr 06, 2021 at 11:41:11AM +0100, Stuart Henderson wrote:
> > On 2021/04/06 03:13, Anindya Mukherjee wrote:
> > > On Tue, Apr 06, 2021 at 10:26:49AM +0100, Stuart Henderson wrote:
> > > > Ohhhh I see what it's doing. Yeuch.
> > > >
> > > > 'This is a "best effort" parser. If it errors out, we instead end up relying
> > > > on the PyQtWebEngine version, which is the next best thing.'
> > > >
> > > > This suggests that the fallback is not working correctly. We aren't doing
> > > > anything funny with the PyQtWebEngine version.
> > >
> > > For some reason the fallback reports Chromium version as 87.x instead of
> > > 83.x which we have. Debug output (just below the logo):
> > > http://ix.io/2V9a
> > >
> > > I haven't looked into this further to see exactly why PyQt reports the
> > > wrong version. QtWebEngine is reported as 5.15.4 instead of 5.15.2.
> >
> > Seems that it is picking up the version number of PyQtWebEngine, not QtWebEngine.
> >
> > If the QtWebEngine version number isn't available from PyQtWebEngine then
> > I suppose it could look for the highest-numbered library version instead and
> > use that for the ELF parser..not ideal but at least that should stay working
> > when QtWebEngine is updated.
> >
> This patch does the job of finding library with the highest version quite well.
> I've tested with the plurality of some base library versions.
>
> regards,
>   Dimitri
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/www/qutebrowser/Makefile,v
> retrieving revision 1.28
> diff -u -p -r1.28 Makefile
> --- Makefile 2 Apr 2021 14:24:40 -0000 1.28
> +++ Makefile 6 Apr 2021 13:54:37 -0000
> @@ -4,6 +4,7 @@ COMMENT = keyboard-focused browser with
>  
>  MODPY_EGG_VERSION = 2.1.1
>  DISTNAME = qutebrowser-${MODPY_EGG_VERSION}
> +REVISION = 0
>  
>  HOMEPAGE = https://www.qutebrowser.org/
>  
> Index: patches/patch-qutebrowser_misc_elf_py
> ===================================================================
> RCS file: patches/patch-qutebrowser_misc_elf_py
> diff -N patches/patch-qutebrowser_misc_elf_py
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-qutebrowser_misc_elf_py 6 Apr 2021 13:54:37 -0000
> @@ -0,0 +1,18 @@
> +$OpenBSD$
> +
> +Fix QtWebEngine version detection on OpenBSD
> +
> +Index: qutebrowser/misc/elf.py
> +--- qutebrowser/misc/elf.py.orig
> ++++ qutebrowser/misc/elf.py
> +@@ -316,8 +316,8 @@ def parse_webenginecore() -> Optional[Versions]:
> +     else:
> +         library_path = pathlib.Path(QLibraryInfo.location(QLibraryInfo.LibrariesPath))
> +
> +-    # PyQt bundles those files with a .5 suffix
> +-    lib_file = library_path / 'libQt5WebEngineCore.so.5'
> ++    library_name = sorted(list(pathlib.Path(library_path).glob('libQt5WebEngineCore.so*')))
> ++    lib_file = library_path / library_name[-1].as_posix()
> +     if not lib_file.exists():
> +         return None
> +

Thanks!, works for me as well.

Regards,
Anindya