Thu Aug 17 20:06:53 2023 UTC ()
Pullup ticket #6791 - requested by manu
security/opensc: fix regression

Revisions pulled up:
- security/opensc/Makefile                                      1.41
- security/opensc/PLIST                                         1.15
- security/opensc/options.mk                                    1.7

---
   Module Name:    pkgsrc
   Committed By:   manu
   Date:           Mon Aug 14 16:08:32 UTC 2023

   Modified Files:
           pkgsrc/security/opensc: Makefile PLIST options.mk

   Log Message:
   Fix for security/opensc regression

   When security/opensc was updated to 0.23.0, it gained a
   --enable-notify configure flag.

   The feature adds a libopensc dependency on libglib, which in turns
   brings libpthread into the game.

   When using the opensc-pkcs11.so module with a non threaded program
   such as ssh(1), libopensc will load some thread-enabled glib function
   that attemps to initialize pthread stuff. That would require libpthread
   to be linked in, and if it is not the case, module load aborts.
   Here is the crash in action:

   Program received signal SIGABRT, Aborted.
   0x000072403899c46a in _lwp_kill () from /lib/libc.so.12
   (gdb) bt
   #0  0x000072403899c46a in _lwp_kill () from /lib/libc.so.12
   #1  0x0000724038849223 in __libc_thr_create_stub () from /lib/libc.so.12
   #2  0x0000724036a9c3ee in ?? ()
   #3  0x0000000000000000 in ?? ()

   This change turns the notify feature into a disabled by default
   option so that opensc-pkcs11.so can work agan with ssh(1).


(bsiegert)
diff -r1.40 -r1.40.2.1 pkgsrc/security/opensc/Makefile
diff -r1.14 -r1.14.4.1 pkgsrc/security/opensc/PLIST
diff -r1.6 -r1.6.4.1 pkgsrc/security/opensc/options.mk

cvs diff -r1.40 -r1.40.2.1 pkgsrc/security/opensc/Makefile (expand / switch to unified diff)

