bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in tar 1.13*. Processing of -L option is broken.


From: Andrew V. Samoilov
Subject: Bug in tar 1.13*. Processing of -L option is broken.
Date: Tue, 17 Oct 2000 19:04:38 +0300
User-agent: Mutt/1.3.9i

Hi!

There is a bug in tar 1.13 and tar 1.13.7. Result of xstrtoumax is compared
with LONG_MAX instead of LONGINT_OK. As result multi-volume archive cannot
be created. 

You can try to create such archive:

$ tar -cf /dev/null -M -L 1440 /dev/null

Patch below fixes this bug. 
Also:
    * variable long_options declared static const;
    * operation comma replaced by some more traditional constraction.

With best wishes,
    Andrew V. Samoilov.

--- tar.c-      Sat Aug 14 10:10:19 1999
+++ tar.c       Tue Oct 17 18:42:42 2000
@@ -152,7 +152,7 @@
 /* If nonzero, print the version on standard output and exit.  */
 static int show_version = 0;
 
-struct option long_options[] =
+static struct option const long_options[] =
 {
   {"absolute-names", no_argument, NULL, 'P'},
   {"absolute-paths", no_argument, NULL, OBSOLETE_ABSOLUTE_NAMES},
@@ -534,8 +534,8 @@
 
   input_files = 0;
 
-  while (optchar = getopt_long (argc, argv, OPTION_STRING, long_options, NULL),
-        optchar != EOF)
+  while ((optchar = getopt_long (argc, argv, OPTION_STRING, long_options, 
NULL))
+        != EOF)
     switch (optchar)
       {
       case '?':
@@ -671,7 +671,7 @@
       case 'L':
        {
          uintmax_t u;
-         if (xstrtoumax (optarg, (char **) 0, 10, &u, "") != LONG_MAX)
+         if (xstrtoumax (optarg, (char **) 0, 10, &u, "") != LONGINT_OK)
            USAGE_ERROR ((0, 0, _("Invalid tape length")));
          tape_length_option = 1024 * (tarlong) u;
          multi_volume_option = 1;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]