gsasl-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gsasl branch, master, updated. gsasl-1-5-0-7-g2414e66


From: Simon Josefsson
Subject: [SCM] GNU gsasl branch, master, updated. gsasl-1-5-0-7-g2414e66
Date: Wed, 14 Apr 2010 15:10:13 +0000

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 gsasl".

http://git.savannah.gnu.org/cgit/gsasl.git/commit/?id=2414e669afd4e5fffe4f3f99837ba392e7861812

The branch, master has been updated
       via  2414e669afd4e5fffe4f3f99837ba392e7861812 (commit)
       via  982401f0187d575aeb67e5548e66df86aa254436 (commit)
      from  29640c6e69b34ece6acf2d458f31608d1378676c (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 -----------------------------------------------------------------
commit 2414e669afd4e5fffe4f3f99837ba392e7861812
Author: Simon Josefsson <address@hidden>
Date:   Wed Apr 14 17:09:34 2010 +0200

    Add.

commit 982401f0187d575aeb67e5548e66df86aa254436
Author: Simon Josefsson <address@hidden>
Date:   Wed Apr 14 17:08:16 2010 +0200

    Update gnulib files.

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

Summary of changes:
 gl/getopt.c                |   37 ++++++++------
 gl/m4/getopt.m4            |   41 ++++++++++++++--
 gltests/test-getopt.h      |  119 ++++++++++++++++++++++++++++++++++++++++---
 gltests/test-getopt_long.h |   17 ++++--
 lib/NEWS                   |    4 ++
 lib/gl/gc-libgcrypt.c      |    6 ++-
 6 files changed, 189 insertions(+), 35 deletions(-)

diff --git a/gl/getopt.c b/gl/getopt.c
index aaabc8d..738d998 100644
--- a/gl/getopt.c
+++ b/gl/getopt.c
@@ -348,8 +348,6 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                     int long_only, struct _getopt_data *d, int posixly_correct)
 {
   int print_errors = d->opterr;
-  if (optstring[0] == ':')
-    print_errors = 0;
 
   if (argc < 1)
     return -1;
@@ -364,6 +362,10 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                                       posixly_correct);
       d->__initialized = 1;
     }
+  else if (optstring[0] == '-' || optstring[0] == '+')
+    optstring++;
+  if (optstring[0] == ':')
+    print_errors = 0;
 
   /* Test whether ARGV[optind] points to a non-option argument.
      Either it does not have option syntax, or there is an environment flag
@@ -633,8 +635,8 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                       char *buf;
 
                       if (__asprintf (&buf, _("\
-%s: option '%s' requires an argument\n"),
-                                      argv[0], argv[d->optind - 1]) >= 0)
+%s: option '--%s' requires an argument\n"),
+                                      argv[0], pfound->name) >= 0)
                         {
                           _IO_flockfile (stderr);
 
@@ -651,8 +653,8 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                         }
 #else
                       fprintf (stderr,
-                               _("%s: option '%s' requires an argument\n"),
-                               argv[0], argv[d->optind - 1]);
+                               _("%s: option '--%s' requires an argument\n"),
+                               argv[0], pfound->name);
 #endif
                     }
                   d->__nextchar += strlen (d->__nextchar);
@@ -742,7 +744,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
     if (*d->__nextchar == '\0')
       ++d->optind;
 
-    if (temp == NULL || c == ':')
+    if (temp == NULL || c == ':' || c == ';')
       {
         if (print_errors)
           {
@@ -864,7 +866,10 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                   pfound = p;
                   indfound = option_index;
                 }
-              else
+              else if (long_only
+                       || pfound->has_arg != p->has_arg
+                       || pfound->flag != p->flag
+                       || pfound->val != p->val)
                 /* Second or later nonexact match found.  */
                 ambig = 1;
             }
@@ -876,7 +881,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                 char *buf;
 
                 if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"),
