PHP5+PECL-gnupg-1.3 fails in CLI mode ("Result too large", "could not init keylist")

S.U. leftfoot at siu.edu
Tue Jan 17 23:38:15 CET 2012


Attempting a simple PHP (pecl) gnupg key lookup fails with a "could not init
keylist" error in a Solaris environment, using PHP CLI mode. Note that using
the same basic code under Apache2+PHP5 works just fine (under Solaris). Under
FreeBSD-7/8, the PHP5 CLI mode + PECL GnuPG works just fine (as does
Apache+PHP5 mode).


Sample Code
=======================================
<?php
$gpg= new gnupg();
$res=$gpg->keyinfo("<keyid|name>");
echo $gpg->geterror() . "\n";
echo "res:\n";print_r($res);echo"\n";
exit;
?>
========================================

Enabling GPGME_DEBUG=9 environment variable includes the following message:

GPGME 2012-01-06 11:59:56 <0x0638>  gpgme_op_keylist_start: error: Result too
large <GPGME>


Environments
=====================================================
a) Solaris 10 u10 x86-64
b) Solaris 10 u9  x86-64
c) Solaris 10 u10 sparc (64-bit)
d) Solaris 10 u10 x86-64 (64-bit OS, 32-bit boot before compiles)
e) Solaris 10 u8 x86 (32-bit)

gpgme-1.3.1.tar.bz2
libassuan-2.0.3.tar.bz2
libgpg-error-1.10.tar.bz2
pecl gnupg 1.3.2
php-5.3.5.tar.bz2  or  php-5.3.8.tar.bz2
gnupg-1.4.11.tar.bz2
gnupg-2.0.18.tar.bz2 (not installed in all cases)
=====================================================


Added parameters for compilation of PECL-GNUPG
required because of GPGME LFS
=====================================================
setenv CFLAGS '-D_FILE_OFFSET_BITS=64'
=====================================================


