diff --git a/common/iobuf.c b/common/iobuf.c index bf5977843..02c9b491c 100644 --- a/common/iobuf.c +++ b/common/iobuf.c @@ -59,9 +59,7 @@ /*-- Begin configurable part. --*/ -/* The size of the internal buffers. - NOTE: If you change this value you MUST also adjust the regression - test "armored_key_8192" in armor.test! */ +/* The standard size of the internal buffers. */ #define DEFAULT_IOBUF_BUFFER_SIZE (64*1024) /* To avoid a potential DoS with compression packets we better limit diff --git a/doc/gpg.texi b/doc/gpg.texi index 1e6ea595f..83b234e47 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -2859,6 +2859,12 @@ Set all useful debugging flags. Set stdout into line buffered mode. This option is only honored when given on the command line. +@item --debug-set-iobuf-size @var{n} +@opindex debug-iolbf +Change the buffer size of the IOBUFs to @var{n} kilobyte. Using 0 +prints the current size. Note well: This is a maintainer only option +and may thus be changed or removed at any time without notice. + @item --faked-system-time @var{epoch} @opindex faked-system-time This option is only useful for testing; it sets the system time back or diff --git a/g10/gpg.c b/g10/gpg.c index 283de2038..cbac967d8 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -223,6 +223,7 @@ enum cmd_and_opt_values oDebugLevel, oDebugAll, oDebugIOLBF, + oDebugSetIobufSize, oStatusFD, oStatusFile, oAttributeFD, @@ -642,6 +643,7 @@ static ARGPARSE_OPTS opts[] = { ARGPARSE_s_s (oDebugLevel, "debug-level", "@"), ARGPARSE_s_n (oDebugAll, "debug-all", "@"), ARGPARSE_s_n (oDebugIOLBF, "debug-iolbf", "@"), + ARGPARSE_s_u (oDebugSetIobufSize, "debug-set-iobuf-size", "@"), ARGPARSE_s_i (oStatusFD, "status-fd", "@"), ARGPARSE_s_s (oStatusFile, "status-file", "@"), ARGPARSE_s_i (oAttributeFD, "attribute-fd", "@"), @@ -956,6 +958,8 @@ int g10_errors_seen = 0; static int utf8_strings = 0; static int maybe_setuid = 1; +static unsigned int opt_set_iobuf_size; +static unsigned int opt_set_iobuf_size_used; static char *build_list( const char *text, char letter, const char *(*mapf)(int), int (*chkf)(int) ); @@ -1276,6 +1280,10 @@ set_debug (const char *level) if (opt.debug) parse_debug_flag (NULL, &opt.debug, debug_flags); + + if (opt_set_iobuf_size || opt_set_iobuf_size_used) + log_debug ("iobuf buffer size is %uk\n", + iobuf_set_buffer_size (opt_set_iobuf_size)); } @@ -2742,6 +2750,11 @@ main (int argc, char **argv) case oDebugIOLBF: break; /* Already set in pre-parse step. */ + case oDebugSetIobufSize: + opt_set_iobuf_size = pargs.r.ret_ulong; + opt_set_iobuf_size_used = 1; + break; + case oStatusFD: set_status_fd ( translate_sys2libc_fd_int (pargs.r.ret_int, 1) ); break; diff --git a/tests/openpgp/armor.scm b/tests/openpgp/armor.scm index 3c117dd10..a1b0aa938 100755 --- a/tests/openpgp/armor.scm +++ b/tests/openpgp/armor.scm @@ -191,7 +191,7 @@ nW1ff9rt1YcTH9LiiE4EGBECAAYFAjnKLe0AEgkQ3uyMCd5BWw4HZUdQRwABAZeBAKDsa7tc (info "Checking armored_key_8192") (pipe:do (pipe:echo armored_key_8192) - (pipe:gpg '(--import))) + (pipe:gpg '(--debug-set-iobuf-size=8 --import))) (define nopad_armored_msg "-----BEGIN PGP MESSAGE----- Version: GnuPG v1.4.11-svn5139 (GNU/Linux) @@ -758,10 +758,10 @@ wg7Md81a5RI3F2FG8747t9gX (info "Importing alpha_seckey") (pipe:do (pipe:echo alpha_seckey) - (pipe:gpg '(--import))) + (pipe:gpg '(--debug-set-iobuf-size=8 --import))) (info "Checking for bug #1179") (tr:do (tr:pipe-do (pipe:echo nopad_armored_msg) - (pipe:gpg '(--decrypt)))) + (pipe:gpg '(--debug-set-iobuf-size=8 --decrypt))))