# [PATCH] import-tars: be nice to wrong directory modes

5 messages from 2007-04-28 to 2007-04-29. Participants: Johannes Schindelin, Shawn O. Pearce, Junio C Hamano, Randal L. Schwartz.
Thread: https://gitlist.dev/t/7891

## Johannes Schindelin, 2007-04-28 23:59

Subject: [PATCH] import-tars: be nice to wrong directory modes
Message-ID: <Pine.LNX.4.64.0704290159230.29859@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0704290159230.29859%40racer.site

```

Some tars seem to have modes 0755 for directories, not 01000755. Do
not generate an empty object for them, but ignore them.

Noticed by riddochc on IRC.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 contrib/fast-import/import-tars.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/contrib/fast-import/import-tars.perl b/contrib/fast-import/import-tars.perl
index 1842146..5575080 100755
--- a/contrib/fast-import/import-tars.perl
+++ b/contrib/fast-import/import-tars.perl
@@ -52,6 +52,7 @@ foreach my $tar_file (@ARGV)
 			Z8 Z1 Z100 Z6
 			Z2 Z32 Z32 Z8 Z8 Z*', $_;
 		last unless $name;
+		next if $name =~ '/$';
 		$mode = oct $mode;
 		$size = oct $size;
 		$mtime = oct $mtime;
-- 
1.5.2.rc0.2496.g74f7

```

## Shawn O. Pearce, 2007-04-29 00:08

Subject: Re: [PATCH] import-tars: be nice to wrong directory modes
Message-ID: <20070429000842.GR5942@spearce.org>
URL: https://gitlist.dev/e/20070429000842.GR5942%40spearce.org
In-Reply-To: <Pine.LNX.4.64.0704290159230.29859@racer.site>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> 
> Some tars seem to have modes 0755 for directories, not 01000755. Do
> not generate an empty object for them, but ignore them.

This fix is small and corrects a rather ugly repository corruption,
so I've applied it to my gfi-maint branch.

-- 
Shawn.

```

## Junio C Hamano, 2007-04-29 01:07

Subject: Re: [PATCH] import-tars: be nice to wrong directory modes
Message-ID: <7vk5vwhttj.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vk5vwhttj.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20070429000842.GR5942@spearce.org>

```
"Shawn O. Pearce" <spearce@spearce.org> writes:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>> 
>> Some tars seem to have modes 0755 for directories, not 01000755. Do
>> not generate an empty object for them, but ignore them.
>
> This fix is small and corrects a rather ugly repository corruption,
> so I've applied it to my gfi-maint branch.

Good teamplay.  So you want me to pull gfi-maint to maint and
gfi-master to master?

```

## Shawn O. Pearce, 2007-04-29 01:11

Subject: Re: [PATCH] import-tars: be nice to wrong directory modes
Message-ID: <20070429011121.GT5942@spearce.org>
URL: https://gitlist.dev/e/20070429011121.GT5942%40spearce.org
In-Reply-To: <7vk5vwhttj.fsf@assigned-by-dhcp.cox.net>

```
Junio C Hamano <junkio@cox.net> wrote:
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> 
> > Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> >> 
> >> Some tars seem to have modes 0755 for directories, not 01000755. Do
> >> not generate an empty object for them, but ignore them.
> >
> > This fix is small and corrects a rather ugly repository corruption,
> > so I've applied it to my gfi-maint branch.
> 
> Good teamplay.  So you want me to pull gfi-maint to maint and
> gfi-master to master?

Right.

And apply the fsck patch i sent to the list.  ;-)
 
-- 
Shawn.

```

## Randal L. Schwartz, 2007-04-29 01:36

Subject: Re: [PATCH] import-tars: be nice to wrong directory modes
Message-ID: <86tzv07yhq.fsf@blue.stonehenge.com>
URL: https://gitlist.dev/e/86tzv07yhq.fsf%40blue.stonehenge.com
In-Reply-To: <Pine.LNX.4.64.0704290159230.29859@racer.site>

```
>>>>> "Johannes" == Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

Johannes> +		next if $name =~ '/$';

This is misleading.  That's a regex there.  And it also falsely matches a
string ending in "/\n", but I bet there are parts of git that break on those
filenames too. :)

Consider:

        next if $name =~ m{/\z};

which matches precisely when the filename ends in /.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

```
