[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] bug tar
From: |
Sergey Poznyakoff |
Subject: |
Re: [Bug-tar] bug tar |
Date: |
Tue, 24 Aug 2010 11:11:02 +0300 |
Hi Thomas,
Thank you for writing to the list:^)
> tar --strip-components=100 -xvf 000.tar
> no warning/error code is given when nothing happend
It is perfectly normal if --strip-components results in
some or all member names being reduced to empty strings and therefore
not extracted. There's nothing to warn about in this case.
> tar hangs:
This has already been fixed. See commit b60e56fd.
> ### start: critical error
> $ tar -rf no_tar_file dir
> tar: This does not look like a tar archive
> tar: Skipping to next header
> tar: Exiting with failure status due to previous errors
>
> But it appends to ... (no_tar_file was > 512 bytes)
That's a bug indeed. A patch is attached.
> tar -cf some.tar dir -V "/"
> tar -tvf some.tar
> tarr: Removing leading `/' from member names
>
> tar -xvf some.tar
> tarr: Removing leading `/' from member names
>
> it's only the volume ;-))
A patch is attached.
Regards,
Sergey
>From 5aa7046f1de9e27bfd57c583aff647c348a47285 Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <address@hidden>
Date: Sun, 22 Aug 2010 05:08:56 +0300
Subject: [PATCH] Safety checking in update mode.
* src/tar.c (decode_options): Display a usage error if one of
-Aru is used, but no file list is given.
* src/update.c (update_archive): Don't write end-of-archive
marker if nothing was appended to it.
Exit with error if the archive is not a valid tar one.
---
src/tar.c | 6 +++++-
src/update.c | 12 ++++++++----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/tar.c b/src/tar.c
index 10ba8a9..5c2a617 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -2512,13 +2512,17 @@ decode_options (int argc, char **argv)
case CAT_SUBCOMMAND:
case UPDATE_SUBCOMMAND:
case APPEND_SUBCOMMAND:
+ if (!args.input_files && !files_from_option)
+ USAGE_ERROR ((0, 0,
+ _("The %s option is meaningless without a file list"),
+ subcommand_string (subcommand_option)));
for (archive_name_cursor = archive_name_array;
archive_name_cursor < archive_name_array + archive_names;
archive_name_cursor++)
if (!strcmp (*archive_name_cursor, "-"))
USAGE_ERROR ((0, 0,
_("Options `-Aru' are incompatible with `-f -'")));
-
+
default:
break;
}
diff --git a/src/update.c b/src/update.c
index b015175..fe29bd4 100644
--- a/src/update.c
+++ b/src/update.c
@@ -107,7 +107,8 @@ update_archive (void)
{
enum read_header previous_status = HEADER_STILL_UNREAD;
bool found_end = false;
-
+ bool updated_archive = false;
+
name_gather ();
open_archive (ACCESS_UPDATE);
buffer_write_global_xheader ();
@@ -186,8 +187,9 @@ update_archive (void)
switch (previous_status)
{
case HEADER_STILL_UNREAD:
- WARN ((0, 0, _("This does not look like a tar archive")));
- /* Fall through. */
+ ERROR ((0, 0, _("This does not look like a tar archive")));
+ close_archive ();
+ return;
case HEADER_SUCCESS:
case HEADER_ZERO_BLOCK:
@@ -221,6 +223,7 @@ update_archive (void)
continue;
if (interactive_option && !confirm ("add", file_name))
continue;
+ updated_archive = true;
if (subcommand_option == CAT_SUBCOMMAND)
append_file (file_name);
else
@@ -228,7 +231,8 @@ update_archive (void)
}
}
- write_eot ();
+ if (updated_archive)
+ write_eot ();
close_archive ();
names_notfound ();
}
--
1.6.0.3
>From 1d039d692ec3f0bdf65563550a2848fd9ededb31 Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <address@hidden>
Date: Sun, 22 Aug 2010 05:25:46 +0300
Subject: [PATCH] Don't apply file transformations to volume names.
* src/list.c (decode_header): Don't apply file transformations to volume names.
---
src/list.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/list.c b/src/list.c
index 9184bea..60ce91f 100644
--- a/src/list.c
+++ b/src/list.c
@@ -642,6 +642,10 @@ decode_header (union block *header, struct tar_stat_info
*stat_info,
stat_info->is_dumpdir = true;
}
+ if (header->header.typeflag == GNUTYPE_VOLHDR)
+ /* Name transformations don't apply to volume headers. */
+ return;
+
transform_member_name (&stat_info->file_name, XFORM_REGFILE);
switch (header->header.typeflag)
{
--
1.6.0.3
- [Bug-tar] bug tar, Thomas Graf, 2010/08/24
- Re: [Bug-tar] bug tar,
Sergey Poznyakoff <=