Hi!

I have an issue with gnu tar behaving differently from how I'd like
it to do. Below is the description. Is it a bug?

BRIEF:

When listing archive contents (-t) and using --show-transformed-names
option, directories don't have trailing slashes.

HOW TO REPRODUCE:

The following shell session shows how to reproduce the bug in tar-1.27.1

$ mkdir b
$ tar -cf b.tar b
$ tar -tf b.tar 
b/
$ tar -tf b.tar --show-transformed-names
b

In the last line a trailing slash is expected.
(In real life I also use --transform but it does not matter)

SOURCE CODE EXPLANATION:

In list.c:read_header the following occurs:

> info->had_trailing_slash = strip_trailing_slashes (info->file_name);

Later, in list.c:simple_print_header we have

>  if (show_transformed_names_option)
>    temp_name = st->file_name ? st->file_name : st->orig_file_name;
>  else
>    temp_name = st->orig_file_name ? st->orig_file_name : st->file_name;

And later in this function temp_name is just printed without adding the
stripped slash.

BROKEN COMMIT:

I believe the bug first appeared in
commit 2adfef01491545d5dd36924a8e6abf9bc81d3c05
Author: Sergey Poznyakoff
Date:   Sun Jul 27 12:01:04 2003 +0000

In the commit current_trailing_slash becomes ignored while the branch
still exists where current_file_name (with the trailed slash stripped) can
probably be used.

P.S. I'm not subscribed to bug-tar ml so please Cc me if replying to this 
message.

Reply via email to