-                                argv[0], argv[d->optind]) >= 0)
+                                argv[0], d->optarg) >= 0)
                   {
                     _IO_flockfile (stderr);
 
@@ -892,7 +897,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                   }
 #else
                 fprintf (stderr, _("%s: option '-W %s' is ambiguous\n"),
-                         argv[0], argv[d->optind]);
+                         argv[0], d->optarg);
 #endif
               }
             d->__nextchar += strlen (d->__nextchar);
@@ -955,8 +960,8 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                         char *buf;
 
                         if (__asprintf (&buf, _("\
-%s: option '%s' requires an argument\n"),
-                                        argv[0], argv[d->optind - 1]) >= 0)
+%s: option '-W %s' requires an argument\n"),
+                                        argv[0], pfound->name) >= 0)
                           {
                             _IO_flockfile (stderr);
 
@@ -972,15 +977,17 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                             free (buf);
                           }
 #else
-                        fprintf (stderr,
-                                 _("%s: option '%s' requires an argument\n"),
-                                 argv[0], argv[d->optind - 1]);
+                        fprintf (stderr, _("\
+%s: option '-W %s' requires an argument\n"),
+                                 argv[0], pfound->name);
 #endif
                       }
                     d->__nextchar += strlen (d->__nextchar);
                     return optstring[0] == ':' ? ':' : '?';
                   }
               }
+            else
+              d->optarg = NULL;
             d->__nextchar += strlen (d->__nextchar);
             if (longind != NULL)
               *longind = option_index;
diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4
index a19805e..5b211e5 100644
--- a/gl/m4/getopt.m4
+++ b/gl/m4/getopt.m4
@@ -1,4 +1,4 @@
-# getopt.m4 serial 24
+# getopt.m4 serial 28
 dnl Copyright (C) 2002-2006, 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -79,8 +79,13 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
   dnl Existence of the variable, in and of itself, is not a reason to replace
   dnl getopt, but knowledge of the variable is needed to determine how to
   dnl reset and whether a reset reparses the environment.
-  if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
-    AC_CHECK_DECLS([optreset], [], [],
+  dnl Solaris supports neither optreset nor optind=0, but keeps no state that
+  dnl needs a reset beyond setting optind=1; detect Solaris by getopt_clip.
+  if test -z "$gl_replace_getopt"; then
+    AC_CHECK_DECLS([optreset], [],
+      [AC_CHECK_DECLS([getopt_clip], [], [],
+        [[#include <getopt.h>]])
+      ],
       [[#include <getopt.h>]])
   fi
 
@@ -89,6 +94,10 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
   dnl is left over from earlier calls, and neither setting optind = 0 nor
   dnl setting optreset = 1 get rid of this internal state.
   dnl POSIX is silent on optind vs. optreset, so we allow either behavior.
+  dnl POSIX 2008 does not specify leading '+' behavior, but see
+  dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on
+  dnl the next version of POSIX.  For now, we only guarantee leading '+'
+  dnl behavior with getopt-gnu.
   if test -z "$gl_replace_getopt"; then
     AC_CACHE_CHECK([whether getopt is POSIX compatible],
       [gl_cv_func_getopt_posix],
@@ -99,7 +108,7 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
 #include <stdlib.h>
 #include <string.h>
 
-#if !HAVE_DECL_OPTRESET
+#if !HAVE_DECL_OPTRESET && !HAVE_DECL_GETOPT_CLIP
 # define OPTIND_MIN 0
 #else
 # define OPTIND_MIN 1
@@ -167,6 +176,20 @@ main ()
     if (!(optind == 1))
       return 12;
   }
+  /* Detect MacOS 10.5 bug.  */
+  {
+    char *argv[3] = { "program", "-ab", NULL };
+    optind = OPTIND_MIN;
+    opterr = 0;
+    if (getopt (2, argv, "ab:") != 'a')
+      return 13;
+    if (getopt (2, argv, "ab:") != '?')
+      return 14;
+    if (optopt != 'b')
+      return 15;
+    if (optind != 2)
+      return 16;
+  }
 
   return 0;
 }
@@ -174,6 +197,7 @@ main ()
           [gl_cv_func_getopt_posix=yes], [gl_cv_func_getopt_posix=no],
           [case "$host_os" in
              mingw*) gl_cv_func_getopt_posix="guessing no";;
+             darwin*) gl_cv_func_getopt_posix="guessing no";;
              *)      gl_cv_func_getopt_posix="guessing yes";;
            esac
           ])
@@ -234,6 +258,15 @@ main ()
                if (getopt (3, argv, "-p") != 'p')
                  return 7;
              }
+             /* This code fails on glibc 2.11.  */
+             {
+               char *argv[] = { "program", "-b", "-a", NULL };
+               optind = opterr = 0;
+               if (getopt (3, argv, "+:a:b") != 'b')
+                 return 8;
+               if (getopt (3, argv, "+:a:b") != ':')
+                 return 9;
+             }
              return 0;
            ]])],
         [gl_cv_func_getopt_gnu=yes],
