Commit graph

10 commits

Author SHA1 Message Date
Ori Bernstein b31e965ea3 Parse global pax header in the right place. 2019-11-15 13:26:25 -08:00
Ori Bernstein a68bee44d3 Add pax extended header support to tar.
Support for 'path=', 'uname=', 'gname=', 'size=', and 'atime=' pax
headers is useful.  Others are ignored, possibly with a warning.

We were running into missing support with the 'go' extraction.

At the same time, this cleans up the way that we handle paths,
getting rid of static buffers with hidden space at the front.
2019-11-14 13:52:41 -08:00
Ori Bernstein d72a404399 Fix directory heuristic for long file names.
Tar specifies that a filename ending with '/' is a directory. We were
incorrectly looking at the short name. This meant that when we have long
filenames with a '/' at the 100th character, we would decide it was a
directory.

This change uses the long name when deciding the size for extraction,
and trusts the header size when just skipping forward in the stream.
2019-11-05 10:48:51 -08:00
cinap_lenrek 37827f533b tar: fix memory corruption in extract1 (thanks petter)
extract1() expects two extra bytes to be avilabe before
fname buffer so it can prepend ./ before the name. this
used to be the case with name(), but was violated when
long name support was added and getname() was used in
place of name() which did not reserve the 2 extra bytes.

this change reserves two extra bytes in the getname()'s
static buffer and also removes the extra copy as name()
already makes a copy.
2019-11-02 14:17:34 +01:00
ftrvxmtrx c0d0f86b14 tar: remove unused variable 2016-11-17 02:14:59 +01:00
cinap_lenrek b143c1f411 tar: remove unneccesary { } 2015-09-08 18:30:38 +02:00
cinap_lenrek c7eae3fb72 tar: make z flag work, even when no file name was provided (thanks aiju)
tar used to infer compression type from the filenames extension, but when
no file name is given (stdin/stdout), the -z flag was ignored and no
compression filter applied. this changes tar to assume the default
gzip compression method when z is given and no file name is specified.
2015-09-08 18:27:48 +02:00
cinap_lenrek 041d732be7 tar, tarfs: implement longname support
this allows extracting tar archives that use longnames extension,
where the real filename is stored in a special entry with
linkflag == 'L' before the file entry. also skip longlink entries
with linkflag == 'K'.
2015-05-19 12:39:45 +02:00
Taru Karttunen a9060cc06b Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00
Taru Karttunen e5888a1ffd Import sources from 2011-03-30 iso image 2011-03-30 15:46:40 +03:00