bug-tar
[Top][All Lists]
Advanced

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

[Bug-tar] gnu tar bug: --show-transformed-names loses trailing slash in


From: Vladimir A . Pavlov
Subject: [Bug-tar] gnu tar bug: --show-transformed-names loses trailing slash in --list
Date: Tue, 21 Jan 2014 23:41:04 +0400

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

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