diff --git a/gltests/test-getopt.h b/gltests/test-getopt.h
index 96db7a5..8baa39d 100644
--- a/gltests/test-getopt.h
+++ b/gltests/test-getopt.h
@@ -420,7 +420,7 @@ test_getopt (void)
       ASSERT (optind == 3);
       ASSERT (!output);
     }
-#endif
+#endif /* GNULIB_TEST_GETOPT_GNU */
 
   /* Check that invalid options are recognized; and that both opterr
      and leading ':' can silence output.  */
@@ -993,7 +993,6 @@ test_getopt (void)
           ASSERT (optind == 12);
         }
     }
-#endif
 
   /* Check that the '-' flag has to come first.  */
   for (start = OPTIND_MIN; start <= 1; start++)
@@ -1124,10 +1123,6 @@ test_getopt (void)
       argv[argc++] = "-+";
       argv[argc] = NULL;
       optind = start;
-      /* Suppress output, since glibc is inconsistent on whether this
-         prints a message:
-         http://sources.redhat.com/bugzilla/show_bug.cgi?id=11039 */
-      opterr = 0;
       getopt_loop (argc, argv, "+abp:q:",
                    &a_seen, &b_seen, &p_value, &q_value,
                    &non_options_count, non_options, &unrecognized, &output);
@@ -1138,7 +1133,7 @@ test_getopt (void)
       ASSERT (non_options_count == 0);
       ASSERT (unrecognized == '+');
       ASSERT (optind == 2);
-      ASSERT (!output);
+      ASSERT (output);
     }
 
   /* Check that '--' ends the argument processing.  */
@@ -1195,6 +1190,7 @@ test_getopt (void)
       ASSERT (optind = 1);
       ASSERT (!output);
     }
+#endif /* GNULIB_TEST_GETOPT_GNU */
 
   /* Check that the '+' flag has to come first.  */
   for (start = OPTIND_MIN; start <= 1; start++)
@@ -1263,6 +1259,111 @@ test_getopt (void)
         }
     }
 
-  /* No tests of "-:..." or "+:...", due to glibc bug:
-     http://sources.redhat.com/bugzilla/show_bug.cgi?id=11039 */
+#if GNULIB_TEST_GETOPT_GNU
+  /* If GNU extensions are supported, require compliance with POSIX
+     interpretation on leading '+' behavior.
+     http://austingroupbugs.net/view.php?id=191  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "+:abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (strcmp (argv[0], "program") == 0);
+      ASSERT (strcmp (argv[1], "donald") == 0);
+      ASSERT (strcmp (argv[2], "-p") == 0);
+      ASSERT (strcmp (argv[3], "billy") == 0);
+      ASSERT (strcmp (argv[4], "duck") == 0);
+      ASSERT (strcmp (argv[5], "-a") == 0);
+      ASSERT (strcmp (argv[6], "bar") == 0);
+      ASSERT (argv[7] == NULL);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 1);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_loop (argc, argv, "+:abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 'p');
+      ASSERT (optind == 2);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-b";
+      argv[argc++] = "-p";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_loop (argc, argv, "+:abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 'p');
+      ASSERT (optind == 3);
+      ASSERT (!output);
+    }
+#endif /* GNULIB_TEST_GETOPT_GNU */
 }
