bug-tar
[Top][All Lists]
Advanced

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

[Bug-tar] Tar Tape Length Bug


From: Delbert Martin
Subject: [Bug-tar] Tar Tape Length Bug
Date: Fri, 16 Jan 2004 09:15:38 -0500

Hello, 
        I found a bug in the Tar Tape Archiver. If you use the --tape-length 
option or the -L option Tar will always return with invalid tape length. I 
looked into the source code and found for the option it was set that if you 
specify a length != to LONG_MAX then Fail with Invalid Tape length. I changed 
the line of code to if the value was > LONG_MAX then fail since you want it to 
be every value except 0 and > than LONG_MAX.
I belive this is also posted ina forum somewhere and I am quite supprised that 
this has not been fixed. Tar 1.13 came with my out of date slackware Distro. 
Code Starting at Line #654
        case 'L':
        {
          unsigned long u;
          if (xstrtoul (optarg, (char **) 0, 10, &u, "") != LONG_MAX)
            USAGE_ERROR ((0, 0, _("Invalid tape length")));
          clear_tarlong (tape_length_option);
          add_to_tarlong (tape_length_option, u);
          mult_tarlong (tape_length_option, 1024);
          multi_volume_option = 1;
        }
        break;
changed to:
        case 'L':
        {
          unsigned long u;
          if (xstrtoul (optarg, (char **) 0, 10, &u, "") > LONG_MAX)
            USAGE_ERROR ((0, 0, _("Invalid tape length")));
          clear_tarlong (tape_length_option);
          add_to_tarlong (tape_length_option, u);
          mult_tarlong (tape_length_option, 1024);
          multi_volume_option = 1;
        }
        break;

I hope this is helpful and can be in the next release in tar. Its incredibly 
useful for backing up harddrives to CD's Since it can split up an archive and 
files between discs.

--Delbert Martin
Administrator IT Systems
Kionix Inc.
36 Thornwood Dr.
Ithaca NY, 14850
http://www.kionix.com

Attachment: pgpz5QlvsjK6z.pgp
Description: PGP signature


reply via email to

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