[git] GnuPG - branch, master, updated. post-nuke-of-trailing-ws-153-g1116466

by Werner Koch cvs at cvs.gnupg.org
Mon Dec 12 21:55:34 CET 2011


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 "The GNU Privacy Guard".

The branch, master has been updated
       via  11164662788036c4b15d30555ea33ec0b6f5a670 (commit)
       via  cd29dc0f1cf7f3bd7938ffa65bf13f9a75d8c156 (commit)
       via  ea0a21410b8fa460882c0f8de90b9291345fd4fc (commit)
      from  8a12a2000d82acfa881e8c18d028290100bf5e43 (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 11164662788036c4b15d30555ea33ec0b6f5a670
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Dec 12 21:02:54 2011 +0100

    scd: Retry command SERIALNO for an inactive card.
    
    * scd/command.c (cmd_serialno): Retry once for an inactive card.

diff --git a/scd/command.c b/scd/command.c
index 655032f..b2a504c 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -518,8 +518,10 @@ cmd_serialno (assuan_context_t ctx, char *line)
   char *serial_and_stamp;
   char *serial;
   time_t stamp;
+  int retries = 0;
 
   /* Clear the remove flag so that the open_card is able to reread it.  */
+ retry:
   if (!reader_disabled && ctrl->server_local->card_removed)
     {
       if ( IS_LOCKED (ctrl) )
@@ -528,7 +530,12 @@ cmd_serialno (assuan_context_t ctx, char *line)
     }
 
   if ((rc = open_card (ctrl, *line? line:NULL)))
-    return rc;
+    {
+      /* In case of an inactive card, retry once.  */
+      if (gpg_err_code (rc) == GPG_ERR_CARD_RESET && retries++ < 1)
+        goto retry;
+      return rc;
+    }
 
   rc = app_get_serial_and_stamp (ctrl->app_ctx, &serial, &stamp);
   if (rc)

commit cd29dc0f1cf7f3bd7938ffa65bf13f9a75d8c156
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Dec 12 20:34:12 2011 +0100

    Fix detection of card removal and insertion.
    
    * scd/apdu.c (apdu_connect): Return status codes for no card available
    and inactive card.
    * scd/command.c (TEST_CARD_REMOVAL): Also test for GPG_ERR_CARD_RESET.
    (open_card): Map apdu_connect status to GPG_ERR_CARD_RESET.

diff --git a/scd/apdu.c b/scd/apdu.c
index c130d89..ae91082 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -3051,11 +3051,14 @@ apdu_enum_reader (int slot, int *used)
 
 
 /* Connect a card.  This is used to power up the card and make sure
-   that an ATR is available.  */
+   that an ATR is available.  Depending on the reader backend it may
+   return an error for an inactive card or if no card is
+   available.  */
 int
 apdu_connect (int slot)
 {
   int sw;
+  unsigned int status;
 
   if (slot < 0 || slot >= MAX_READER || !reader_table[slot].used )
     return SW_HOST_NO_DRIVER;
@@ -3080,7 +3083,15 @@ apdu_connect (int slot)
      scdaemon is fired up and apdu_get_status has not yet been called.
      Without that we would force a reset of the card with the next
      call to apdu_get_status.  */
-  apdu_get_status_internal (slot, 1, 1, NULL, NULL);
+  apdu_get_status_internal (slot, 1, 1, &status, NULL);
+  if (sw)
+    ;
+  else if (!(status & APDU_CARD_PRESENT))
+    sw = SW_HOST_NO_CARD;
+  else if (((status & APDU_CARD_PRESENT) && !(status & APDU_CARD_ACTIVE))
+           || !reader_table[slot].atrlen)
+    sw = SW_HOST_CARD_INACTIVE;
+
 
   return sw;
 }
diff --git a/scd/command.c b/scd/command.c
index 9bb5005..655032f 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -60,6 +60,7 @@
           int _r = (r);                                     \
           if (gpg_err_code (_r) == GPG_ERR_CARD_NOT_PRESENT \
               || gpg_err_code (_r) == GPG_ERR_CARD_REMOVED  \
+              || gpg_err_code (_r) == GPG_ERR_CARD_RESET    \
               || gpg_err_code (_r) == GPG_ERR_ENODEV )      \
             update_card_removed ((c)->reader_slot, 1);      \
        } while (0)