diff --git a/gltests/test-getopt_long.h b/gltests/test-getopt_long.h
index 5f103c8..0e58fec 100644
--- a/gltests/test-getopt_long.h
+++ b/gltests/test-getopt_long.h
@@ -1151,8 +1151,7 @@ test_getopt_long (void)
                         &non_options_count, non_options, &unrecognized);
       ASSERT (a_seen == 0);
       ASSERT (b_seen == 0);
-      /* glibc bug http://sources.redhat.com/bugzilla/show_bug.cgi?id=11041 */
-      /* ASSERT (p_value == NULL); */
+      ASSERT (p_value == NULL);
       ASSERT (q_value == NULL);
       ASSERT (non_options_count == 0);
       ASSERT (unrecognized == 0);
@@ -2079,8 +2078,11 @@ test_getopt_long_only (void)
     opterr = 0;
     c = do_getopt_long_only (argc, argv, "ab", long_options_required,
                              &option_index);
-    /* glibc bug http://sources.redhat.com/bugzilla/show_bug.cgi?id=11041 */
-    /* ASSERT (c == 1003); */
+    /* glibc getopt_long_only is intentionally different from
+       getopt_long when handling a prefix that is common to two
+       spellings, when both spellings have the same option directives.
+       BSD getopt_long_only treats both cases the same.  */
+    ASSERT (c == 1003 || c == '?');
     ASSERT (optind == 2);
   }
   {
@@ -2096,8 +2098,11 @@ test_getopt_long_only (void)
     opterr = 0;
     c = do_getopt_long_only (argc, argv, "abx::", long_options_required,
                              &option_index);
-    /* glibc bug http://sources.redhat.com/bugzilla/show_bug.cgi?id=11041 */
-    /* ASSERT (c == 1003); */
+    /* glibc getopt_long_only is intentionally different from
+       getopt_long when handling a prefix that is common to two
+       spellings, when both spellings have the same option directives.
+       BSD getopt_long_only treats both cases the same.  */
+    ASSERT (c == 1003 || c == '?');
     ASSERT (optind == 2);
     ASSERT (optarg == NULL);
   }
diff --git a/lib/NEWS b/lib/NEWS
index 1554027..5cbc980 100644
--- a/lib/NEWS
+++ b/lib/NEWS
@@ -4,6 +4,10 @@ See the end for copying conditions.
 
 * Version 1.5.1 (unreleased) [beta]
 
+** libgsasl: No longer require the same or newer libgcrypt it was built with.
+Before libgsasl refused to work if it was used with a libgcrypt shared
+library that was older than the version that libgsasl was built with.
+
 ** Update gnulib files.
 
 ** API and ABI modifications.
diff --git a/lib/gl/gc-libgcrypt.c b/lib/gl/gc-libgcrypt.c
index b2a8376..3e47d2b 100644
--- a/lib/gl/gc-libgcrypt.c
+++ b/lib/gl/gc-libgcrypt.c
@@ -37,6 +37,10 @@
 
 #include <assert.h>
 
+#ifndef MIN_GCRYPT_VERSION
+# define MIN_GCRYPT_VERSION "1.4.4"
+#endif
+
 /* Initialization. */
 
 Gc_rc
@@ -50,7 +54,7 @@ gc_init (void)
       if (gcry_control (GCRYCTL_DISABLE_SECMEM, NULL, 0))
         return GC_INIT_ERROR;
 
-      if (gcry_check_version (GCRYPT_VERSION) == NULL)
+      if (gcry_check_version (MIN_GCRYPT_VERSION) == NULL)
         return GC_INIT_ERROR;
 
       err = gcry_control (GCRYCTL_INITIALIZATION_FINISHED, NULL, 0);


hooks/post-receive
-- 
GNU gsasl




reply via email to

[Prev in Thread] Current Thread [Next in Thread]