aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGao Xiang <hsiangkao@linux.alibaba.com>2023-07-17 15:35:31 +0800
committerGao Xiang <hsiangkao@linux.alibaba.com>2023-07-20 17:06:29 +0800
commit142e0da828723705893cd7321ddea4ee77ca377a (patch)
treef91b68cb530f61121dabbb12966f6d7f8211b570
parent95d315fd7958886ff26f42b0051881ac7593219d (diff)
downloaderofs-utils-142e0da828723705893cd7321ddea4ee77ca377a.tar.gz
erofs-utils: lib: support GNUTYPE_LONGNAME for tarerofs
The 'L' entry is present in a header for a series of 1 or more 512-byte tar blocks that hold just the filename for a file or directory with a name over 100 chars. Following that series is another header block, in the traditional form: A header with type '0' (regular file) or '5' (directory), followed by the appropriate number of data blocks with the entry data. In the header for this series, the name will be truncated to the 1st 100 characters of the actual name. Tested-by: Jingbo Xu <jefflexu@linux.alibaba.com> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> Link: https://lore.kernel.org/r/20230717073531.43203-1-hsiangkao@linux.alibaba.com
-rw-r--r--lib/tar.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/tar.c b/lib/tar.c
index 8edfe75..b62e562 100644
--- a/lib/tar.c
+++ b/lib/tar.c
@@ -570,6 +570,14 @@ restart:
if (ret)
goto out;
goto restart;
+ } else if (th.typeflag == 'L') {
+ free(eh.path);
+ eh.path = malloc(st.st_size + 1);
+ if (st.st_size != erofs_read_from_fd(tar->fd, eh.path,
+ st.st_size))
+ goto invalid_tar;
+ eh.path[st.st_size] = '\0';
+ goto restart;
} else if (th.typeflag == 'K') {
free(eh.link);
eh.link = malloc(st.st_size + 1);