--- pkgsrc/security/opensc/Makefile 2023/06/06 12:42:14 1.40
+++ pkgsrc/security/opensc/Makefile 2023/08/17 20:06:53 1.40.2.1
@@ -1,47 +1,45 @@ @@ -1,47 +1,45 @@
1# $NetBSD: Makefile,v 1.40 2023/06/06 12:42:14 riastradh Exp $ 1# $NetBSD: Makefile,v 1.40.2.1 2023/08/17 20:06:53 bsiegert Exp $
2 2
3DISTNAME= opensc-0.23.0 3DISTNAME= opensc-0.23.0
4PKGREVISION= 1 4PKGREVISION= 2
5CATEGORIES= security 5CATEGORIES= security
6MASTER_SITES= ${MASTER_SITE_GITHUB:=OpenSC/} 6MASTER_SITES= ${MASTER_SITE_GITHUB:=OpenSC/}
7 7
8MAINTAINER= pkgsrc-users@NetBSD.org 8MAINTAINER= pkgsrc-users@NetBSD.org
9HOMEPAGE= https://github.com/OpenSC/OpenSC/wiki 9HOMEPAGE= https://github.com/OpenSC/OpenSC/wiki
10COMMENT= Smart Card drivers and middleware 10COMMENT= Smart Card drivers and middleware
11LICENSE= gnu-lgpl-v2.1 11LICENSE= gnu-lgpl-v2.1
12 12
13WRKSRC= ${WRKDIR}/OpenSC-${PKGVERSION_NOREV} 13WRKSRC= ${WRKDIR}/OpenSC-${PKGVERSION_NOREV}
14 14
15TOOL_DEPENDS+= docbook-xsl-[0-9]*:../../textproc/docbook-xsl 15TOOL_DEPENDS+= docbook-xsl-[0-9]*:../../textproc/docbook-xsl
16 16
17USE_LIBTOOL= yes 17USE_LIBTOOL= yes
18USE_TOOLS+= autoreconf autoconf automake gmake pkg-config 18USE_TOOLS+= autoreconf autoconf automake gmake pkg-config
19GNU_CONFIGURE= yes 19GNU_CONFIGURE= yes
20CONFIGURE_ARGS+= --disable-autostart-items 20CONFIGURE_ARGS+= --disable-autostart-items
21CONFIGURE_ARGS+= --disable-cmocka 21CONFIGURE_ARGS+= --disable-cmocka
22CONFIGURE_ARGS+= --disable-strict # avoid -Werror 22CONFIGURE_ARGS+= --disable-strict # avoid -Werror
23CONFIGURE_ARGS+= --enable-notify 
24CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR} 23CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
25# The stylesheets are not found without this. 24# The stylesheets are not found without this.
26CONFIGURE_ARGS+= --with-xsl-stylesheetsdir=${PREFIX}/share/xsl/docbook 25CONFIGURE_ARGS+= --with-xsl-stylesheetsdir=${PREFIX}/share/xsl/docbook
27 26
28.include "options.mk" 27.include "options.mk"
29 28
30EGDIR= ${PREFIX}/share/examples/opensc 29EGDIR= ${PREFIX}/share/examples/opensc
31CONF_FILES+= ${EGDIR}/opensc.conf ${PKG_SYSCONFDIR}/opensc.conf 30CONF_FILES+= ${EGDIR}/opensc.conf ${PKG_SYSCONFDIR}/opensc.conf
32 31
33pre-configure: 32pre-configure:
34 cd ${WRKSRC} && autoreconf -fi 33 cd ${WRKSRC} && autoreconf -fi
35 34
36INSTALLATION_DIRS= ${EGDIR} 35INSTALLATION_DIRS= ${EGDIR}
37post-install: 36post-install:
38 ${INSTALL_DATA} ${WRKSRC}/etc/opensc.conf.example ${DESTDIR}${EGDIR}/opensc.conf 37 ${INSTALL_DATA} ${WRKSRC}/etc/opensc.conf.example ${DESTDIR}${EGDIR}/opensc.conf
39 38
40.include "../../devel/glib2/buildlink3.mk" 
41.include "../../devel/zlib/buildlink3.mk" 39.include "../../devel/zlib/buildlink3.mk"
42.include "../../security/openssl/buildlink3.mk" 40.include "../../security/openssl/buildlink3.mk"
43# build tools for doc; should be TOOLS 41# build tools for doc; should be TOOLS
44.include "../../textproc/libxslt/buildlink3.mk" 42.include "../../textproc/libxslt/buildlink3.mk"
45.include "../../mk/dlopen.buildlink3.mk" 43.include "../../mk/dlopen.buildlink3.mk"
46.include "../../mk/readline.buildlink3.mk" 44.include "../../mk/readline.buildlink3.mk"
47.include "../../mk/bsd.pkg.mk" 45.include "../../mk/bsd.pkg.mk"

cvs diff -r1.14 -r1.14.4.1 pkgsrc/security/opensc/PLIST (expand / switch to unified diff)

--- pkgsrc/security/opensc/PLIST 2023/02/21 17:23:07 1.14
+++ pkgsrc/security/opensc/PLIST 2023/08/17 20:06:53 1.14.4.1
@@ -1,27 +1,27 @@ @@ -1,27 +1,27 @@
1@comment $NetBSD: PLIST,v 1.14 2023/02/21 17:23:07 adam Exp $ 1@comment $NetBSD: PLIST,v 1.14.4.1 2023/08/17 20:06:53 bsiegert Exp $
2bin/cardos-tool 2bin/cardos-tool
3bin/cryptoflex-tool 3bin/cryptoflex-tool
4bin/dnie-tool 4bin/dnie-tool
5bin/egk-tool 5bin/egk-tool
6bin/eidenv 6bin/eidenv
7bin/gids-tool 7bin/gids-tool
8bin/goid-tool 8bin/goid-tool
9bin/iasecc-tool 9bin/iasecc-tool
10bin/netkey-tool 10bin/netkey-tool
11bin/openpgp-tool 11bin/openpgp-tool
12bin/opensc-asn1 12bin/opensc-asn1
13bin/opensc-explorer 13bin/opensc-explorer
14bin/opensc-notify 14${NOTIFY}bin/opensc-notify
15bin/opensc-tool 15bin/opensc-tool
16bin/piv-tool 16bin/piv-tool
17bin/pkcs11-register 17bin/pkcs11-register
18bin/pkcs11-tool 18bin/pkcs11-tool
19bin/pkcs15-crypt 19bin/pkcs15-crypt
20bin/pkcs15-init 20bin/pkcs15-init
21bin/pkcs15-tool 21bin/pkcs15-tool
22bin/sc-hsm-tool 22bin/sc-hsm-tool
23bin/westcos-tool 23bin/westcos-tool
24lib/libopensc.la 24lib/libopensc.la
25lib/libsmm-local.la 25lib/libsmm-local.la
26lib/onepin-opensc-pkcs11.la 26lib/onepin-opensc-pkcs11.la
27lib/opensc-pkcs11.la 27lib/opensc-pkcs11.la

