Skip to content

lorry.tar-importer: Improve support for PAX extended headers

Pedro Alvarez Piedehierro requested to merge pedro/fix-gcc-tar-import into master

Sometimes the tar files will contain PAX extended headers to deal with cases where the information needed doesn't fit initial header.

One of these cases is when the path is larger than 100 characters. An extended header will appear before the block including the contents of this file, including information about the entire path.

The PAX extended headers contain one or multiple records constructed as follows:

"%d %s=%s\n", <length>, <keyword>, <value>

This commit makes sure that we always read the extended header blocks, and in the case of finding one, we parse its records looking for 'path' information. If this information is found, is stored for the next iteration.

As a side effect, this commit also fixes a bug where we weren't ignoring the extended header contents because the truncated path was ending on '/' and the script was skipping any actions given that it thought that it was a folder (and it wasn't).

Closes #1 (closed)

Edited by Pedro Alvarez Piedehierro

Merge request reports