bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] Issue with tar. Bug file.


From: Connor Behan
Subject: Re: [Bug-tar] Issue with tar. Bug file.
Date: Sun, 22 Sep 2013 13:50:50 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130806 Thunderbird/17.0.8

On 22/09/13 01:24 AM, Pulkit Bhuwalka wrote:

Hi,

This is to report an issue that I have run into while using tar.

Issue - tar destroys file when arguments are passed in wrong order leading to loss of data.

Correct tar order - tar -cvzf "archive_file_name" "file_to_be_archived"

Order actually passed - tar - cvzf "file_to_be_archived" "archive_file_name"

tar ignores the fact that the "file_to_be_archived" exists and simply overwrites it, and then crashes out complaining that "archive_file_name" doesn't exist.

While I agree that the command was passed by the user in the wrong order, I feel it's something that is quite possible and tar should follow a defensive approach of complaining that a file exists rather than overwriting it.
It looks like open_archive() will succeed for archives that already exist. Even if you're using "create" and not "append". There must be a reason for this. However, there seems to be an easy solution.

Instead of calling open_archive() in create_archive(), we could do a one-time call to it in dump_file() after at least one "file_to_be_archived" has been found to exist. There is already an error "Cowardly refusing to create an empty archive" that is given when no members are specified on the command line. The above would be an extension of this to when no *existent* members are specified on the command line.

I've been using tar for years and I ended up passing the wrong arguments today, which led to me losing data :-(

Thanks,
Pulkit and Meghna



--
Sent from my Macbook Wheel

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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