bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] tar 1.31 aborts when extracting archive containing ./ with


From: Marius Spix
Subject: Re: [Bug-tar] tar 1.31 aborts when extracting archive containing ./ with -U
Date: Tue, 8 Jan 2019 20:52:16 +0100

Hi,

good finding. Could you please also add a test case for this instance?
That would be great.

Best regards and a happy new year,
Marius



On Tue, 8 Jan 2019 19:28:32 +0000
Harald van Dijk <address@hidden> wrote:

> On 07/01/2019 23:24, Harald van Dijk wrote:
> > Hi,
> > 
> > After upgrading to GNU tar 1.31, I am seeing bad behaviour trying
> > to extract archives containing ./ entries with the -U option. This
> > is easily reproducible:
> > 
> >    $ tar cf - --no-recursion . | tar xUf -
> >    Aborted
> > 
> > The abort() in src/extract.c's maybe_recoverable(), marked with a 
> > comment as unreachable, is in fact reachable in this case.
> 
> And looking at the code, it's obvious that it's reachable.
> 
> The abort() was added in commit ccef8581: 
> <https://git.savannah.gnu.org/cgit/tar.git/commit/?id=ccef8581b8673cadd1c084595de4efde956c3c2b>
>  
> It was in response to a GCC warning that one case falls through to
> the next.
> 
> I think the author of that commit misread the code, and the proper 
> response to the warning is to add a break statement, like so:
> 
> --- a/src/extract.c
> +++ b/src/extract.c
> @@ -787,7 +787,7 @@
>          case UNLINK_FIRST_OLD_FILES:
>            break;
>          }
> -      abort (); /* notreached */
> +      break;
> 
>       case ENOENT:
>         /* Attempt creating missing intermediate directories.  */
> 
> It restores the tar -U handling to how it was in 1.30, but it should 
> probably get new tests added to cover the various cases that abort.
> I'm seeing some unrelated failures running the test suite that I'd
> need to look into before being able to submit something that's
> properly tested though.
> 
> Cheers,
> Harald van Dijk
> 

Attachment: pgpC9hD5qtXdK.pgp
Description: Digitale Signatur von OpenPGP


reply via email to

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