Bug#987652: surf does not start

2021-04-27 Thread Aymeric Agon-Rambosson



Hello Herr Sprickerhof,

First of all thank you for your quick answer. Your last remark 
gave me the hint I needed :


It turns out I had a stale libsurf-webext.so in the directory 
/usr/local/lib/surf, removing it solved the problem. This is due 
to the fact that upstream changed the name of the library from 
libsurf-webext.c to webext-surf.c between debian/2.0+git20181009 
and debian/2.0+git20201107, which means that a not careful enough 
direct use of the Makefile (make install once in each branch, not 
separated with a make uninstall) would mean that two versions of 
the shared object library (the stale one libsurf-webext.so, and 
the new one webext-surf.so) would cohabit in the same directory 
/usr/local/lib/surf.


These two shared object libraries would have competing versions of 
each symbol, and more specifically two versions of the culprit 
symbol webkit_web_initialize_with_user_data() :
- one (libsurf-webext.so) that would have g_variant_get(gv, 
 "(ii)", , )
- the other (webext-surf.so) that would have g_variant_get(gv, 
 "i", )


Since in the new version (debian/2.0+git20201107), gv would be 
created like this :

gv = g_variant_new("i", spair[1])

surf would work correctly only if the dynamic linking would use 
webext-surf.so, and crash if the dynamic linking had chosen 
libsurf-webext.so. I have no idea how the choice is made 
(alphabetic order of each shared object file maybe ??), but it 
seems the dynamic linking systematically chose the stale file 
before we removed it.


So the problem was entirely my fault, and a more careful direct 
use of the Makefile solved the problem. So I am sorry for having 
wasted your time.


However, the stuff I do on my own patched version of surf (that 
goes in /usr/local/bin, with the shared object going in 
/usr/local/lib/surf/) should have no influence on the Debian 
version of surf living in /usr/bin : even when I launched 
/usr/bin/surf, the stale library 
/usr/local/lib/surf/libsurf-webext.so would be used over 
/usr/lib/surf/webext-surf.so ! So a user-compiled shared object 
(in /usr/local) would take precedence over a Debian-compiled 
version (in /usr), even when the binary is itself in /usr ?


This, in my opinion, is still a bug (albeit a lot less severe and 
a lot more subtle, and arguably a different one). What is the next 
course of action ?


The symbol webkit_web_initialize_with_user_data() is not called 
from surf, but from webkit. So the bug lies not with the surf 
package, but probably with the libwebkit2gtk-4.0-37.


So the original bug (surf not starting) can be closed (I have no 
idea how to do that). I'll let you tell me whether you agree with 
my opinion that webkit should try to resolve 
webkit_web_initialize_with_user_data() from /usr/lib/surf and not 
from /usr/local/lib/surf when the binary is /usr/bin/surf, and 
whether this warrants another bug report (and in which package ) ?


Thank you again for your time reading this long message,

Best regards,

Aymeric Agon-Rambosson


Jochen Sprickerhof  writes:

* Aymeric Agon-Rambosson  [2021-04-27 
03:18]:

$ /usr/bin/surf

output :

