From: "Dmitry V. Levin" <ldv@altlinux.org>
To: ALT Devel discussion list <devel@altlinux.ru>
Subject: Re: [devel] glibc 2.3 - argp_parse broken??
Date: Wed, 19 May 2004 20:42:10 +0400
Message-ID: <20040519164210.GA26387@nomad.office.altlinux.org> (raw)
In-Reply-To: <20040519160331.GB17274@mailhub.gu.net>
[-- Attachment #1.1: Type: text/plain, Size: 1470 bytes --]
On Wed, May 19, 2004 at 07:03:31PM +0300, Victor Forsyuk wrote:
> On Wed, May 19, 2004 at 07:37:52PM +0400, Dmitry V. Levin wrote:
> > On Wed, May 19, 2004 at 06:31:05PM +0300, Victor Forsyuk wrote:
> > > Или subj, или я чего-то не понимаю. Замечена поломка опции "-o" в ccze
> > > (ccze-0.2.1-alt2). Без указания этой опции программа работает. Например:
> > >
> > > > tail -f /var/log/exim/main.log|ccze -A -p exim
> > >
> > > Как только указываем что-либо в этой опции, имеем сегфолт:
> > >
> > > > tail -f /var/log/exim/main.log|ccze -A -p exim -o nolookups
> > > Segmentation fault
> >
> > ccze -A -p exim -o nolookups </dev/null тоже падает.
>
> Да, я и так проверял. До обработки данных дело вообще не доходит,
> сегфолт внутри argp_parse.
Нет,
Program received signal SIGSEGV, Segmentation fault.
0x0804a0dd in parse_opt (key=111, arg=0xbffffa07 "nolookups", state=0xbffff7b4) at ccze.c:277
> > > Bug, изменения в функции с обратной несовместимостью, проявившаяся
> > > ошибка в программе? Подскажите, кто с argp_parse знаком ближе
> > > (я никогда ее не использовал), у меня разбираться, к сожалению,
> > > практически нет времени.
> >
> > Я посмотрю.
>
> Повесить баг (вроде как bugzilla поднялась уже) или не нужно?
Это фатальная опечатка в программе, плюс необратимое изменение в glibc
от 8 марта этого года, собственно и делающее эту опечатку фатальной.
Патч на ccze и текст изменения прилагаются.
--
ldv
[-- Attachment #1.2: ccze-0.2.1-alt-argp.patch --]
[-- Type: text/plain, Size: 923 bytes --]
diff -uprk.orig ccze-0.2.1.orig/src/ccze.c ccze-0.2.1/src/ccze.c
--- ccze-0.2.1.orig/src/ccze.c 2003-05-13 22:09:30 +0400
+++ ccze-0.2.1/src/ccze.c 2004-05-19 20:21:02 +0400
@@ -209,7 +209,7 @@ parse_opt (int key, char *arg, struct ar
}
break;
case 'a':
- plugin = strtok (optarg, "=");
+ plugin = strtok (arg, "=");
value = strtok (NULL, "\n");
ccze_plugin_argv_set (plugin, value);
break;
@@ -249,7 +249,7 @@ parse_opt (int key, char *arg, struct ar
ccze_config.remfac = 1;
break;
case 'm':
- subopts = optarg;
+ subopts = arg;
while (*subopts != '\0')
{
switch (getsubopt (&subopts, m_subopts, &value))
@@ -273,7 +273,7 @@ parse_opt (int key, char *arg, struct ar
}
break;
case 'o':
- subopts = optarg;
+ subopts = arg;
while (*subopts != '\0')
{
switch (getsubopt (&subopts, o_subopts, &value))
[-- Attachment #1.3: optarg_change --]
[-- Type: text/plain, Size: 2522 bytes --]
2004-03-08 Marcus Brinkmann <marcus@gnu.org>
* posix/getopt.h (_getopt_internal): Move to ...
* posix/getopt_int.h: ... here. New file.
* include/getopt_int.h: New file.
* include/getopt.h: Remove libc_hidden_proto for getopt_long
and getopt_long_only.
* posix/getopt1.c: Include "getopt_int.h". Remove
libc_hidden_def for getopt_long and getopt_long_only.
(_getopt_long_r, _getopt_long_only_r): New functions.
* posix/getopt.c: Include "getopt_int.h".
(__getopt_initialized): Variable removed.
(nextchar, ordering, posixly_correct, first_nonopt, last_nonopt):
Static variables removed.
(nonoption_flags_max_len, nonoption_flags_len) [_LIBC &&
USE_NONOPTION_FLAGS]: Static variables removed.
(getopt_data): New static variable.
(SWAP_FLAGS): Use d->__nonoption_flags_len instead
nonoption_flags_len.
(exchange): Add new argument D of type struct getopt_data *.
Replace optind with d->optind, optarg with d->optarg, opterr with
d->opterr, optopt with d->optopt, nextchar with d->__nextchar,
first_nonopt with d->__first_nonopt, last_nonopt with
d->__last_nonopt, d->ordering with d->__ordering,
d->posixly_correct with d->__posixly_correct (which is now an
int instead a string, so fix users), nonoption_flags_len
with d->__nonoption_flags_len, nonoption_flags_max_len with
d->__nonoption_flags_max_len.
(_getopt_initialize): Likewise.
(_getopt_internal): Rename to ...
(_getopt_internal_r): ... this. Also add new argument D of type
struct getopt_data * and use of members of D rather than global or
static variables as described for exchange() above. Add new argument
to invocations of _getopt_initialize and exchange.
(_getopt_internal): Reimplement in terms of _getopt_internal_r.
* argp/argp-parse.c: Include <getopt_int.h>.
[_LIBC]: Do not include <bits/libc-lock.h>.
[!_LIBC && HAVE_CTHREADS_H]: Do not include <cthreads.h>.
[!_LIBC] (_argp_hang): Make static.
(getopt_lock, LOCK_GETOPT, UNLOCK_GETOPT): Remove.
(_argp_unlock_xxx): Remove.
(parser_init): Do not use LOCK_GETOPT.
(parser_finalize): Do not use UNLOCK_GETOPT.
(struct parser): New member OPT_DATA.
(parser_init): Initialize parser->opt_data. Use
parser->opt_data.opterr instead of opterr.
(parser_parse_opt): Use parser->opt_data.optarg instead optarg.
(parser_parse_next): Likewise. Use parser->opt_data.optind
instead optind. Use parser->opt_data.optopt instead of optopt.
Call _getopt_long_only_r and _getopt_long_r instead of
getopt_long_only and getopt_long, and pass the extra argument.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
prev parent reply other threads:[~2004-05-19 16:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-19 15:31 Victor Forsyuk
2004-05-19 15:37 ` Dmitry V. Levin
2004-05-19 16:03 ` Victor Forsyuk
2004-05-19 16:42 ` Dmitry V. Levin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040519164210.GA26387@nomad.office.altlinux.org \
--to=ldv@altlinux.org \
--cc=devel@altlinux.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git