Full GPGME+gpg2 debug output:
========================================================
GPGME 2012-01-06 12:13:28 <0x064d>  gpgme_debug: level=9
GPGME 2012-01-06 12:13:28 <0x064d>  gpgme_check_version: call: 0=0,
req_version=(null), VERSION=1.3.1
GPGME 2012-01-06 12:13:28 <0x064d>  gpgme_check_version_internal: call: 0=0,
req_version=(null), offset_sig_validity=32
GPGME 2012-01-06 12:13:28 <0x064d>  gpgme_new: enter: r_ctx=804643c
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_pipe: enter: filedes=8046268,
inherit_idx=1 (GPGME uses it for reading)
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_pipe: leave: read=0x4, write=0x5
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: enter: path=fdef4e47,
path=/usr/local/bin/gpg
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef4e47,
argv[ 0] = /usr/local/bin/gpg
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef4e47,
argv[ 1] = --version
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef4e47,
fd[0] = 0x5 -> 0x1
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef4e47,
waiting for child process pid=1614
GPGME 2012-01-06 12:13:28 <0x064f>      gpgme:max_fds: call: 0=0, max
fds=65536 (RLIMIT_NOFILE)
GPGME 2012-01-06 12:13:28 <0x064d>      _gpgme_io_close: enter: fd=5
GPGME 2012-01-06 12:13:28 <0x064d>      _gpgme_io_close: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: enter: fd=4,
buffer=80462a0, count=79
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 6770672028476e75
50472920312e342e gpg (GnuPG) 1.4.
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 31310a436f707972
6967687420284329 11.Copyright (C)
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 2032303130204672
656520536f667477  2010 Free Softw
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 61726520466f756e
646174696f6e2c20 are Foundation,
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 496e632e0a4c6963
656e7365204750   Inc..License GP
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: leave: result=79
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_close: enter: fd=4
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_close: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_pipe: enter: filedes=8046268,
inherit_idx=1 (GPGME uses it for reading)
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_pipe: leave: read=0x4, write=0x5
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: enter: path=fdef526b,
path=/usr/local/bin/gpgsm
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef526b,
argv[ 0] = /usr/local/bin/gpgsm
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef526b,
argv[ 1] = --version
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef526b,
fd[0] = 0x5 -> 0x1
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef526b,
waiting for child process pid=1616
GPGME 2012-01-06 12:13:28 <0x0651>      gpgme:max_fds: call: 0=0, max
fds=65536 (RLIMIT_NOFILE)
GPGME 2012-01-06 12:13:28 <0x064d>      _gpgme_io_close: enter: fd=5
GPGME 2012-01-06 12:13:28 <0x064d>      _gpgme_io_close: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: enter: fd=4,
buffer=80462a0, count=79
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 677067736d202847
6e7550472920322e gpgsm (GnuPG) 2.
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 302e31380a6c6962
6763727970742031 0.18.libgcrypt 1
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 2e352e300a6c6962
6b73626120312e32 .5.0.libksba 1.2
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 2e300a436f707972
6967687420284329 .0.Copyright (C)
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 2032303131204672
656520536f6674    2011 Free Soft
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: leave: result=79
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_close: enter: fd=4
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_close: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_pipe: enter: filedes=8046268,
inherit_idx=1 (GPGME uses it for reading)
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_pipe: leave: read=0x4, write=0x5
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: enter: path=fdef49cd,
path=/usr/local/bin/gpgconf
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef49cd,
argv[ 0] = /usr/local/bin/gpgconf
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef49cd,
argv[ 1] = --version
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef49cd,
fd[0] = 0x5 -> 0x1
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef49cd,
waiting for child process pid=1618
GPGME 2012-01-06 12:13:28GPGME  <0x0653>      gpgme:max_fds: call: 0=0, max
fds=65536 (RLIMIT_NOFILE)
2012-01-06 12:13:28 <0x064d>      _gpgme_io_close: enter: fd=5
GPGME 2012-01-06 12:13:28 <0x064d>      _gpgme_io_close: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: enter: fd=4,
buffer=80462a0, count=79
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 677067636f6e6620
28476e7550472920 gpgconf (GnuPG)
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 322e302e31380a43
6f70797269676874 2.0.18.Copyright
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 2028432920323031
3120467265652053  (C) 2011 Free S
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 6f66747761726520
466f756e64617469 oftware Foundati
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 6f6e2c20496e632e
0a4c6963656e73   on, Inc..Licens
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: leave: result=79
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_close: enter: fd=4
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_close: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_pipe: enter: filedes=8045ee8,
inherit_idx=1 (GPGME uses it for reading)
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_pipe: leave: read=0x4, write=0x5
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: enter: path=fdef49cd,
path=/usr/local/bin/gpgconf
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef49cd,
argv[ 0] = /usr/local/bin/gpgconf
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef49cd,
argv[ 1] = --list-dirs
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef49cd,
fd[0] = 0x5 -> 0x1
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: check: path=fdef49cd,
waiting for child process pid=1620
GPGME GPGME 2012-01-06 12:13:28 <0x0655>      gpgme:max_fds: call: 0=0, max
fds=65536 (RLIMIT_NOFILE)
2012-01-06 12:13:28 <0x064d>      _gpgme_io_close: enter: fd=5
GPGME 2012-01-06 12:13:28 <0x064d>      _gpgme_io_close: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_spawn: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: enter: fd=4,
buffer=8045f20, count=1023
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 737973636f6e6664
69723a2f7573722f sysconfdir:/usr/
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 6c6f63616c2f6574
632f676e7570670a local/etc/gnupg.
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 62696e6469723a2f
7573722f6c6f6361 bindir:/usr/loca
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 6c2f62696e0a6c69
6265786563646972 l/bin.libexecdir
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 3a2f7573722f6c6f
63616c2f6c696265 :/usr/local/libe
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 7865630a6c696264
69723a2f7573722f xec.libdir:/usr/
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 6c6f63616c2f6c69
622f676e7570670a local/lib/gnupg.
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 646174616469723a
2f7573722f6c6f63 datadir:/usr/loc
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 616c2f7368617265
2f676e7570670a6c al/share/gnupg.l
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 6f63616c65646972
3a2f7573722f6c6f ocaledir:/usr/lo
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 63616c2f73686172
652f6c6f63616c65 cal/share/locale
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 0a6469726d6e6772
2d736f636b65743a .dirmngr-socket:
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 2f7661722f72756e
2f6469726d6e6772 /var/run/dirmngr
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 2f736f636b65740a
6167656e742d736f /socket.agent-so
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx cket:xxxxxxxxxxx
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx xxxxxx/.gnupg/S.
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: 6770672d6167656e
740a686f6d656469 gpg-agent.homedi
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxx
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: check: xxxxxxxxxxxxxxxx
xxxxxx           xxx/.gnupg.
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: leave: result=299
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: enter: fd=4,
buffer=8045f20, count=1023
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_read: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_close: enter: fd=4
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_close: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>  gpgme_new: leave: ctx=89f9b38
GPGME 2012-01-06 12:13:28 <0x064d>  gpgme_set_armor: call: ctx=89f9b38,
use_armor=1 (yes)
GPGME 2012-01-06 12:13:28 <0x064d>  gpgme_op_keylist_start: enter:
ctx=89f9b38, pattern=Jones, secret_only=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_pipe: enter: filedes=89f9c54,
inherit_idx=1 (GPGME uses it for reading)
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_pipe: leave: read=0x4, write=0x5
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_set_close_notify: enter: fd=4,
close_handler=fdee6078/89f9c40
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_set_close_notify: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_set_close_notify: enter: fd=5,
close_handler=fdee6078/89f9c40
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_set_close_notify: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_close: enter: fd=4
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_close: check: fd=4, invoking
close handler fdee6078/89f9c40
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_close: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_close: enter: fd=5
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_close: check: fd=5, invoking
close handler fdee6078/89f9c40
GPGME 2012-01-06 12:13:28 <0x064d>    _gpgme_io_close: leave: result=0
GPGME 2012-01-06 12:13:28 <0x064d>  gpgme_op_keylist_start: error: Result too
large <GPGME>
could not init keylist
res:

GPGME 2012-01-06 12:13:28 <0x064d>  gpgme_signers_clear: call: ctx=89f9b38
GPGME 2012-01-06 12:13:28 <0x064d>  gpgme_release: call: ctx=89f9b38
========================================================


Full GPGME-gpg2 debug output:
=========================================================
GPGME 2012-01-06 12:12:39 <0x03c2>  gpgme_debug: level=9
GPGME 2012-01-06 12:12:39 <0x03c2>  gpgme_check_version: call: 0=0,
req_version=(null), VERSION=1.3.1
GPGME 2012-01-06 12:12:39 <0x03c2>  gpgme_check_version_internal: call: 0=0,
req_version=(null), offset_sig_validity=32
GPGME 2012-01-06 12:12:39 <0x03c2>  gpgme_new: enter: r_ctx=80466fc
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_pipe: enter: filedes=8046528,
inherit_idx=1 (GPGME uses it for reading)
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_pipe: leave: read=0x4, write=0x5
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_spawn: enter: path=feac0772,
path=/usr/local/bin//gpg
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_spawn: check: path=feac0772,
argv[ 0] = /usr/local/bin//gpg
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_spawn: check: path=feac0772,
argv[ 1] = --version
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_spawn: check: path=feac0772,
fd[0] = 0x5 -> 0x1
GPGME 2012-01-06 12:12:39 <0x03c4>      gpgme:max_fds: call: 0=0, max
fds=65536 (RLIMIT_NOFILE)
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_spawn: check: path=feac0772,
waiting for child process pid=963
GPGME 2012-01-06 12:12:39 <0x03c2>      _gpgme_io_close: enter: fd=5
GPGME 2012-01-06 12:12:39 <0x03c2>      _gpgme_io_close: leave: result=0
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_spawn: leave: result=0
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_read: enter: fd=4,
buffer=8046560, count=79
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_read: check: 6770672028476e75
50472920312e342e gpg (GnuPG) 1.4.
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_read: check: 31310a436f707972
6967687420284329 11.Copyright (C)
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_read: check: 2032303130204672
656520536f667477  2010 Free Softw
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_read: check: 61726520466f756e
646174696f6e2c20 are Foundation,
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_read: check: 496e632e0a4c6963
656e7365204750   Inc..License GP
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_read: leave: result=79
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_close: enter: fd=4
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_close: leave: result=0
GPGME 2012-01-06 12:12:39 <0x03c2>  gpgme_new: leave: ctx=894f8d8
GPGME 2012-01-06 12:12:39 <0x03c2>  gpgme_set_armor: call: ctx=894f8d8,
use_armor=1 (yes)
GPGME 2012-01-06 12:12:39 <0x03c2>  gpgme_op_keylist_start: enter:
ctx=894f8d8, pattern=Jones, secret_only=0
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_pipe: enter: filedes=895016c,
inherit_idx=1 (GPGME uses it for reading)
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_pipe: leave: read=0x4, write=0x5
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_set_close_notify: enter: fd=4,
close_handler=feab5db4/8950158
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_set_close_notify: leave: result=0
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_set_close_notify: enter: fd=5,
close_handler=feab5db4/8950158
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_set_close_notify: leave: result=0
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_close: enter: fd=4
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_close: check: fd=4, invoking
close handler feab5db4/8950158
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_close: leave: result=0
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_close: enter: fd=5
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_close: check: fd=5, invoking
close handler feab5db4/8950158
GPGME 2012-01-06 12:12:39 <0x03c2>    _gpgme_io_close: leave: result=0
GPGME 2012-01-06 12:12:39 <0x03c2>  gpgme_op_keylist_start: error: Result too
large <GPGME>
could not init keylist
res:

GPGME 2012-01-06 12:12:39 <0x03c2>  gpgme_signers_clear: call: ctx=894f8d8
GPGME 2012-01-06 12:12:39 <0x03c2>  gpgme_release: call: ctx=894f8d8
=========================================================




More information about the Gnupg-devel mailing list