On Sat, Aug 13, 2005 at 02:42:26PM -0600, Eric Blake wrote:
>According to Christopher Faylor on 8/13/2005 2:35 PM:
>> Sure, please take tar.  I noticed the autodetection of the compressed
>> files on one of my linux boxes.  I've had a new version sitting in my
>> sandbox for a while but I haven't taken the time to see if I got
>> everything right as far as binmode/textmode goes.  I've been carrying a
>> few patches around that I've been remiss in submitting upstream since I
>> anticipated pushback.
>
>The tar testsuite completed without error with a second tweak (the 1.15.1
>tarball is missing a couple of testsuite files that I had to copy from
>CVS), but I have not done any binmode/textmode testing.  And your
>packaging of 1.13.25 was pretty sparse on patch documentation; it looks
>like I will have to manually diff /usr/src/tar-1.13.25-7 with the original
>tar-1.13.25 tarball (if I can find it online) to see what patches you had
>made, unless you want to send your patches to me directly.

The patch that I adapted from 1.13.25 to 1.15.1 is attached.

cgf

--- ./rmt/Makefile.in.orig      2005-04-19 15:45:18.000000000 -0400
+++ ./rmt/Makefile.in   2005-04-19 16:23:53.000000000 -0400
@@ -38,7 +38,7 @@
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-rmt_PROGRAMS = @PU_RMT_PROG@
+rmt_PROGRAMS = @[EMAIL PROTECTED](EXEEXT)
 EXTRA_PROGRAMS = rmt$(EXEEXT)
 subdir = rmt
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
--- ./src/buffer.c.orig 2004-12-21 10:09:24.000000000 -0500
+++ ./src/buffer.c      2005-04-19 15:42:44.000000000 -0400
@@ -1099,7 +1099,7 @@
 void
 init_volume_number (void)
 {
-  FILE *file = fopen (volno_file_option, "r");
+  FILE *file = fopen (volno_file_option, FOPEN_TEXT_READ);
 
   if (file)
     {
--- ./src/extract.c.orig        2004-12-21 04:55:12.000000000 -0500
+++ ./src/extract.c     2005-04-19 15:42:44.000000000 -0400
@@ -1149,8 +1149,10 @@
             don't create a symlink, as the placeholder was probably
             removed by a later extraction.  */
          if (lstat (source, &st) == 0
+#ifndef __CYGWIN__ /* These aren't safe tests under Cygwin. */
              && st.st_dev == ds->dev
              && st.st_ino == ds->ino
+#endif
              && st.st_mtime == ds->mtime)
            {
              /* Unlink the placeholder, then create a hard link if possible,
--- ./src/incremen.c.orig       2004-09-06 07:30:42.000000000 -0400
+++ ./src/incremen.c    2005-04-19 15:42:44.000000000 -0400
@@ -325,7 +325,7 @@
   /* Open the file for both read and write.  That way, we can write
      it later without having to reopen it, and don't have to worry if
      we chdir in the meantime.  */
-  fd = open (listed_incremental_option, O_RDWR | O_CREAT, MODE_RW);
+  fd = open (listed_incremental_option, O_RDWR | O_CREAT | O_TEXT, MODE_RW);
   if (fd < 0)
     {
       open_error (listed_incremental_option);
@@ -386,15 +386,21 @@
          strp = ebuf;
 
          errno = 0;
-         ino = u = strtoul (strp, &ebuf, 10);
-         if (strp == ebuf || (u == 0 && errno == EINVAL))
+#ifdef __CYGWIN_USE_BIG_TYPES__
+         ino = strtoull (strp, &ebuf, 10);
+#else
+         ino = strtoul (strp, &ebuf, 10);
+#endif
+         if (strp == ebuf || (ino == 0 && errno == EINVAL))
            ERROR ((0, 0, "%s:%ld: %s",
                    quotearg_colon (listed_incremental_option), lineno,
                    _("Invalid inode number")));
+#ifndef __CYGWIN_USE_BIG_TYPES__
          else if (ino != u || (u == -1 && errno == ERANGE))
            ERROR ((0, 0, "%s:%ld: %s",
                    quotearg_colon (listed_incremental_option), lineno,
                    _("Inode number out of range")));
+#endif
          strp = ebuf;
 
          strp++;
@@ -421,9 +427,15 @@
     {
       int e;
       char *str = quote_copy_string (directory->name);
+#ifdef __CYGWIN_USE_BIG_TYPES__
+      fprintf (fp, "+%lu %llu %s\n" + ! directory->nfs,
+              (unsigned long) directory->device_number,
+              directory->inode_number,
+#else
       fprintf (fp, "+%lu %lu %s\n" + ! directory->nfs,
               (unsigned long) directory->device_number,
               (unsigned long) directory->inode_number,
+#endif
               str ? str : directory->name);
       e = errno;
       if (str)
--- ./src/names.c.orig  2004-09-06 07:30:54.000000000 -0400
+++ ./src/names.c       2005-04-19 15:42:44.000000000 -0400
@@ -240,8 +240,11 @@
        {
          request_stdin ("-T");
          name_file = stdin;
+#ifdef __CYGWIN__
+         setmode (fileno (stdin), O_TEXT);
+#endif
        }
-      else if (name_file = fopen (files_from_option, "r"), !name_file)
+      else if (name_file = fopen (files_from_option, FOPEN_TEXT_READ), 
!name_file)
        open_fatal (files_from_option);
     }
 }
--- ./src/tar.c.orig    2004-12-21 09:11:26.000000000 -0500
+++ ./src/tar.c 2005-04-19 15:42:54.000000000 -0400
@@ -85,7 +85,7 @@
     {
       if (archive == 0 || stdin_used_by)
        {
-         confirm_file = fopen (TTY_NAME, "r");
+         confirm_file = fopen (TTY_NAME, FOPEN_TEXT_READ);
          if (! confirm_file)
            open_fatal (TTY_NAME);
        }

Reply via email to