[Gpg4win-commits] r1504 - in trunk: . packages patches/gnupg2-2.0.16

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Aug 24 11:20:49 CEST 2010


Author: werner
Date: 2010-08-24 11:20:47 +0200 (Tue, 24 Aug 2010)
New Revision: 1504

Added:
   trunk/patches/gnupg2-2.0.16/04-gpgtar-2.patch
Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/packages/packages.current
Log:
Add more options to gpgtar


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-08-17 14:05:46 UTC (rev 1503)
+++ trunk/ChangeLog	2010-08-24 09:20:47 UTC (rev 1504)
@@ -1,3 +1,12 @@
+2010-08-24  Werner Koch  <wk at g10code.com>
+
+	* patches/gnupg2-2.0.16/04-gpgtar-2.patch: New.
+	* Makefile.am (EXTRA_DIST): Add patch
+
+2010-08-24  Werner Koch  <wk at g10code.com>
+
+	* packages/packages.current: Update libassuan.
+
 2010-08-17  Emanuel Schuetze <emanuel at intevation.de>
 
 	* configure.ac: Added date and version for English compendium.
@@ -2,4 +11,2 @@
 
-
-
 2010-07-27  Werner Koch  <wk at g10code.com>

Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am	2010-08-17 14:05:46 UTC (rev 1503)
+++ trunk/Makefile.am	2010-08-24 09:20:47 UTC (rev 1504)
@@ -62,6 +62,7 @@
 	patches/gnupg2-2.0.16/01-estream.patch \
 	patches/gnupg2-2.0.16/02-gpgtar.patch \
         patches/gnupg2-2.0.16/03-kbx-realloc.patch \
+	patches/gnupg2-2.0.16/04-gpgtar-2.patch \
 	patches/dirmngr-1.0.3/01-ldaphttp.patch \
 	patches/gpgol-0.9.91/01-gpgme.patch \
         patches/gpa-0.9.0/01-title-prop.patch \

Modified: trunk/packages/packages.current
===================================================================
--- trunk/packages/packages.current	2010-08-17 14:05:46 UTC (rev 1503)
+++ trunk/packages/packages.current	2010-08-24 09:20:47 UTC (rev 1504)
@@ -331,8 +331,8 @@
 file libgcrypt/libgcrypt-1.4.6.tar.bz2
 chk  445b9e158aaf91e24eae3d1040c6213e9d9f5ba6
 
-#file libassuan/libassuan-2.0.0.tar.bz2
-#chk  b03c586a4eefdfc0bb1ec65ecf958b9890d429f7
+file libassuan/libassuan-2.0.1.tar.bz2
+chk  b7e9dbd41769cc20b1fb7db9f2ecdf276ffc352c
 
 name gnupg2-2.0.16.tar.bz2
 file gnupg/gnupg-2.0.16.tar.bz2
@@ -353,10 +353,7 @@
 file gpgme-1.3.1-svn1460.tar.bz2
 chk  a309ae1880c84bf7d76fea7186b3247ee70b1693
 
-file libassuan-2.0.1-svn378.tar.bz2
-chk  2dcfad0f3cf0ef65af382892d6cdfee573ff6c22
 
-
 #
 #  GnuPG utilities
 #

