Bug 248819 - security/p11-kit: Update to 0.23.21
Summary: security/p11-kit: Update to 0.23.21
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Roman Bogorodskiy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-21 23:29 UTC by daniel.engberg.lists
Modified: 2020-08-30 03:11 UTC (History)
2 users (show)

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


Attachments
Patch for p11-kit (7.21 KB, patch)
2020-08-21 23:29 UTC, daniel.engberg.lists
no flags Details | Diff
[patch] modify linker scripts to work with older ld(1) (1.65 KB, patch)
2020-08-29 21:40 UTC, John Hein
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description daniel.engberg.lists 2020-08-21 23:29:09 UTC
Created attachment 217431 [details]
Patch for p11-kit

Update p11-kit to 0.23.21
Convert to using Meson instead of GNU Autotools [1]
Make bash-completion, DOCS and MANPAGES optional

[1]
0.23.20 using gmake
====> Compressing man pages (compress-man)
        32.53s real             44.97s user             13.83s sys
0.23.21 using Meson (DOCS and MANPAGES enabled, dependencies already compiled)
====> Compressing man pages (compress-man)
        17.12s real             30.54s user             1.98s sys
0.23.21 using Meson (all options enabled)
====> Compressing man pages (compress-man)
        22.56s real             1m17.45s user           3.63s sys

