* [PATCH] erofs-utils: lib: support GNUTYPE_LONGNAME for tarerofs
@ 2023-07-17 7:35 Gao Xiang
2023-07-17 7:53 ` Jingbo Xu
0 siblings, 1 reply; 2+ messages in thread
From: Gao Xiang @ 2023-07-17 7:35 UTC (permalink / raw)
To: linux-erofs; +Cc: Gao Xiang
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.
Cc: Jingbo Xu <jefflexu@linux.alibaba.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
lib/tar.c | 8 ++++++++
1 file changed, 8 insertions(+)
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);
--
2.24.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] erofs-utils: lib: support GNUTYPE_LONGNAME for tarerofs
2023-07-17 7:35 [PATCH] erofs-utils: lib: support GNUTYPE_LONGNAME for tarerofs Gao Xiang
@ 2023-07-17 7:53 ` Jingbo Xu
0 siblings, 0 replies; 2+ messages in thread
From: Jingbo Xu @ 2023-07-17 7:53 UTC (permalink / raw)
To: Gao Xiang, linux-erofs
On 7/17/23 3:35 PM, Gao Xiang wrote:
> 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.
>
> Cc: Jingbo Xu <jefflexu@linux.alibaba.com>
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> ---
> lib/tar.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> 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);
LGTM.
Tested-by: Jingbo Xu <jefflexu@linux.alibaba.com>
--
Thanks,
Jingbo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-17 7:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-17 7:35 [PATCH] erofs-utils: lib: support GNUTYPE_LONGNAME for tarerofs Gao Xiang
2023-07-17 7:53 ` Jingbo Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox