From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17618 invoked by alias); 27 Oct 2003 11:45:38 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 17570 invoked from network); 27 Oct 2003 11:45:37 -0000 Received: from unknown (HELO brunch.mit.edu) (18.92.0.171) by sources.redhat.com with SMTP; 27 Oct 2003 11:45:37 -0000 Received: from brunch.mit.edu (localhost [127.0.0.1]) by brunch.mit.edu (8.12.10/8.12.8) with ESMTP id h9RBjWud018709 for ; Mon, 27 Oct 2003 06:45:36 -0500 (EST) Date: Mon, 27 Oct 2003 17:06:00 -0000 Message-ID: <7662849.1067255132356.JavaMail.cyyang@brunch.mit.edu> From: George Carrette Reply-To: George Carrette To: cygwin@cygwin.com Subject: here is a patch for gnu tar incremental backup (-g) or (--listed-incremental) Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-SW-Source: 2003-10/txt/msg01657.txt.bz2 Here is a fix for gnu tar incremental backup feature for the most recent cygwin that uses a 64-bit value for the type ion_t This was done against the sources in release/tar/tar-1.13.25-3-src.tar.bz2 I am a fair C programmer but have no skill in GNU Autoconfig, so I did not attempt to define the required "#if" parameters in that way. But if you need a quick fix for the -g or --listed-incremental feature of gnu tar this will do nicely. I've provided both a regular diff and a patch diff, because regular diff more clearly shows the minimal changes required. The fix was quite easy due to a previous message to the cygwin mailing list where the problem was clearly identified as having to do with the inon_t size. -George J. Carrette ===INCREMEN.C.DIFF=== 133a134 > 367a369,381 > #define INO_T_SIZE 8 > #define LONG_SIZE 4 > #if INO_T_SIZE > LONG_SIZE > #define INON_T unsigned long long > #define DIRECTORY_FILE_ENTRY_FMT "+%lu %llu %s\n" > #define STRTOINON strtoull > #else > #define INON_T unsigned long > #define DIRECTORY_FILE_ENTRY_FMT "+%lu %lu %s\n" > #define STRTOINON strtoul > #endif > > 403c417 < unsigned long u = (errno = 0, strtoul (buf, &ebuf, 10)); --- > INON_T u = (errno = 0, STRTOINON (buf, &ebuf, 10)); 427c441 < dev = u = strtoul (strp, &ebuf, 10); --- > dev = u = STRTOINON (strp, &ebuf, 10); 439c453 < ino = u = strtoul (strp, &ebuf, 10); --- > ino = u = STRTOINON (strp, &ebuf, 10); 472a487 > 474c489 < fprintf (fp, "+%lu %lu %s\n" + ! directory->nfs, --- > fprintf (fp, DIRECTORY_FILE_ENTRY_FMT + ! directory->nfs, 476c491 < (unsigned long) directory->inode_number, --- > (INON_T) directory->inode_number, ===INCREMEN.C.PATCH=== *** incremen.c.old Sun Oct 26 20:44:33 2003 --- incremen.c Mon Oct 27 06:24:18 2003 *************** note_directory (char const *name, dev_t *** 131,136 **** --- 131,137 ---- size_t size = offsetof (struct directory, name) + strlen (name) + 1; struct directory *directory = xmalloc (size); + directory->device_number = dev; directory->inode_number = ino; directory->children = CHANGED_CHILDREN; *************** get_directory_contents (char *path, dev_ *** 365,370 **** --- 366,384 ---- } } + #define INO_T_SIZE 8 + #define LONG_SIZE 4 + #if INO_T_SIZE > LONG_SIZE + #define INON_T unsigned long long + #define DIRECTORY_FILE_ENTRY_FMT "+%lu %llu %s\n" + #define STRTOINON strtoull + #else + #define INON_T unsigned long + #define DIRECTORY_FILE_ENTRY_FMT "+%lu %lu %s\n" + #define STRTOINON strtoul + #endif + + static FILE *listed_incremental_stream; void *************** read_directory_file (void) *** 400,406 **** char *ebuf; int n; long lineno = 1; ! unsigned long u = (errno = 0, strtoul (buf, &ebuf, 10)); time_t t = u; if (buf == ebuf || (u == 0 && errno == EINVAL)) ERROR ((0, 0, "%s:1: %s", quotearg_colon (listed_incremental_option), --- 414,420 ---- char *ebuf; int n; long lineno = 1; ! INON_T u = (errno = 0, STRTOINON (buf, &ebuf, 10)); time_t t = u; if (buf == ebuf || (u == 0 && errno == EINVAL)) ERROR ((0, 0, "%s:1: %s", quotearg_colon (listed_incremental_option), *************** read_directory_file (void) *** 424,430 **** buf[n - 1] = '\0'; errno = 0; ! dev = u = strtoul (strp, &ebuf, 10); if (strp == ebuf || (u == 0 && errno == EINVAL)) ERROR ((0, 0, "%s:%ld: %s", quotearg_colon (listed_incremental_option), lineno, --- 438,444 ---- buf[n - 1] = '\0'; errno = 0; ! dev = u = STRTOINON (strp, &ebuf, 10); if (strp == ebuf || (u == 0 && errno == EINVAL)) ERROR ((0, 0, "%s:%ld: %s", quotearg_colon (listed_incremental_option), lineno, *************** read_directory_file (void) *** 436,442 **** strp = ebuf; errno = 0; ! ino = u = strtoul (strp, &ebuf, 10); if (strp == ebuf || (u == 0 && errno == EINVAL)) ERROR ((0, 0, "%s:%ld: %s", quotearg_colon (listed_incremental_option), lineno, --- 450,456 ---- strp = ebuf; errno = 0; ! ino = u = STRTOINON (strp, &ebuf, 10); if (strp == ebuf || (u == 0 && errno == EINVAL)) ERROR ((0, 0, "%s:%ld: %s", quotearg_colon (listed_incremental_option), lineno, *************** write_directory_file_entry (void *entry, *** 470,479 **** if (directory->found) { int e; char *str = quote_copy_string (directory->name); ! fprintf (fp, "+%lu %lu %s\n" + ! directory->nfs, (unsigned long) directory->device_number, ! (unsigned long) directory->inode_number, str ? str : directory->name); e = errno; if (str) --- 484,494 ---- if (directory->found) { int e; + char *str = quote_copy_string (directory->name); ! fprintf (fp, DIRECTORY_FILE_ENTRY_FMT + ! directory->nfs, (unsigned long) directory->device_number, ! (INON_T) directory->inode_number, str ? str : directory->name); e = errno; if (str) ========================================= -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/