Tested on: 
FreeBSD 13.0-CURRENT r361421 amd64 (make test) - Test OK
Poudriere testport OK 12.1-RELEASE (amd64)
Comment 1 Roman Bogorodskiy freebsd_committer 2020-08-22 02:44:47 UTC
(In reply to daniel.engberg.lists from comment #0)

Thanks, this looks good to me.
The only thing I plan to change is add

OPTIONS_DEFAULT=        BASH MANPAGES

to make thing convenient for package users.

Testing now.
Comment 2 commit-hook freebsd_committer 2020-08-22 04:35:48 UTC
A commit references this bug:

Author: novel
Date: Sat Aug 22 04:35:43 UTC 2020
New revision: 545735
URL: https://svnweb.freebsd.org/changeset/ports/545735

Log:
  security/p11-kit: update to 0.23.21

   - Update to 0.23.21
   - Convert to using Meson instead of GNU Autotools
   - Make bash-completion, DOCS and MANPAGES optional

  PR:		248819
  Submitted by:	daniel.engberg.lists@pyret.net

Changes:
  head/security/p11-kit/Makefile
  head/security/p11-kit/distinfo
  head/security/p11-kit/pkg-plist
Comment 3 Roman Bogorodskiy freebsd_committer 2020-08-22 04:38:26 UTC
Committed, thanks!
Comment 4 John Hein 2020-08-29 19:23:46 UTC
On trying to build security/gnupg today, I got the following failure:

cc -std=gnu99 -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include  -I/usr/local/include -I/usr/local/include/p11-kit-1  -Wall -Wno-pointer-sign -Wpointer-arith -O2 -pipe  -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing   -L/usr/local/lib -fstack-protector-strong  -o dirmngr dirmngr.o server.o crlcache.o crlfetch.o certcache.o domaininfo.o workqueue.o loadswdb.o cdblib.o misc.o ocsp.o validate.o dns-stuff.o http.o http-common.o http-ntbtls.o ks-action.o ks-engine-hkp.o ks-engine-http.o ks-engine-finger.o ks-engine-kdns.o dns.o  ../common/libcommonpth.a  -lassuan -L/usr/local/lib -lgpg-error -L/usr/local/lib -lgcrypt -lgpg-error -L/usr/local/lib -lksba -lgpg-error -L/usr/local/lib -lnpth -lpthread  -L/usr/local/lib -lgnutls  /usr/local/lib/libintl.so -Wl,-rpath -Wl,/usr/local/lib     
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_strerror@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_module_release@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_space_strdup@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_uri_get_module_info@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_module_get_name@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_uri_get_pin_value@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_pin_unref@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_pin_new_for_string@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_message@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_uri_get_attribute@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_space_strlen@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_pin_file_callback@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_uri_parse@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_config_option@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_uri_set_attribute@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_uri_match_token_info@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_uri_get_token_info@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_module_get_flags@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_module_initialize@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_modules_load_and_initialize@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_module_load@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_pin_request@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_pin_register_callback@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_uri_get_pin_source@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_uri_new@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_uri_free@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_module_finalize@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_uri_format@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_uri_get_attributes@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_pin_get_length@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_pin_unregister_callback@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_pin_get_value@LIBP11_KIT_1.0'
/usr/local/lib/libgnutls.so: undefined reference to `p11_kit_uri_match_module_info@LIBP11_KIT_1.0'

% pkg query '%n %v %t' p11-kit gnutls ; !!
pkg query '%n %v %t' p11-kit gnutls ; pkg query ' %t' p11-kit gnutls | xargs -I% date -r %
p11-kit 0.23.21 1598229077
gnutls 3.6.14 1595519956
Sun Aug 23 18:31:17 MDT 2020
Thu Jul 23 09:59:16 MDT 2020


It looks like libp11-kit.so now no longer has symbols in the LIBP11_KIT_1.0 namespace.  And I think this comes from the switch to meson - the meson build probably ignores the linker script (unchanged from 0.23.20 to 0.23.21), p11-kit-0.23.21/p11-kit/libp11-kit.map

I don't have a fix for this yet, but this causes a previously installed gnutls port to break because the new libp11-kit.so no longer has symbols in the namespace that a previously built libgnutls.so expected.


The right fix is probably to get meson to use the linker script.  I don't know meson well enough yet to suggest how to do that.

A workaround might be to bump PORTREVISION for p11-kit consumers.  That's a hack since p11-kit should be building with the linker namespace that upstream intends.

Another workaround is to forcibly rebuild the dependent ports without bumping PORTREVISION.  This would just be an option to get people working who have hit this problem.


You should be able to reproduce by building the old p11-kit and gnutls.  Then update to the new p11-kit.  Then try building security/gnupg (or probably anything that links with libgnutls?).


Maybe this bug should be re-opened, or we can open a new bug.
Comment 5 John Hein 2020-08-29 20:14:41 UTC
(In reply to John Hein from comment #4)
This was on 11-stable, by the way.
Comment 6 John Hein 2020-08-29 20:39:20 UTC
(In reply to John Hein from comment #5)
The problem seems to be that (on stable-11 at least), the linker fails when meson tries to see if --version-script works at configure time:


from meson-logs.txt:

Working directory:  /wrkdirs/usr/ports/security/p11-kit/work/p11-kit-0.23.21/_build/meson-private/tmp48_ap8zq
Command line:  cc /wrkdirs/usr/ports/security/p11-kit/work/p11-kit-0.23.21/_build/meson-private/tmp48_ap8zq/testfile.c -o /wrkdirs/usr/ports/security/p11-kit/work/p11-kit-0.23.21/_build/meson-private/tmp48_ap8zq/output.exe -pipe -O2 -fstack-protector-strong -isystem /usr/loc/include -fno-strict-aliasing -isystem /usr/loc/include -D_FILE_OFFSET_BITS=64 -O0 -Wl,--fatal-warnings -Wl,--version-script,/wrkdirs/usr/ports/security/p11-kit/work/p11-kit-0.23.21/p11-kit/libp11-kit.map

Code:
 int main(void) { return 0; }
Compiler stdout:

Compiler stderr:
 /usr/bin/ld: /wrkdirs/usr/ports/security/p11-kit/work/p11-kit-0.23.21/_build/meson-private/tmp48_ap8zq/output.exe: local symbol `__progname' in /usr/lib/crt1.o is referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 7 John Hein 2020-08-29 20:42:39 UTC
(In reply to John Hein from comment #6)
Here's a simple test case that shows why the meson configure test is failing (uses /usr/bin/ld by default) and an example using lld that does not fail.  Again this is on 11-stable.


% cat lscript-test.c
int
main()
{return 0;}

% cc -fuse-ld=ld lscript-test.c -o /dev/null -Wl,--version-script,p11-kit/libp11-kit.map -v
FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
Target: x86_64-unknown-freebsd11.4
Thread model: posix
InstalledDir: /usr/bin
 "/usr/bin/cc" -cc1 -triple x86_64-unknown-freebsd11.4 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name lscript-test.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /usr/lib/clang/8.0.1 -fdebug-compilation-dir /usr/ports/security/p11-kit/work/p11-kit-0.23.21 -ferror-limit 19 -fmessage-length 118 -fobjc-runtime=gnustep -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/lscript-test-7959e5.o -x c lscript-test.c -faddrsig
clang -cc1 version 8.0.1 based upon LLVM 8.0.1 default target x86_64-unknown-freebsd11.4
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/clang/8.0.1/include
 /usr/include
End of search list.
 "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o /dev/null /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib /tmp/lscript-test-7959e5.o --version-script p11-kit/libp11-kit.map -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o
/usr/bin/ld: /dev/null: local symbol `__progname' in /usr/lib/crt1.o is referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output
cc: error: linker command failed with exit code 1 (use -v to see invocation)



% cc -fuse-ld=lld lscript-test.c -o /dev/null -Wl,--version-script,p11-kit/libp11-kit.map -v
FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
Target: x86_64-unknown-freebsd11.4
Thread model: posix
InstalledDir: /usr/bin
 "/usr/bin/cc" -cc1 -triple x86_64-unknown-freebsd11.4 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name lscript-test.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /usr/lib/clang/8.0.1 -fdebug-compilation-dir /usr/ports/security/p11-kit/work/p11-kit-0.23.21 -ferror-limit 19 -fmessage-length 118 -fobjc-runtime=gnustep -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/lscript-test-131b3d.o -x c lscript-test.c -faddrsig
clang -cc1 version 8.0.1 based upon LLVM 8.0.1 default target x86_64-unknown-freebsd11.4
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/clang/8.0.1/include
 /usr/include
End of search list.
 "/usr/bin/ld.lld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o /dev/null /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib /tmp/lscript-test-131b3d.o --version-script p11-kit/libp11-kit.map -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o
Comment 8 John Hein 2020-08-29 20:50:01 UTC
(In reply to John Hein from comment #7)
Adding -shared for the linker script tests is one way to work around the problem:

% cc -fuse-ld=ld lscript-test.c -shared -o /dev/null -Wl,--version-script,p11-kit/libp11-kit.map && echo ok
ok
Comment 9 John Hein 2020-08-29 20:52:13 UTC
(In reply to John Hein from comment #8)
Reference for the -shared workaround:

https://github.com/mesonbuild/meson/issues/3923
Comment 10 John Hein 2020-08-29 20:57:26 UTC
(In reply to John Hein from comment #9)
Here's another way (from a recent commit to devel/libnotify):

https://svnweb.freebsd.org/ports?view=revision&revision=520283

--- libnotify/libnotify.map.orig        2019-04-05 19:06:19 UTC
+++ libnotify/libnotify.map
@@ -1,6 +1,8 @@
 {
 global:
     notify_*;
+    __progname;
+    environ;
 local:
     *;
 };


The same could be applied to p11-kit/libp11-kit.map
Comment 11 John Hein 2020-08-29 21:40:54 UTC
Created attachment 217626 [details]
[patch] modify linker scripts to work with older ld(1)

(In reply to John Hein from comment #10)
Here's the change I wound up using locally to fix the problem.

I think I like using -shared better since the change to the .map files is more freebsd specific.  But I could not figure out how to convince 'meson configure' to use -shared.
Comment 12 daniel.engberg.lists 2020-08-29 22:41:38 UTC
Hi, John

Consumers should be bumped in this case. Please create a new PR next time as it makes issues such as this one much easier to track.

Roman, can you bump portrevision of consumers?
Comment 13 commit-hook freebsd_committer 2020-08-30 03:11:23 UTC
A commit references this bug:

Author: novel
Date: Sun Aug 30 03:10:27 UTC 2020
New revision: 546967
URL: https://svnweb.freebsd.org/changeset/ports/546967

Log:
  Chase security/p11-kit update

  After switch to meson libp11-kit.so no longer has symbols
  in the LIBP11_KIT_1.0 namespace. As a workaround, bump
  PORTREVISION of consumers to get those rebuilt.

  See more details in the comments of the linked PR.

  PR:		248819
  Reported by:	John Hein

Changes:
  head/biology/ncbi-blast+/Makefile
  head/biology/ncbi-toolkit/Makefile
  head/databases/evolution-data-server/Makefile
  head/devel/gvfs/Makefile
  head/devel/libgdata/Makefile
  head/mail/evolution/Makefile
  head/net/glib-networking/Makefile
  head/net/gnome-online-accounts/Makefile
  head/net-p2p/ncdc/Makefile
  head/security/gcr/Makefile
  head/security/gnome-keyring/Makefile
  head/security/gnutls/Makefile
  head/security/softhsm2/Makefile
  head/www/epiphany/Makefile
  head/www/midori/Makefile
  head/x11/gnome-shell/Makefile