(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.728: the 
GVariant format string '(ii)' has a type of '(ii)' but the given 
value has a type of 'i'


(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.728: 
g_variant_get: assertion 'valid_format_string (format_string, 
TRUE, value)' failed


(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.729: the 
GVariant format string '(ii)' has a type of '(ii)' but the given 
value has a type of 'i'


(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.729: 
g_variant_get: assertion 'valid_format_string (format_string, 
TRUE, value)' failed

web process terminated: crashed


Also, can you check if you have a custom webext-surf.so in your
~/.surf or elsewhere in your ld path?




Bug#987652: surf does not start

2021-04-27 Thread Jochen Sprickerhof

* Aymeric Agon-Rambosson  [2021-04-27 03:18]:

$ /usr/bin/surf

output :

(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.728: the GVariant format 
string '(ii)' has a type of '(ii)' but the given value has a type of 'i'

(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.728: g_variant_get: 
assertion 'valid_format_string (format_string, TRUE, value)' failed

(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.729: the GVariant format 
string '(ii)' has a type of '(ii)' but the given value has a type of 'i'

(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.729: g_variant_get: 
assertion 'valid_format_string (format_string, TRUE, value)' failed
web process terminated: crashed


Also, can you check if you have a custom webext-surf.so in your ~/.surf 
or elsewhere in your ld path?


signature.asc
Description: PGP signature


Bug#987652: surf does not start

2021-04-27 Thread Jochen Sprickerhof

Control: severity -1 normal
Control: tags -1 = moreinfo unreproducible

Hi,

I was not able to reproduce this on testing nor unstable.

* Aymeric Agon-Rambosson  [2021-04-27 03:18]:

$ /usr/bin/surf

output :

(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.728: the GVariant format 
string '(ii)' has a type of '(ii)' but the given value has a type of 'i'

(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.728: g_variant_get: 
assertion 'valid_format_string (format_string, TRUE, value)' failed

(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.729: the GVariant format 
string '(ii)' has a type of '(ii)' but the given value has a type of 'i'

(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.729: g_variant_get: 
assertion 'valid_format_string (format_string, TRUE, value)' failed
web process terminated: crashed


Can you attach a gdb and send a backtrace?


The problem can be traced back to this specific upstream commit : 
e92fd1aa5f38c399f8fc5d263026fbd9d34ddfbb

Which can be found at 
https://git.suckless.org/surf/commit/e92fd1aa5f38c399f8fc5d263026fbd9d34ddfbb.html


That is there since over a year and I'm not aware of any issues with it, 
probably a red herring. How did you test that?



-- Configuration Files:
/etc/apparmor.d/usr.bin.surf changed:


Probably unrelated but maybe a good idea to reset this to the default.

Cheers Jochen


signature.asc
Description: PGP signature


Bug#987652: surf does not start

2021-04-26 Thread Aymeric Agon-Rambosson
Package: surf
Version: 2.0+git20201107-2
Severity: grave
Tags: upstream
Justification: renders package unusable

Dear Maintainer,

surf does not start anymore since version 2.0+git20201107.

Expected behaviour : surf should start.

Steps to reproduce :

$ /usr/bin/surf

output :

(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.728: the GVariant format 
string '(ii)' has a type of '(ii)' but the given value has a type of 'i'

(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.728: g_variant_get: 
assertion 'valid_format_string (format_string, TRUE, value)' failed

(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.729: the GVariant format 
string '(ii)' has a type of '(ii)' but the given value has a type of 'i'

(WebKitWebProcess:94294): GLib-CRITICAL **: 02:49:52.729: g_variant_get: 
assertion 'valid_format_string (format_string, TRUE, value)' failed
web process terminated: crashed

And surf crashes.

The problem can be traced back to this specific upstream commit : 
e92fd1aa5f38c399f8fc5d263026fbd9d34ddfbb

Which can be found at 
https://git.suckless.org/surf/commit/e92fd1aa5f38c399f8fc5d263026fbd9d34ddfbb.html

One possible fix/workaround is the following :

diff --git a/surf.c b/surf.c
index ac832ff..e84a538 100644
--- a/surf.c
+++ b/surf.c
@@ -1269,7 +1269,7 @@ initwebextensions(WebKitWebContext *wc, Client *c)
if (spair[1] < 0)
return;
 
-   gv = g_variant_new("i", spair[1]);
+   gv = g_variant_new("(ii)", spair[1]);
 
webkit_web_context_set_web_extensions_initialization_user_data(wc, gv);
webkit_web_context_set_web_extensions_directory(wc, WEBEXTDIR);
diff --git a/webext-surf.c b/webext-surf.c
index d087219..da16ddf 100644
--- a/webext-surf.c
+++ b/webext-surf.c
@@ -95,7 +95,7 @@ 
webkit_web_extension_initialize_with_user_data(WebKitWebExtension *e,
 
webext = e;
 
-   g_variant_get(gv, "i", );
+   g_variant_get(gv, "(ii)", );
 
gchansock = g_io_channel_unix_new(sock);
g_io_channel_set_encoding(gchansock, NULL, NULL);

But this workaround seems wrong when we look at the semantic of g_variant_new() 
in
gvariant.c :
- sock and spair[1] are ints, and should work with "i".
- Similarly, "(ii)" should mean two extra arguments after the format, but only 
 works.

And I don't know whether this fix breaks surf in another way.

One other way would be to revert to 2.0+git20181009-4, or some other version 
inbetween.

Thank you in advance for your time,

Aymeric Agon-Rambosson


-- System Information:
Debian Release: bullseye/sid
  APT prefers testing-security
  APT policy: (500, 'testing-security'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-6-amd64 (SMP w/16 CPU threads)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages surf depends on:
ii  libc62.31-11
ii  libgcr-base-3-1  3.38.1-2
ii  libgcr-ui-3-13.38.1-2
ii  libglib2.0-0 2.66.8-1
ii  libgtk-3-0   3.24.24-3
ii  libjavascriptcoregtk-4.0-18  2.30.6-1
ii  libwebkit2gtk-4.0-37 2.30.6-1
ii  libx11-6 2:1.7.0-2

Versions of packages surf recommends:
ii  curl  7.74.0-1.2
ii  stterm [x-terminal-emulator]  0.8.4-1
ii  suckless-tools46-1
ii  x11-utils 7.7+5

Versions of packages surf suggests:
ii  apparmor  2.13.6-10

-- Configuration Files:
/etc/apparmor.d/usr.bin.surf changed:
/usr/bin/surf flags=(complain) {
  #include 
  #include 
  #include 
  #include 
  #include 
  #include 
  #include 
  #include 
  #include 
  #include 
  #include 
  #include 
  #include 
  owner @{HOME}/.surf/ w,
  owner @{HOME}/.surf/** rwkl,
  owner @{HOME}/.cache/ rw,
  @{PROC}/@{pid}/cmdline r,
  @{PROC}/@{pid}/fd/ r,
  @{PROC}/@{pid}/smaps r,
  /dev/ r,
  /sys/devices/pci[0-9]*/** r,
  /sys/devices/platform/soc/soc:gpu/* r,
  /usr/share/glib-2.0/schemas/gschemas.compiled r,
  /usr/share/doc/** r,
  # WebKit
  /usr/lib/@{multiarch}/webkit2gtk-4.0/WebKit*Process ix,
  /{dev,run}/shm/WK2SharedMemory.* rw,
  /var/tmp/WebKit-Media-* rw,
  /usr/share/publicsuffix/public_suffix_list.{dat,dafsa} r,
  owner @{HOME}/.local/share/webkitgtk/ w,
  owner @{HOME}/.local/share/webkitgtk/** rw,
  owner @{HOME}/.cache/webkitgtk/ w,
  owner @{HOME}/.cache/webkitgtk/** rwk,
  # fontconfig
  /usr/share/fontconfig/conf.avail/ r,
  # dconf
  owner @{HOME}/.cache/dconf/user rw,
  owner /run/user/*/dconf/user rw,
  /usr/bin/surf ix,
  /{usr/,}bin/dash ix,
  /{usr/,}bin/sed ix,
  /usr/bin/dmenu ix,
  /usr/bin/printf ix,
  /usr/bin/xargs ix,
  /usr/bin/xprop ix,
  # for downloading files
  /dev/ptmx rw,
  /dev/pts/* rw,
  /usr/bin/st ix,
  # unconfined because it is called in (and downloading to) the cwd
  /usr/bin/curl Ux,
  #