Subject: bug#38777: 26.3; tar-mode doesn't list a file / crashes on package-tar-file-info

From: Eli Zaretskii <[email-masked]>
Date: Sat, 28 Dec 2019 21:54:35 +0200

> Date: Sat, 28 Dec 2019 19:09:40 +0100
> From: Victor Collod <[email-masked]>
> 
> A few months ago, the nix port of irony stopped building for a very, very strange reason:
> when the complete path of the package metadata file is 32 characters long (plus some other unknown conditions), it isn't shown in the tar-mode file list view, and running (package-tar-file-info) fails with the following stack trace:
> 
> > Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
> >   tar--describe-as-link(nil)
> >   tar--check-descriptor(nil)
> >   tar-get-file-descriptor("irony-20190703.1732/irony-pkg.el")
> >   package-tar-file-info()
> >   eval((package-tar-file-info) nil)
> >   eval-expression((package-tar-file-info) nil nil 127)
> >   funcall-interactively(eval-expression (package-tar-file-info) nil nil 127)
> >   call-interactively(eval-expression record nil)
> >   command-execute(eval-expression record)
> >   execute-extended-command(nil "eval-expression" nil)
> >   funcall-interactively(execute-extended-command nil "eval-expression" nil)
> >   call-interactively(execute-extended-command nil nil)
> >   command-execute(execute-extended-command)
> 
> Unfortunately, my yet to be found lisp programming skills are way too low to solve this issue.
> I have tried and failed to understand what's going on. Perhaps this bug isn't a good introduction to lisp programming :/
> 
> Here is the related (worked around) NixOS issue:
> https://github.com/NixOS/nixpkgs/issues/66556#issuecomment-522809883
> 
> And a link to a zip file containing the cursed tar file:
> https://github.com/NixOS/nixpkgs/files/3522572/repro.zip

Looks like invalid tar file?  It uses the magic string of "ustar "
(two trailing blanks), whereas we only recognize at most one.  So the
first entry with a file name longer than 100 bytes confuses
tar-mode.el.

Does anyone know if this is valid in tar files?  If so,
tar-header-block-tokenize will have to be updated.