GNU C Library master sources branch, master, updated. glibc-2.11-322-g7ebaec6

drepper@sourceware.org drepper@sourceware.org
Sun Apr 4 20:40:00 GMT 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  7ebaec64a0171a54dbe9aedd95497b130458060e (commit)
       via  8c6de69d00c6be60657ca0d763dda803172c6aab (commit)
      from  26f4163c6e6ca6543cb235960deaba09911d3d24 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7ebaec64a0171a54dbe9aedd95497b130458060e

commit 7ebaec64a0171a54dbe9aedd95497b130458060e
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Sun Apr 4 11:28:36 2010 -0700

    Add test case for last argp bug.

diff --git a/ChangeLog b/ChangeLog
index e8b494b..69ba4dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-04-04  Ulrich Drepper  <drepper@redhat.com>
+
+	* argp/Makefile: Add rules to build and run bug-argp2.
+	* argp/bug-argp2.c: New file.
+
 2010-02-05  Sergey Poznyakoff  <gray@gnu.org.ua>
 
 	[BZ #11254]
diff --git a/argp/Makefile b/argp/Makefile
index b8c9fca..caa95db 100644
--- a/argp/Makefile
+++ b/argp/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1997, 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1997,2002,2003,2006,2007,2010 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -26,12 +26,13 @@ distribute	= argp-fmtstream.h argp-namefrob.h
 routines	= $(addprefix argp-, ba fmtstream fs-xinl help parse pv \
 				     pvh xinl eexst)
 
-tests		= argp-test tst-argp1 bug-argp1 tst-argp2
+tests		= argp-test tst-argp1 bug-argp1 tst-argp2 bug-argp2
 
 CFLAGS-argp-help.c = $(uses-callbacks) -fexceptions
 CFLAGS-argp-parse.c = $(uses-callbacks)
 CFLAGS-argp-fmtstream.c = -fexceptions
 
 bug-argp1-ARGS = -- --help
+bug-argp2-ARGS = -- -d 111 --dstaddr 222 -p 333 --peer 444
 
 include ../Rules
diff --git a/argp/bug-argp2.c b/argp/bug-argp2.c
new file mode 100644
index 0000000..133e5cf
--- /dev/null
+++ b/argp/bug-argp2.c
@@ -0,0 +1,55 @@
+#include <argp.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static struct argp_option argp_options[] = {
+  { "dstaddr", 'd', "ADDR", 0,
+    "set destination (peer) address to ADDR" },
+  { "peer", 'p', "ADDR", OPTION_ALIAS },
+  { NULL }
+};
+
+static error_t parse_opt (int key, char *arg, struct argp_state *state);
+
+static struct argp argp =
+{
+  argp_options, parse_opt
+};
+
+static int cnt;
+
+static int
+do_test (int argc, char *argv[])
+{
+  int remaining;
+  argp_parse (&argp, argc, argv, 0, &remaining, NULL);
+  return cnt != 4;
+}
+
+static error_t
+parse_opt (int key, char *arg, struct argp_state *state)
+{
+  switch (key)
+  {
+  case 'd':
+  case 'p':
+    printf ("got '%c' with argument '%s'\n", key, arg);
+    ++cnt;
+    break;
+  case 0:
+  case ARGP_KEY_END:
+  case ARGP_KEY_NO_ARGS:
+  case ARGP_KEY_INIT:
+  case ARGP_KEY_SUCCESS:
+  case ARGP_KEY_FINI:
+    // Ignore.
+    return ARGP_ERR_UNKNOWN;
+  default:
+    printf ("invalid key '%x'\n", key);
+    exit (1);
+  }
+  return 0;
+}
+
+#define TEST_FUNCTION do_test (argc, argv)
+#include "../test-skeleton.c"

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8c6de69d00c6be60657ca0d763dda803172c6aab

commit 8c6de69d00c6be60657ca0d763dda803172c6aab
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sun Apr 4 10:04:55 2010 -0700

    Fix option aliasing in argp.

diff --git a/ChangeLog b/ChangeLog
index 5cccc47..e8b494b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-02-05  Sergey Poznyakoff  <gray@gnu.org.ua>
+
+	[BZ #11254]
+	* argp/argp-parse.c (convert_options): Fix improper use of `|'
+	between character values.
+
 2010-04-04  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #11276]
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 4718ced..604fcf0 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -1,5 +1,5 @@
 /* Hierarchial argument parsing, layered over getopt
-   Copyright (C) 1995-2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2000, 2002, 2003, 2004, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <miles@gnu.ai.mit.edu>.
 
@@ -99,7 +99,7 @@ static volatile int _argp_hang;
 
 static const struct argp_option argp_default_options[] =
 {
-  {"help",	  '?',    	0, 0,  N_("Give this help list"), -1},
+  {"help",	  '?',	  	0, 0,  N_("Give this help list"), -1},
   {"usage",	  OPT_USAGE,	0, 0,  N_("Give a short usage message")},
   {"program-name",OPT_PROGNAME,"NAME", OPTION_HIDDEN, N_("Set the program name")},
   {"HANG",	  OPT_HANG,    "SECS", OPTION_ARG_OPTIONAL | OPTION_HIDDEN,
@@ -164,7 +164,7 @@ static const struct argp argp_default_argp =
 
 static const struct argp_option argp_version_options[] =
 {
-  {"version",	  'V',    	0, 0,  N_("Print program version"), -1},
+  {"version",	  'V',	  	0, 0,  N_("Print program version"), -1},
   {0, 0}
 };
 
@@ -364,7 +364,7 @@ convert_options (const struct argp *argp,
 		       values (the sign of the lower bits is preserved
 		       however)...  */
 		    cvt->long_end->val =
-		      ((opt->key | real->key) & USER_MASK)
+		      ((opt->key ? opt->key : real->key) & USER_MASK)
 		      + (((group - cvt->parser->groups) + 1) << USER_BITS);
 
 		    /* Keep the LONG_OPTS list terminated.  */
@@ -385,7 +385,7 @@ convert_options (const struct argp *argp,
 
       if (children)
 	/* Assign GROUP's CHILD_INPUTS field some space from
-           CVT->child_inputs_end.*/
+	   CVT->child_inputs_end.*/
 	{
 	  unsigned num_children = 0;
 	  while (children[num_children].argp)
@@ -823,7 +823,7 @@ parser_parse_next (struct parser *parser, int *arg_ebadkey)
 	  parser->try_getopt = 0;
 	  if (parser->state.next > 1
 	      && strcmp (parser->state.argv[parser->state.next - 1], QUOTE)
-	           == 0)
+		   == 0)
 	    /* Not only is this the end of the options, but it's a
 	       `quoted' region, which may have args that *look* like
 	       options, so we definitely shouldn't try to use getopt past

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |   11 ++++++++++
 argp/Makefile     |    5 ++-
 argp/argp-parse.c |   12 +++++-----
 argp/bug-argp2.c  |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 75 insertions(+), 8 deletions(-)
 create mode 100644 argp/bug-argp2.c


hooks/post-receive
-- 
GNU C Library master sources



More information about the Glibc-cvs mailing list