cvs diff -r1.6 -r1.6.4.1 pkgsrc/security/opensc/options.mk (expand / switch to unified diff)

--- pkgsrc/security/opensc/options.mk 2023/02/21 17:23:07 1.6
+++ pkgsrc/security/opensc/options.mk 2023/08/17 20:06:53 1.6.4.1
@@ -1,21 +1,26 @@ @@ -1,21 +1,26 @@
1# $NetBSD: options.mk,v 1.6 2023/02/21 17:23:07 adam Exp $ 1# $NetBSD: options.mk,v 1.6.4.1 2023/08/17 20:06:53 bsiegert Exp $
2 2
3PKG_OPTIONS_VAR= PKG_OPTIONS.opensc 3PKG_OPTIONS_VAR= PKG_OPTIONS.opensc
4 4
5# Arguably these should be selectable individually, but upstream requires 5# Arguably these should be selectable individually, but upstream requires
6# that exactly one be chosen. 6# that exactly one be chosen.
7PKG_OPTIONS_REQUIRED_GROUPS= cardreader 7PKG_OPTIONS_REQUIRED_GROUPS= cardreader
8PKG_OPTIONS_GROUP.cardreader= pcsc-lite openct 8PKG_OPTIONS_GROUP.cardreader= pcsc-lite openct
 9
 10# The notify option will cause programs not linked with libpthread
 11# to abort when loading the opensc-pkcs11.so module. The most notable
 12# example of such a program is ssh(1).
 13PKG_SUPPORTED_OPTIONS= notify
9PKG_SUGGESTED_OPTIONS= pcsc-lite 14PKG_SUGGESTED_OPTIONS= pcsc-lite
10 15
11.include "../../mk/bsd.options.mk" 16.include "../../mk/bsd.options.mk"
12 17
13.if ${OPSYS} == "Darwin" 18.if ${OPSYS} == "Darwin"
14SOEXT= dylib 19SOEXT= dylib
15.else 20.else
16SOEXT= so 21SOEXT= so
17.endif 22.endif
18 23
19.if !empty(PKG_OPTIONS:Mpcsc-lite) 24.if !empty(PKG_OPTIONS:Mpcsc-lite)
20.include "../../security/pcsc-lite/buildlink3.mk" 25.include "../../security/pcsc-lite/buildlink3.mk"
21CONFIGURE_ARGS+= --enable-pcsc 26CONFIGURE_ARGS+= --enable-pcsc
@@ -28,13 +33,22 @@ CONFIGURE_ARGS+= --with-pcsc-provider=${ @@ -28,13 +33,22 @@ CONFIGURE_ARGS+= --with-pcsc-provider=${
28. endif 33. endif
29# This is perhaps an upstream bug. 34# This is perhaps an upstream bug.
30CONFIGURE_ENV+= PCSC_CFLAGS=-I${BUILDLINK_PREFIX.pcsc-lite}/include/PCSC 35CONFIGURE_ENV+= PCSC_CFLAGS=-I${BUILDLINK_PREFIX.pcsc-lite}/include/PCSC
31.else 36.else
32CONFIGURE_ARGS+= --disable-pcsc 37CONFIGURE_ARGS+= --disable-pcsc
33.endif 38.endif
34 39
35.if !empty(PKG_OPTIONS:Mopenct) 40.if !empty(PKG_OPTIONS:Mopenct)
36.include "../../security/openct/buildlink3.mk" 41.include "../../security/openct/buildlink3.mk"
37CONFIGURE_ARGS+= --enable-openct 42CONFIGURE_ARGS+= --enable-openct
38.else 43.else
39CONFIGURE_ARGS+= --disable-openct 44CONFIGURE_ARGS+= --disable-openct
40.endif 45.endif
 46
 47.if !empty(PKG_OPTIONS:Mnotify)
 48.include "../../devel/glib2/buildlink3.mk"
 49CONFIGURE_ARGS+= --enable-notify
 50PLIST_SUBST+= NOTIFY=""
 51.else
 52CONFIGURE_ARGS+= --disable-notify
 53PLIST_SUBST+= NOTIFY="@comment "
 54.endif