@@ -420,9 +421,8 @@ get_reader_slot (void)
   return 0;
 }
 
-/* If the card has not yet been opened, do it.  Note that this
-   function returns an Assuan error, so don't map the error a second
-   time.  */
+
+/* If the card has not yet been opened, do it.  */
 static gpg_error_t
 open_card (ctrl_t ctrl, const char *apptype)
 {
@@ -477,6 +477,8 @@ open_card (ctrl_t ctrl, const char *apptype)
         {
           if (sw == SW_HOST_NO_CARD)
             err = gpg_error (GPG_ERR_CARD_NOT_PRESENT);
+          else if (sw == SW_HOST_CARD_INACTIVE)
+            err = gpg_error (GPG_ERR_CARD_RESET);
           else
             err = gpg_error (GPG_ERR_CARD);
 	}

commit ea0a21410b8fa460882c0f8de90b9291345fd4fc
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Dec 12 20:28:58 2011 +0100

    gitlog-to-changelog: New option --tear-off.
    
    * scripts/gitlog-to-changelog: Add option --tear-off.
    * Makefile.am (gen-ChangeLog): Use that option.

diff --git a/Makefile.am b/Makefile.am
index 5f9bf2e..49ec3fc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -116,7 +116,7 @@ gen-ChangeLog:
 	if test -d $(top_srcdir)/.git; then				\
 	  (cd $(top_srcdir) &&                      			\
 	    ./scripts/gitlog-to-changelog				\
-	    --append-dot						\
+	    --append-dot --tear-off					\
 	    --amend=scripts/git-log-fix	 				\
 	    --since=$(gen_start_date) ) > $(distdir)/cl-t;		\
           cat $(top_srcdir)/scripts/git-log-footer >> $(distdir)/cl-t;  \
diff --git a/scripts/gitlog-to-changelog b/scripts/gitlog-to-changelog
index a7ea194..d9f594f 100755
--- a/scripts/gitlog-to-changelog
+++ b/scripts/gitlog-to-changelog
@@ -64,6 +64,7 @@ OPTIONS:
                   makes a change to SHA1's commit log text or metadata.
    --append-dot append a dot to the first line of each commit message if
                   there is no other punctuation or blank at the end.
+   --tear-off   tear off all commit log lines after a '--' line.
    --since=DATE convert only the logs since DATE;
                   the default is to convert all log entries.
    --format=FMT set format string for commit subject and body;
@@ -175,6 +176,7 @@ sub parse_amend_file($)
   my $format_string = '%s%n%b%n';
   my $amend_file;
   my $append_dot = 0;
+  my $tear_off = 0;
   GetOptions
     (
      help => sub { usage 0 },
@@ -183,6 +185,7 @@ sub parse_amend_file($)
      'format=s' => \$format_string,
      'amend=s' => \$amend_file,
      'append-dot' => \$append_dot,
+     'tear-off' => \$tear_off,
     ) or usage 1;
 
 
@@ -282,13 +285,16 @@ sub parse_amend_file($)
       @line = grep !/^Co-authored-by: /, @line;
 
       # Remove everything after a line with 2 dashes at the beginning.
-      my @tmpline;
-      foreach (@line)
-	{
-	  last if /^--\s*$/;
-          push @tmpline,$_;
+      if ($tear_off)
+        {
+           my @tmpline;
+           foreach (@line)
+             {
+	       last if /^--\s*$/;
+               push @tmpline,$_;
+             }
+           @line = @tmpline;
         }
-      @line = @tmpline;
 
       # Remove leading and trailing blank lines.
       if (@line)

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

Summary of changes:
 Makefile.am                 |    2 +-
 scd/apdu.c                  |   15 +++++++++++++--
 scd/command.c               |   17 +++++++++++++----
 scripts/gitlog-to-changelog |   18 ++++++++++++------
 4 files changed, 39 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list