Package: coreutils
Version: 5.97-5.5
Severity: minor
Tags: patch

There are many coreutil commands using size suffix.  Although they are
parsed by the same routines (xstrtoumax.c -> xstrtol.c), its capability
are restricted for most coreutil commands.

Please consider adding attached file to be placed in debian/patches.
(or forward this patch to upstream)

So far it is cleanly compiling and seems to work nicely.

This patch only applies to executable side but do not change manpage
yet.  Some options are there as compatibility and consistency only.

This should solve complain such as http://bugs.debian.org/342238

This patch solves more than just M for split but much more :-)

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.22-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages coreutils depends on:
ii  libacl1                      2.2.42-1    Access control list shared library
ii  libc6                        2.6.1-1     GNU C Library: Shared libraries
ii  libselinux1                  2.0.15-2+b1 SELinux shared libraries

coreutils recommends no packages.

-- no debconf information

diff -Nru coreutils-5.97-old/src/dd.c coreutils-5.97/src/dd.c
--- coreutils-5.97-old/src/dd.c 2007-09-01 08:06:07.000000000 +0900
+++ coreutils-5.97/src/dd.c     2007-09-01 09:48:31.000000000 +0900
@@ -829,7 +829,7 @@
 {
   uintmax_t n;
   char *suffix;
-  enum strtol_error e = xstrtoumax (str, &suffix, 10, &n, "bcEGkKMPTwYZ0");
+  enum strtol_error e = xstrtoumax (str, &suffix, 10, &n, "bcEgGkKmMPtTwYZ0");
 
   if (e == LONGINT_INVALID_SUFFIX_CHAR && *suffix == 'x')
     {
diff -Nru coreutils-5.97-old/src/head.c coreutils-5.97/src/head.c
--- coreutils-5.97-old/src/head.c       2005-07-12 03:23:23.000000000 +0900
+++ coreutils-5.97/src/head.c   2007-09-01 09:48:59.000000000 +0900
@@ -872,7 +872,7 @@
   strtol_error s_err;
   uintmax_t n;
 
-  s_err = xstrtoumax (n_string, NULL, 10, &n, "bkm");
+  s_err = xstrtoumax (n_string, NULL, 10, &n, "bEgGkKmMPtTYZ0");
 
   if (s_err == LONGINT_OVERFLOW)
     {
diff -Nru coreutils-5.97-old/src/od.c coreutils-5.97/src/od.c
--- coreutils-5.97-old/src/od.c 2005-12-14 16:36:14.000000000 +0900
+++ coreutils-5.97/src/od.c     2007-09-01 09:50:06.000000000 +0900
@@ -1648,7 +1648,7 @@
 
        case 'j':
          modern = true;
-         s_err = xstrtoumax (optarg, NULL, 0, &n_bytes_to_skip, "bkm");
+         s_err = xstrtoumax (optarg, NULL, 0, &n_bytes_to_skip, 
"bEgGkKmMPtTYZ0");
          if (s_err != LONGINT_OK)
            STRTOL_FATAL_ERROR (optarg, _("skip argument"), s_err);
          break;
@@ -1657,7 +1657,7 @@
          modern = true;
          limit_bytes_to_format = true;
 
-         s_err = xstrtoumax (optarg, NULL, 0, &max_bytes_to_format, "bkm");
+         s_err = xstrtoumax (optarg, NULL, 0, &max_bytes_to_format, 
"bEgGkKmMPtTYZ0");
          if (s_err != LONGINT_OK)
            STRTOL_FATAL_ERROR (optarg, _("limit argument"), s_err);
          break;
@@ -1668,7 +1668,7 @@
            string_min = 3;
          else
            {
-             s_err = xstrtoumax (optarg, NULL, 0, &tmp, "bkm");
+             s_err = xstrtoumax (optarg, NULL, 0, &tmp, "bEgGkKmMPtTYZ0");
              if (s_err != LONGINT_OK)
                STRTOL_FATAL_ERROR (optarg, _("minimum string length"), s_err);
 
diff -Nru coreutils-5.97-old/src/shred.c coreutils-5.97/src/shred.c
--- coreutils-5.97-old/src/shred.c      2006-05-07 00:49:03.000000000 +0900
+++ coreutils-5.97/src/shred.c  2007-09-01 09:51:11.000000000 +0900
@@ -1514,7 +1514,7 @@
        case 's':
          {
            uintmax_t tmp;
-           if (xstrtoumax (optarg, NULL, 0, &tmp, "cbBkKMGTPEZY0")
+           if (xstrtoumax (optarg, NULL, 0, &tmp, "bBcEgGkKmMPtTYZ0")
                != LONGINT_OK)
              {
                error (EXIT_FAILURE, 0, _("%s: invalid file size"),
diff -Nru coreutils-5.97-old/src/sort.c coreutils-5.97/src/sort.c
--- coreutils-5.97-old/src/sort.c       2007-09-01 08:06:07.000000000 +0900
+++ coreutils-5.97/src/sort.c   2007-09-01 09:47:49.000000000 +0900
@@ -604,7 +604,7 @@
 {
   uintmax_t n;
   char *suffix;
-  enum strtol_error e = xstrtoumax (s, &suffix, 10, &n, "EgGkKmMPtTYZ");
+  enum strtol_error e = xstrtoumax (s, &suffix, 10, &n, "EgGkKmMPtTYZ0");
 
   /* The default unit is KiB.  */
   if (e == LONGINT_OK && ISDIGIT (suffix[-1]))
diff -Nru coreutils-5.97-old/src/split.c coreutils-5.97/src/split.c
--- coreutils-5.97-old/src/split.c      2005-07-12 03:24:42.000000000 +0900
+++ coreutils-5.97/src/split.c  2007-09-01 09:52:20.000000000 +0900
@@ -429,7 +429,7 @@
          if (split_type != type_undef)
            FAIL_ONLY_ONE_WAY ();
          split_type = type_bytes;
-         if (xstrtoumax (optarg, NULL, 10, &n_units, "bkm") != LONGINT_OK
+         if (xstrtoumax (optarg, NULL, 10, &n_units, "bEgGkKmMPtTYZ0") != 
LONGINT_OK
              || n_units == 0)
            {
              error (0, 0, _("%s: invalid number of bytes"), optarg);
@@ -453,7 +453,7 @@
          if (split_type != type_undef)
            FAIL_ONLY_ONE_WAY ();
          split_type = type_byteslines;
-         if (xstrtoumax (optarg, NULL, 10, &n_units, "bkm") != LONGINT_OK
+         if (xstrtoumax (optarg, NULL, 10, &n_units, "bEgGkKmMPtTYZ0") != 
LONGINT_OK
              || n_units == 0 || SIZE_MAX < n_units)
            {
              error (0, 0, _("%s: invalid number of bytes"), optarg);
diff -Nru coreutils-5.97-old/src/tail.c coreutils-5.97/src/tail.c
--- coreutils-5.97-old/src/tail.c       2007-09-01 08:06:07.000000000 +0900
+++ coreutils-5.97/src/tail.c   2007-09-01 09:53:36.000000000 +0900
@@ -1482,7 +1482,7 @@
 
          {
            strtol_error s_err;
-           s_err = xstrtoumax (optarg, NULL, 10, n_units, "bkm");
+           s_err = xstrtoumax (optarg, NULL, 10, n_units, "bEgGkKmMPtTYZ0");
            if (s_err != LONGINT_OK)
              {
                error (EXIT_FAILURE, 0, "%s: %s", optarg,

Reply via email to