Thanks a lot for the report and patch! That is a problem even on 32-bit systems: (note that your patch wouldn't help on 32-bit systems)
This demonstrates it: $ echo -n abcdefgh|od -An -t x8 0000000064636261 Here's the fixed version: $ echo -n abcdefgh|./od -An -t x8 6867666564636261 Arun Sharma <[EMAIL PROTECTED]> wrote: > This bug report is against textutils-2.0.14 running on ia64. > > $ od -t x4 file | head > 0000000 00000000 20000000 fef583a1 00100001 > 0000020 00004000 20000000 feef43a1 00100001 ... > $ od -t x8 file | head > 0000000 0000000000000000 00000000fef583a1 > 0000020 0000000000004000 00000000feef43a1 ... > > As you can see, the higher bits are gone from the dump. > > The following patch fixes the problem for me. ... Here's the fix, relative to this package: ftp://alpha.gnu.org/gnu/fetish/coreutils-4.5.1.tar.gz (just a reminder that the coreutils package is the new name for the combination of the fileutils, textutils, and sh-utils) Note that the patch below is incomplete in that it omits the autoconf tests that would set PRI_MACROS_BROKEN on losing systems like AIX 4.3.3. But it should work fine on other systems. The complete patch will appear in coreutils-4.5.2. Index: od.c =================================================================== RCS file: /fetish/cu/src/od.c,v retrieving revision 1.130 retrieving revision 1.131 diff -u -p -u -r1.130 -r1.131 --- od.c 2 Sep 2002 07:23:09 -0000 1.130 +++ od.c 17 Sep 2002 22:06:21 -0000 1.131 @@ -742,6 +742,11 @@ this system doesn't provide a %lu-byte i break; } +#define ISPEC_TO_FORMAT(Spec, Min_format, Long_format, Max_format) \ + ((Spec) == LONG_LONG ? (Max_format) \ + : ((Spec) == LONG ? (Long_format) \ + : (Min_format))) \ + #define FMT_BYTES_ALLOCATED 9 fmt_string = xmalloc (FMT_BYTES_ALLOCATED); @@ -751,32 +756,30 @@ this system doesn't provide a %lu-byte i { case 'd': fmt = SIGNED_DECIMAL; - sprintf (fmt_string, " %%%u%sd", + sprintf (fmt_string, " %%%u%s", (field_width = bytes_to_signed_dec_digits[size]), - (size_spec == LONG ? "l" - : (size_spec == LONG_LONG ? "ll" - : ""))); + ISPEC_TO_FORMAT (size_spec, "d", "ld", PRIdMAX)); break; case 'o': fmt = OCTAL; - sprintf (fmt_string, " %%0%u%so", + sprintf (fmt_string, " %%0%u%s", (field_width = bytes_to_oct_digits[size]), - (size_spec == LONG ? "l" : "")); + ISPEC_TO_FORMAT (size_spec, "o", "lo", PRIoMAX)); break; case 'u': fmt = UNSIGNED_DECIMAL; - sprintf (fmt_string, " %%%u%su", + sprintf (fmt_string, " %%%u%s", (field_width = bytes_to_unsigned_dec_digits[size]), - (size_spec == LONG ? "l" : "")); + ISPEC_TO_FORMAT (size_spec, "u", "lu", PRIuMAX)); break; case 'x': fmt = HEXADECIMAL; - sprintf (fmt_string, " %%0%u%sx", + sprintf (fmt_string, " %%0%u%s", (field_width = bytes_to_hex_digits[size]), - (size_spec == LONG ? "l" : "")); + ISPEC_TO_FORMAT (size_spec, "x", "lx", PRIxMAX)); break; default: @@ -1646,6 +1649,8 @@ main (int argc, char **argv) integral_type_size[sizeof (int)] = INT; integral_type_size[sizeof (long int)] = LONG; #if HAVE_UNSIGNED_LONG_LONG + /* If `long' and `long long' have the same size, it's fine + to overwrite the entry for `long' with this one. */ integral_type_size[sizeof (ulonglong_t)] = LONG_LONG; #endif Index: sys2.h =================================================================== RCS file: /fetish/cu/src/sys2.h,v retrieving revision 1.69 retrieving revision 1.70 diff -u -p -u -r1.69 -r1.70 --- sys2.h 15 Jun 2002 06:53:57 -0000 1.69 +++ sys2.h 17 Sep 2002 14:41:43 -0000 1.70 @@ -264,6 +264,23 @@ char *alloca (); # include <inttypes.h> /* for the definition of UINTMAX_MAX */ #endif +#if !defined PRIdMAX || PRI_MACROS_BROKEN +# undef PRIdMAX +# define PRIdMAX (sizeof (uintmax_t) == sizeof (long) ? "ld" : "lld") +#endif +#if !defined PRIoMAX || PRI_MACROS_BROKEN +# undef PRIoMAX +# define PRIoMAX (sizeof (uintmax_t) == sizeof (long) ? "lo" : "llo") +#endif +#if !defined PRIuMAX || PRI_MACROS_BROKEN +# undef PRIuMAX +# define PRIuMAX (sizeof (uintmax_t) == sizeof (long) ? "lu" : "llu") +#endif +#if !defined PRIxMAX || PRI_MACROS_BROKEN +# undef PRIxMAX +# define PRIxMAX (sizeof (uintmax_t) == sizeof (long) ? "lx" : "llx") +#endif + #include <ctype.h> /* Jim Meyering writes: _______________________________________________ Bug-textutils mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-textutils