[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH] libarchive/get_header_ar.c: fix extraction of archives from binutils in deterministic mo
From: Denys Vlasenko <vda.linux () googlemail ! com>
Date: 2021-12-13 2:24:28
Message-ID: CAK1hOcNj5k+VCt5zXvEpCFDs1ydjtanoNQ-H7Bqvo03-vPXa7A () mail ! gmail ! com
[Download RAW message or body]
Applied, thanks!
On Fri, Dec 10, 2021 at 2:30 PM Peter Korsgaard <peter@korsgaard.com> wrote:
>
> >>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:
>
> > GNU binutils in deterministic mode (ar rD or built with
> > --enable-deterministic-archives) hard codes file mode to 0644 (NOT 0100644)
> > since https://github.com/bminor/binutils-gdb/commit/36e4dce69dd2
>
> > This confuses busybox ar x (data_extract_all):
>
> > touch a; ar rD a.ar a
> > ar: creating a.ar
>
> > busybox ar x a.ar
> > ar: unrecognized file type
> > hexdump -C a.ar
> > 00000000 21 3c 61 72 63 68 3e 0a 61 2f 20 20 20 20 20 20 |!<arch>.a/ |
> > 00000010 20 20 20 20 20 20 20 20 30 20 20 20 20 20 20 20 | 0 |
> > 00000020 20 20 20 20 30 20 20 20 20 20 30 20 20 20 20 20 | 0 0 |
> > 00000030 36 34 34 20 20 20 20 20 30 20 20 20 20 20 20 20 |644 0 |
> > 00000040 20 20 60 0a | `.|
>
> > As a workaround, force the mode bits to S_IFREG, as nothing else makes sense
> > for ar.
>
> Ping?
>
> > Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
> > ---
> > archival/libarchive/get_header_ar.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
>
> > diff --git a/archival/libarchive/get_header_ar.c b/archival/libarchive/get_header_ar.c
> > index 3a19d6ff7..6bd897392 100644
> > --- a/archival/libarchive/get_header_ar.c
> > +++ b/archival/libarchive/get_header_ar.c
> > @@ -92,8 +92,12 @@ char FAST_FUNC get_header_ar(archive_handle_t *archive_handle)
> > /* Only size is always present, the rest may be missing in
> > * long filename pseudo file. Thus we decode the rest
> > * after dealing with long filename pseudo file.
> > + *
> > + * GNU binutils in deterministic mode hard codes mode to 0644 (NOT
> > + * 0100644). AR archives can only contain files, so force file
> > + * mode.
> > */
> > - typed->mode = read_num(ar.formatted.mode, 8, sizeof(ar.formatted.mode));
> > + typed->mode = read_num(ar.formatted.mode, 8, sizeof(ar.formatted.mode)) | S_IFREG;
> > typed-> gid = read_num(ar.formatted.gid, 10, sizeof(ar.formatted.gid));
> > typed-> uid = read_num(ar.formatted.uid, 10, sizeof(ar.formatted.uid));
> > typed-> mtime = read_num(ar.formatted.date, 10, sizeof(ar.formatted.date));
> > --
> > 2.20.1
>
> --
> Bye, Peter Korsgaard
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic