Bug 199265 - net-mgmt/seafile-gui: Segmentation fault while running seafile-applet
Summary: net-mgmt/seafile-gui: Segmentation fault while running seafile-applet
Status: Closed Feedback Timeout
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
Keywords: needs-patch, needs-qa
Depends on:
Reported: 2015-04-07 14:57 UTC by ports
Modified: 2018-01-16 11:27 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (yan_jingfeng)

Relevant logs (14.79 KB, application/x-bzip)
2015-04-07 14:57 UTC, ports
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description ports 2015-04-07 14:57:42 UTC
Created attachment 155306 [details]
Relevant logs

net-mgmt/seafile-gui is segfaulting when trying to run its program (called `seafile-applet`).

It would appear that the segmentation fault is from mismatched linked versions --- seafile-applet is trying to use both libssl.so.8 and libssl.so.7 (note how the backtrace entries 0 and 1 in attached gdb.log link to libssl.so.8 and libssl.so.7, respectively).

Furthermore, neither seafile-gui nor seafile nor ccnet ports can be compiled without `WITH_OPENSSL_PORT`; `pkg-config` cannot find the base OpenSSL.

Attached `sysinfo.txt` contains the relevant system and package versions.

- sysinfo.txt --- system information
- gdb.log --- output from `gdb seafile-applet`
- build.log --- excerpt from (failed) build of seafile-gui
- ccnet.config.log --- config.log from `/usr/ports/net-mgmt/ccnet/work/haiwen-ccnet-1e1aeae/config.log` (mentioned in build.log)
Comment 1 Jingfeng Yan 2015-04-08 01:06:30 UTC
(In reply to ports from comment #0)

In the first port (3.x series) there is incompatible libssl interface between core system and openssl port.  The seafile port should intend to use openssl port instead of core system.  I will investigate this during weekend.
Comment 2 Bernard Spil freebsd_committer 2015-04-08 07:42:04 UTC
Hi Jingfeng,

The OpenSSL port was bumped from 1.0.1 to 1.0.2 recently which comes with a new shared lib version (.7 to .8).

QtNetwork depends on .7 where this port now depends on .8 creating a conflict and I assume causes the segfault.

Relevant part of the backtrace:
#0  0x00000008022962e3 in ssl_create_cipher_list ()
   from /usr/local/lib/libssl.so.8
#1  0x000000080bd3fc3b in SSL_CTX_new () from /usr/lib/libssl.so.7
#2  0x0000000801ad13ae in QSslSocket::qt_metacall ()
   from /usr/local/lib/qt4/libQtNetwork.so.4

Building against base OpenSSL would more likely lead to a functioning binary but the configure script uses pkg-config to detect OpenSSL which fails when used with base SSL.

configure:13173: $PKG_CONFIG --exists --print-errors "openssl"
Package openssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `openssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'openssl', required by 'world', not found
configure:13176: $? = 1
Comment 3 ports 2015-04-08 12:36:34 UTC
If at all possible, I think the best solution would be to use base OpenSSL for FreeBSD 10.x or later (as the base one is a high enough version, unlike in 9.x), and ports OpenSSL for older versions.

This applies to all 3 relevant ports: seafile-gui, seafile and ccnet.

Just my $0.02.
Comment 4 Jingfeng Yan 2015-04-20 03:51:16 UTC
(In reply to ports from comment #3)

Sorry for delaying the reply because I am working on some critical things. WITH_OPENSSL_PORT requirement is necessary so far.  I will try again to see whether we can avoid to use openssl port in the next upgrade.  The reason is when I ported ccnet, and seafile, there were two hash function prototypes require higher version of openssl libs than base system.  Since FreeBSD base system are upgrading, it is likely that the openssl port is not required.  For my preferences, I prefer to using what base system has provided if possible.  I will treat your information/PR as request, and try to see whether we can achieve it. 

(1) For SSL checking failure, which it is possible if the make flag is not set properly.  Base system ssl or other system libs don't be part of pkgconfig system.  Checking procedure from some auto tool marcos always fail. It should be  skipped it, and have other configuration variable to set it.  

(2) The "normal" build out ccnet based on latest port tree depend on the following:
	libevent-2.0.so.5 => /usr/local/lib/libevent-2.0.so.5 (0x800844000)
	libkvm.so.6 => /lib/libkvm.so.6 (0x800a87000)
	libssl.so.8 => /usr/local/lib/libssl.so.8 (0x800c8f000)
	libcrypto.so.8 => /usr/local/lib/libcrypto.so.8 (0x800f02000)
	libuuid.so.1 => /usr/local/lib/libuuid.so.1 (0x801353000)
	libsqlite3.so.0 => /usr/local/lib/libsqlite3.so.0 (0x801557000)
	libsearpc.so.1 => /usr/local/lib/libsearpc.so.1 (0x80185e000)
	libgio-2.0.so.0 => /usr/local/lib/libgio-2.0.so.0 (0x801a65000)
	libgobject-2.0.so.0 => /usr/local/lib/libgobject-2.0.so.0 (0x801dcb000)
	libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x802013000)
	libintl.so.8 => /usr/local/lib/libintl.so.8 (0x80231a000)
	libjansson.so.4 => /usr/local/lib/libjansson.so.4 (0x802524000)
	libc.so.7 => /lib/libc.so.7 (0x802732000)
	libthr.so.3 => /lib/libthr.so.3 (0x802adb000)
	libffi.so.6 => /usr/local/lib/libffi.so.6 (0x802d00000)
	libgmodule-2.0.so.0 => /usr/local/lib/libgmodule-2.0.so.0 (0x802f07000)
	libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x80310a000)
	libpcre.so.1 => /usr/local/lib/libpcre.so.1 (0x803403000)
	libz.so.6 => /lib/libz.so.6 (0x803670000)

(3) The "normal" build out seafile-gui could be loaded, and its dependencies are as the follow:
	libQtGui.so.4 => /usr/local/lib/qt4/libQtGui.so.4 (0x800a0b000)
	libQtDBus.so.4 => /usr/local/lib/qt4/libQtDBus.so.4 (0x801760000)
	libQtNetwork.so.4 => /usr/local/lib/qt4/libQtNetwork.so.4 (0x8019eb000)
	libQtCore.so.4 => /usr/local/lib/qt4/libQtCore.so.4 (0x801d43000)
	libssl.so.8 => /usr/local/lib/libssl.so.8 (0x802246000)
	libcrypto.so.8 => /usr/local/lib/libcrypto.so.8 (0x8024b9000)
	libsqlite3.so.0 => /usr/local/lib/libsqlite3.so.0 (0x80290a000)
	libjansson.so.4 => /usr/local/lib/libjansson.so.4 (0x802c11000)
	libsearpc.so.1 => /usr/local/lib/libsearpc.so.1 (0x802e1f000)
	libgio-2.0.so.0 => /usr/local/lib/libgio-2.0.so.0 (0x803026000)
	libgobject-2.0.so.0 => /usr/local/lib/libgobject-2.0.so.0 (0x80338c000)
	libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x8035d4000)
	libintl.so.8 => /usr/local/lib/libintl.so.8 (0x8038db000)
	libccnet.so.0 => /usr/local/lib/libccnet.so.0 (0x803ae5000)
	libevent-2.0.so.5 => /usr/local/lib/libevent-2.0.so.5 (0x803d01000)
	libuuid.so.1 => /usr/local/lib/libuuid.so.1 (0x803f44000)
	libseafile.so.0 => /usr/local/lib/libseafile.so.0 (0x804148000)
	libc++.so.1 => /usr/lib/libc++.so.1 (0x80436b000)
	libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x80462b000)
	libm.so.5 => /lib/libm.so.5 (0x804847000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x804a6f000)
	libc.so.7 => /lib/libc.so.7 (0x804c7d000)
	libgthread-2.0.so.0 => /usr/local/lib/libgthread-2.0.so.0 (0x805026000)
	libpng16.so.16 => /usr/local/lib/libpng16.so.16 (0x805227000)
	libz.so.6 => /lib/libz.so.6 (0x80545f000)
	libfreetype.so.6 => /usr/local/lib/libfreetype.so.6 (0x805675000)
	libSM.so.6 => /usr/local/lib/libSM.so.6 (0x80590b000)
	libICE.so.6 => /usr/local/lib/libICE.so.6 (0x805b12000)
	libXrender.so.1 => /usr/local/lib/libXrender.so.1 (0x805d2c000)
	libfontconfig.so.1 => /usr/local/lib/libfontconfig.so.1 (0x805f34000)
	libXext.so.6 => /usr/local/lib/libXext.so.6 (0x806173000)
	libX11.so.6 => /usr/local/lib/libX11.so.6 (0x806384000)
	libthr.so.3 => /lib/libthr.so.3 (0x8066b7000)
	libQtXml.so.4 => /usr/local/lib/qt4/libQtXml.so.4 (0x8068dc000)
	libffi.so.6 => /usr/local/lib/libffi.so.6 (0x806b2e000)
	libgmodule-2.0.so.0 => /usr/local/lib/libgmodule-2.0.so.0 (0x806d35000)
	libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x806f38000)
	libpcre.so.1 => /usr/local/lib/libpcre.so.1 (0x807231000)
	libbz2.so.4 => /usr/lib/libbz2.so.4 (0x80749e000)
	libexpat.so.1 => /usr/local/lib/libexpat.so.1 (0x8076b0000)
	libxcb.so.1 => /usr/local/lib/libxcb.so.1 (0x8078d6000)
	librpcsvc.so.5 => /usr/lib/librpcsvc.so.5 (0x807af4000)
	libXau.so.6 => /usr/local/lib/libXau.so.6 (0x807cfd000)
	libpthread-stubs.so.0 => /usr/local/lib/libpthread-stubs.so.0 (0x807eff000)
	libXdmcp.so.6 => /usr/local/lib/libXdmcp.so.6 (0x808100000)
Comment 5 ports 2015-04-21 16:20:47 UTC
(In reply to Jingfeng Yan from comment #4)

No problem regarding the delay, but I am curious --- do you have an ETA for a (attempted?) fix?
Comment 6 ports 2015-07-03 21:39:23 UTC
Any updates regarding this? I am itching to get Seafile working on BSD again.
Comment 7 commit-hook freebsd_committer 2015-07-19 11:29:34 UTC
A commit references this bug:

Author: bapt
Date: Sun Jul 19 11:28:38 UTC 2015
New revision: 392493
URL: https://svnweb.freebsd.org/changeset/ports/392493

  Make ccnet respect USE_OPENSSL correctly without enforcing any version

  PR:		199265
  Reported by:	ports@stdrand.com

Comment 8 commit-hook freebsd_committer 2015-07-19 11:35:37 UTC
A commit references this bug:

Author: bapt
Date: Sun Jul 19 11:35:26 UTC 2015
New revision: 392494
URL: https://svnweb.freebsd.org/changeset/ports/392494

  Properly respect OPENSSL_PORT (while here use libarchive from base)

  PR:		199265
  Reported by:	ports@stdrand.com

Comment 9 commit-hook freebsd_committer 2015-07-19 11:52:40 UTC
A commit references this bug:

Author: bapt
Date: Sun Jul 19 11:52:31 UTC 2015
New revision: 392496
URL: https://svnweb.freebsd.org/changeset/ports/392496


  Prevent the build system from using pkg-config to lookup for openssl
  Enforce passing the variables expected (only libcrypto os used)

  PR:		199265
  Reported by:	ports@stdrand.com

Comment 10 Kubilay Kocak freebsd_committer freebsd_triage 2015-07-19 16:54:37 UTC
Assign to committer that resolved/closed.
Comment 11 Dmitry Marakasov freebsd_committer 2015-07-27 20:10:01 UTC
Note that ccnet was broken on 9.x by commit related to this PR. It needs to enforce ports version of openssl there as system one is too old. Same problem may affect other ports.
Comment 12 commit-hook freebsd_committer 2015-07-27 20:10:43 UTC
A commit references this bug:

Author: amdmi3
Date: Mon Jul 27 20:10:07 UTC 2015
New revision: 393029
URL: https://svnweb.freebsd.org/changeset/ports/393029

  - Fix build on pre-10.x by enforcing OpenSSL from ports

  PR:		199265
  Approved by:	portmgr blanket

Comment 13 ports 2016-04-04 20:24:22 UTC
I apologize for the delay --- I've been experimenting with trying to get the 4.3x branch of Seafile working in the meantime (unsuccessfully, I might add), so I completely forgot about the updates to this issue.

I'd like to report that the problem was NOT resolved by that update, so I'm reopening the issue. The problem persists --- segfault on start.
Comment 14 ports 2016-04-04 21:02:22 UTC
UPDATE: I've tried building seafile-applet, seafile, and ccnet now --- they build fine (unlike previously), but still crash. It looks like seafile still depends on the port OpenSSL; not sure if this is intentional.

The new `gdb` log is *EXACTLY* the same as the previously-uploaded one (except function addresses are slightly different --- obv. due to recompiling with a different-version compiler).

Here is the info of the system I was trying this on:
$ uname -a
FreeBSD tsibsd.tsi 10.3-RELEASE FreeBSD 10.3-RELEASE #0 r297264: Fri Mar 25 02:10:02 UTC 2016     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
$ pkg -v
$ pkg info | grep 'seafile\|ccnet\|openssl'
ccnet-4.0.6_6                  Framework for writing networked applications
openssl-1.0.2_11               SSL and crypto library
seafile-4.0.6_3                Framework for writing networked applications
seafile-gui-4.1.0_1            Seafile desktop client

(side-note: I'm pretty sure the description for `seafile` is incorrect, as it's NOT a framework for writing networked applications)
Comment 15 Ultima 2016-04-14 19:25:54 UTC
 Can you please test my patches and see if this issue still exists? I just happen to find this PR. I'v been using seafile-applet for some time now on 10-STABLE and head and have not had this issue for a long time now. The patches are 203933 and depends/blocks. Should be 6 patches total. 3 without seahub.
Comment 16 Ultima 2016-06-06 23:44:49 UTC
(In reply to ports from comment #14)
Seafile was recently updated. Are you still having this issue occurring or has it been fixed?