[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-tar] invalid assumption in src/incremen.c
From: |
Eric Blake |
Subject: |
[Bug-tar] invalid assumption in src/incremen.c |
Date: |
Sat, 13 Aug 2005 16:03:30 -0600 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
src/incremen.c makes the invalid assumption that ino_t is no bigger than
long. But since the 1.5.x release of cygwin (keyed by
__CYGWIN_USE_BIG_TYPES__ in headers), long is 4 bytes, while ino_t is 8
bytes. This bug appears to be the cause of the breakage of test 20 of
tar-1.15.1 on cygwin, since --listed output was being truncated.
This patch was made by Chris Faylor, and is cygwin-specific, but
illustrates what needs to be fixed for the general case.
2005-08-13 Christopher Faylor <address@hidden>
* src/incremen.c (read_directory_file),
(write_directory_file_entry): On cygwin, ino_t is
bigger than unsigned long.
- --
Life is short - so eat dessert first!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFC/m4y84KuGfSFAYARAiWKAKCClc59zmdeuMS1LTNSpqGHZemgtwCZAdrW
ApeghDYSxQgQ/rd9iBE0fBw=
=twP7
-----END PGP SIGNATURE-----
--- tar-1.15.1.orig/src/incremen.c 2004-09-06 05:30:42.000000000 -0600
+++ tar-1.15.1/src/incremen.c 2005-08-13 15:54:51.685875000 -0600
@@ -386,15 +386,21 @@
strp = ebuf;
errno = 0;
+#ifdef __CYGWIN_USE_BIG_TYPES__
+ ino = strtoull (strp, &ebuf, 10);
+#else
ino = u = strtoul (strp, &ebuf, 10);
- if (strp == ebuf || (u == 0 && errno == EINVAL))
+#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,10 +427,17 @@
{
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,
+ (unsigned long long) directory->inode_number,
+ str ? str : directory->name);
+#else
fprintf (fp, "+%lu %lu %s\n" + ! directory->nfs,
(unsigned long) directory->device_number,
(unsigned long) directory->inode_number,
str ? str : directory->name);
+#endif
e = errno;
if (str)
free (str);
- [Bug-tar] invalid assumption in src/incremen.c,
Eric Blake <=