Added: trunk/patches/gnupg2-2.0.16/04-gpgtar-2.patch
===================================================================
--- trunk/patches/gnupg2-2.0.16/04-gpgtar-2.patch	2010-08-17 14:05:46 UTC (rev 1503)
+++ trunk/patches/gnupg2-2.0.16/04-gpgtar-2.patch	2010-08-24 09:20:47 UTC (rev 1504)
@@ -0,0 +1,259 @@
+#! /bin/sh
+patch -p1 -f $* < $0
+exit $?
+
+[tools/]
+2010-08-24  Werner Koch  <wk at g10code.com>
+
+	* gpgtar-create.c (gpgtar_create): Allow "-" for stdout in
+	opt.outfile.  Switch es_stdout to binary mode.
+
+	* gpgtar.c (main): Add options -T and --null.
+	* gpgtar-create.c (gpgtar_create): Implement option --null.
+
+
+diff -urpN orig/gnupg2-2.0.16/tools/gpgtar-create.c gnupg2-2.0.16/tools/gpgtar-create.c
+--- orig/gnupg2-2.0.16/tools/gpgtar-create.c	2010-08-24 09:19:53.000000000 +0200
++++ gnupg2-2.0.16/tools/gpgtar-create.c	2010-08-24 09:31:54.000000000 +0200
+@@ -28,6 +28,7 @@
+ #ifdef HAVE_W32_SYSTEM
+ # define WIN32_LEAN_AND_MEAN
+ # include <windows.h>
++# include <fcntl.h> /* for setmode() */
+ #else /*!HAVE_W32_SYSTEM*/
+ # include <unistd.h>
+ # include <pwd.h>
+@@ -736,27 +737,88 @@ write_eof_mark (estream_t stream)
+ 
+ 
+ 
++/* Create a new tarball using the names in the array INPATTERN.  If
++   INPATTERN is NULL take the pattern as null terminated strings from
++   stdin.  */
+ void
+ gpgtar_create (char **inpattern)
+ {
+   gpg_error_t err = 0;
+-  const char *pattern;
+   struct scanctrl_s scanctrl_buffer;
+   scanctrl_t scanctrl = &scanctrl_buffer;
+   tar_header_t hdr, *start_tail;
+   estream_t outstream = NULL;
++  int eof_seen = 0;
++
++  if (!inpattern)
++    setmode (es_fileno (es_stdin), O_BINARY);
+ 
+   memset (scanctrl, 0, sizeof *scanctrl);
+   scanctrl->flist_tail = &scanctrl->flist;
+ 
+-  for (; (pattern = *inpattern); inpattern++)
++  while (!eof_seen)
+     {
+       char *pat, *p;
++      int skip_this = 0;
++
++      if (inpattern)
++        {
++          const char *pattern = *inpattern;
++
++          if (!pattern)
++            break; /* End of array.  */
++          inpattern++;
++          
++          if (!*pattern)
++            continue;
++
++          pat = xtrystrdup (pattern);
++        }
++      else /* Read null delimited pattern from stdin.  */
++        {
++          int c;
++          char namebuf[4096];
++          size_t n = 0;
++          
++          for (;;)
++            {
++              if ((c = es_getc (es_stdin)) == EOF)
++                {
++                  if (es_ferror (es_stdin))
++                    {
++                      err = gpg_error_from_syserror ();
++                      log_error ("error reading `%s': %s\n",
++                                 "[stdin]", strerror (errno));
++                      goto leave;
++                    }
++                  /* Note: The Nul is a delimiter and not a terminator.  */
++                  c = 0;
++                  eof_seen = 1;
++                }
++              if (n >= sizeof namebuf - 1)
++                {
++                  if (!skip_this)
++                    {
++                      skip_this = 1;
++                      log_error ("error reading `%s': %s\n",
++                                 "[stdin]", "filename too long");
++                    }
++                }
++              else
++                namebuf[n++] = c;
++              if (!c)
++                {
++                  namebuf[n] = 0;
++                  break;
++                }
++            }
++          
++          if (skip_this || n < 2)
++            continue;
+ 
+-      if (!*pattern)
+-        continue;
++          pat = xtrystrdup (namebuf);
++        }
+ 
+-      pat = xtrystrdup (pattern);
+       if (!pat)
+         {
+           err = gpg_error_from_syserror ();
+@@ -771,7 +833,7 @@ gpgtar_create (char **inpattern)
+         log_info ("scanning `%s'\n", pat);
+ 
+       start_tail = scanctrl->flist_tail;
+-      if (!pattern_valid_p (pat))
++      if (skip_this || !pattern_valid_p (pat))
+         log_error ("skipping invalid name `%s'\n", pat);
+       else if (!add_entry (pat, NULL, scanctrl)
+                && *start_tail && ((*start_tail)->typeflag & TF_DIRECTORY))
+@@ -782,7 +844,10 @@ gpgtar_create (char **inpattern)
+ 
+   if (opt.outfile)
+     {
+-      outstream = es_fopen (opt.outfile, "wb");
++      if (!strcmp (opt.outfile, "-"))
++        outstream = es_stdout;
++      else
++        outstream = es_fopen (opt.outfile, "wb");
+       if (!outstream)
+         {
+           err = gpg_error_from_syserror ();
+@@ -796,6 +861,9 @@ gpgtar_create (char **inpattern)
+       outstream = es_stdout;
+     }
+ 
++  if (outstream == es_stdout)
++    setmode (es_fileno (es_stdout), O_BINARY);
++
+   for (hdr = scanctrl->flist; hdr; hdr = hdr->next)
+     {
+       err = write_file (outstream, hdr);
+diff -urpN orig/gnupg2-2.0.16/tools/gpgtar.c gnupg2-2.0.16/tools/gpgtar.c
+--- orig/gnupg2-2.0.16/tools/gpgtar.c	2010-08-24 09:19:53.000000000 +0200
++++ gnupg2-2.0.16/tools/gpgtar.c	2010-08-24 09:38:15.000000000 +0200
+@@ -55,12 +55,16 @@ enum cmd_and_opt_values
+     oOutput	= 'o',
+     oQuiet      = 'q',
+     oVerbose	= 'v',
++    oFilesFrom  = 'T',
+     oNoVerbose	= 500,
+ 
+     aSignEncrypt,
+     oSkipCrypto,
++    oOpenPGP,
++    oCMS,
+     oSetFilename,
+-    aList
++    aList,
++    oNull
+   };
+ 
+ 
+@@ -84,6 +88,11 @@ static ARGPARSE_OPTS opts[] = {
+   ARGPARSE_s_n (oQuiet,	"quiet",  N_("be somewhat more quiet")),
+   ARGPARSE_s_n (oSkipCrypto, "skip-crypto", N_("skip the crypto processing")),
+   ARGPARSE_s_s (oSetFilename, "set-filename", "@"),
++  ARGPARSE_s_s (oFilesFrom, "files-from",
++                N_("|FILE|get names to create from FILE")),
++  ARGPARSE_s_n (oNull, "null", N_("-T reads null-terminated names")),
++  ARGPARSE_s_n (oOpenPGP, "openpgp", "@"),
++  ARGPARSE_s_n (oCMS, "cms", "@"),
+ 
+   ARGPARSE_end ()
+ };
+@@ -157,6 +166,8 @@ main (int argc, char **argv)
+   int no_more_options = 0;
+   enum cmd_and_opt_values cmd = 0;
+   int skip_crypto = 0;
++  const char *files_from = NULL;
++  int null_names = 0;
+ 
+   assert (sizeof (struct ustar_raw_header) == 512);
+ 
+@@ -181,6 +192,8 @@ main (int argc, char **argv)
+ 	case oQuiet:     opt.quiet = 1; break;
+         case oVerbose:   opt.verbose++; break;
+         case oNoVerbose: opt.verbose = 0; break;
++        case oFilesFrom: files_from = pargs.r.ret_str; break;
++        case oNull: null_names = 1; break;
+           
+ 	case aList:
+         case aDecrypt:
+@@ -198,10 +211,18 @@ main (int argc, char **argv)
+           skip_crypto = 1;
+           break;
+ 
++        case oOpenPGP: /* Dummy option for now.  */ break;
++        case oCMS:     /* Dummy option for now.  */ break;
++
+         default: pargs.err = 2; break;
+ 	}
+     }
+   
++  if ((files_from && !null_names) || (!files_from && null_names))
++    log_error ("--files-from and --null may only be used in conjunction\n");
++  if (files_from && strcmp (files_from, "-"))
++    log_error ("--files-from only supports argument \"-\"\n");
++
+   if (log_get_errorcount (0))
+     exit (2);
+ 
+@@ -213,6 +234,8 @@ main (int argc, char **argv)
+       fname = argc ? *argv : NULL;
+       if (opt.filename)
+         log_info ("note: ignoring option --set-filename\n");
++      if (files_from)
++        log_info ("note: ignoring option --files-from\n");
+       if (skip_crypto)
+         gpgtar_list (fname);
+       else
+@@ -220,14 +243,15 @@ main (int argc, char **argv)
+       break;
+ 
+     case aEncrypt:
+-      if (!argc)
++      if ((!argc && !null_names)
++          || (argc && null_names))
+         usage (1);
+       if (opt.filename)
+         log_info ("note: ignoring option --set-filename\n");
+       if (skip_crypto)
+-        gpgtar_create (argv);
++        gpgtar_create (null_names? NULL :argv);
+       else
+-        tar_and_encrypt (argv);
++        tar_and_encrypt (null_names? NULL : argv);
+       break;
+ 
+     case aDecrypt:
+@@ -235,6 +259,8 @@ main (int argc, char **argv)
+         usage (1);
+       if (opt.outfile)
+         log_info ("note: ignoring option --output\n");
++      if (files_from)
++        log_info ("note: ignoring option --files-from\n");
+       fname = argc ? *argv : NULL;
+       if (skip_crypto)
+         gpgtar_extract (fname);
+
+


Property changes on: trunk/patches/gnupg2-2.0.16/04-gpgtar-2.patch
___________________________________________________________________
Name: svn:executable
   + *



More information about the Gpg4win-commits mailing list