mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Upgrade libarchive to v3.8.1 (#21250)
Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Zack Radisic <zack@theradisic.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -4,7 +4,7 @@ register_repository(
|
|||||||
REPOSITORY
|
REPOSITORY
|
||||||
libarchive/libarchive
|
libarchive/libarchive
|
||||||
COMMIT
|
COMMIT
|
||||||
898dc8319355b7e985f68a9819f182aaed61b53a
|
7118f97c26bf0b2f426728b482f86508efc81d02
|
||||||
)
|
)
|
||||||
|
|
||||||
register_cmake_command(
|
register_cmake_command(
|
||||||
@@ -20,11 +20,14 @@ register_cmake_command(
|
|||||||
-DENABLE_WERROR=OFF
|
-DENABLE_WERROR=OFF
|
||||||
-DENABLE_BZip2=OFF
|
-DENABLE_BZip2=OFF
|
||||||
-DENABLE_CAT=OFF
|
-DENABLE_CAT=OFF
|
||||||
|
-DENABLE_CPIO=OFF
|
||||||
|
-DENABLE_UNZIP=OFF
|
||||||
-DENABLE_EXPAT=OFF
|
-DENABLE_EXPAT=OFF
|
||||||
-DENABLE_ICONV=OFF
|
-DENABLE_ICONV=OFF
|
||||||
-DENABLE_LIBB2=OFF
|
-DENABLE_LIBB2=OFF
|
||||||
-DENABLE_LibGCC=OFF
|
-DENABLE_LibGCC=OFF
|
||||||
-DENABLE_LIBXML2=OFF
|
-DENABLE_LIBXML2=OFF
|
||||||
|
-DENABLE_WIN32_XMLLITE=OFF
|
||||||
-DENABLE_LZ4=OFF
|
-DENABLE_LZ4=OFF
|
||||||
-DENABLE_LZMA=OFF
|
-DENABLE_LZMA=OFF
|
||||||
-DENABLE_LZO=OFF
|
-DENABLE_LZO=OFF
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
+++ CMakeLists.txt
|
+++ CMakeLists.txt
|
||||||
@@ -1,5 +1,5 @@
|
@@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR)
|
-cmake_minimum_required(VERSION 3.17 FATAL_ERROR)
|
||||||
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12...3.5 FATAL_ERROR)
|
+cmake_minimum_required(VERSION 3.17...3.30 FATAL_ERROR)
|
||||||
if(POLICY CMP0065)
|
|
||||||
cmake_policy(SET CMP0065 NEW) #3.4 don't use `-rdynamic` with executables
|
PROJECT(libarchive C)
|
||||||
endif()
|
#
|
||||||
|
|||||||
@@ -1,22 +1,29 @@
|
|||||||
--- a/libarchive/archive_write_add_filter_gzip.c
|
--- a/libarchive/archive_write_add_filter_gzip.c 2025-07-21 06:29:58.505101515 +0000
|
||||||
+++ b/libarchive/archive_write_add_filter_gzip.c
|
+++ b/libarchive/archive_write_add_filter_gzip.c 2025-07-21 06:44:09.023676935 +0000
|
||||||
@@ -58,6 +58,7 @@ archive_write_set_compression_gzip(struct archive *a)
|
@@ -59,12 +59,13 @@
|
||||||
struct private_data {
|
|
||||||
int compression_level;
|
int compression_level;
|
||||||
int timestamp;
|
int timestamp;
|
||||||
+ unsigned char os;
|
char *original_filename;
|
||||||
|
+ unsigned char os;
|
||||||
#ifdef HAVE_ZLIB_H
|
#ifdef HAVE_ZLIB_H
|
||||||
z_stream stream;
|
z_stream stream;
|
||||||
int64_t total_in;
|
int64_t total_in;
|
||||||
@@ -106,6 +107,7 @@ archive_write_add_filter_gzip(struct archive *_a)
|
unsigned char *compressed;
|
||||||
archive_set_error(&a->archive, ENOMEM, "Out of memory");
|
size_t compressed_buffer_size;
|
||||||
|
- unsigned long crc;
|
||||||
|
+ uint32_t crc;
|
||||||
|
#else
|
||||||
|
struct archive_write_program_data *pdata;
|
||||||
|
#endif
|
||||||
|
@@ -108,6 +109,7 @@
|
||||||
return (ARCHIVE_FATAL);
|
return (ARCHIVE_FATAL);
|
||||||
}
|
}
|
||||||
+ data->os = 3; /* default Unix */
|
|
||||||
f->data = data;
|
f->data = data;
|
||||||
|
+ data->os = 3; /* default Unix */
|
||||||
f->open = &archive_compressor_gzip_open;
|
f->open = &archive_compressor_gzip_open;
|
||||||
f->options = &archive_compressor_gzip_options;
|
f->options = &archive_compressor_gzip_options;
|
||||||
@@ -166,6 +168,30 @@ archive_compressor_gzip_options(struct archive_write_filter *f, const char *key,
|
f->close = &archive_compressor_gzip_close;
|
||||||
|
@@ -177,6 +179,30 @@
|
||||||
return (ARCHIVE_OK);
|
return (ARCHIVE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +54,7 @@
|
|||||||
/* Note: The "warn" return is just to inform the options
|
/* Note: The "warn" return is just to inform the options
|
||||||
* supervisor that we didn't handle it. It will generate
|
* supervisor that we didn't handle it. It will generate
|
||||||
* a suitable error if no one used this option. */
|
* a suitable error if no one used this option. */
|
||||||
@@ -226,7 +252,7 @@ archive_compressor_gzip_open(struct archive_write_filter *f)
|
@@ -236,7 +262,7 @@
|
||||||
data->compressed[8] = 4;
|
data->compressed[8] = 4;
|
||||||
else
|
else
|
||||||
data->compressed[8] = 0;
|
data->compressed[8] = 0;
|
||||||
|
|||||||
@@ -2588,12 +2588,19 @@ pub const bindings = struct {
|
|||||||
return global.throw("failed to read archive header: {s}", .{Archive.errorString(@ptrCast(archive))});
|
return global.throw("failed to read archive header: {s}", .{Archive.errorString(@ptrCast(archive))});
|
||||||
},
|
},
|
||||||
else => {
|
else => {
|
||||||
const pathname = archive_entry.pathname();
|
const pathname_string = if (bun.Environment.isWindows) blk: {
|
||||||
|
const pathname_w = archive_entry.pathnameW();
|
||||||
|
const list = std.ArrayList(u8).init(bun.default_allocator);
|
||||||
|
var result = bun.strings.toUTF8ListWithType(list, []const u16, pathname_w) catch bun.outOfMemory();
|
||||||
|
defer result.deinit();
|
||||||
|
break :blk String.cloneUTF8(result.items);
|
||||||
|
} else String.cloneUTF8(archive_entry.pathname());
|
||||||
|
|
||||||
const kind = bun.sys.kindFromMode(archive_entry.filetype());
|
const kind = bun.sys.kindFromMode(archive_entry.filetype());
|
||||||
const perm = archive_entry.perm();
|
const perm = archive_entry.perm();
|
||||||
|
|
||||||
var entry_info: EntryInfo = .{
|
var entry_info: EntryInfo = .{
|
||||||
.pathname = String.cloneUTF8(pathname),
|
.pathname = pathname_string,
|
||||||
.kind = String.static(@tagName(kind)),
|
.kind = String.static(@tagName(kind)),
|
||||||
.perm = perm,
|
.perm = perm,
|
||||||
};
|
};
|
||||||
@@ -2605,8 +2612,10 @@ pub const bindings = struct {
|
|||||||
|
|
||||||
const read = archive.readData(read_buf.items);
|
const read = archive.readData(read_buf.items);
|
||||||
if (read < 0) {
|
if (read < 0) {
|
||||||
return global.throw("failed to read archive entry \"{}\": {s}", .{
|
const pathname_utf8 = pathname_string.toUTF8(bun.default_allocator);
|
||||||
bun.fmt.fmtPath(u8, pathname, .{}),
|
defer pathname_utf8.deinit();
|
||||||
|
return global.throw("failed to read archive entry \"{s}\": {s}", .{
|
||||||
|
pathname_utf8.slice(),
|
||||||
Archive.errorString(@ptrCast(archive)),
|
Archive.errorString(@ptrCast(archive)),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
const wchar_t = u16;
|
const wchar_t = u16;
|
||||||
|
|
||||||
|
// Match libarchive's platform-specific type definitions
|
||||||
const la_int64_t = i64;
|
const la_int64_t = i64;
|
||||||
const la_ssize_t = isize;
|
const la_ssize_t = isize;
|
||||||
|
|
||||||
const struct_archive = opaque {};
|
const struct_archive = opaque {};
|
||||||
const struct_archive_entry = opaque {};
|
const struct_archive_entry = opaque {};
|
||||||
// const time_t = @import("std").c.time_t;
|
// const time_t = @import("std").c.time_t;
|
||||||
|
|||||||
Reference in New Issue
Block a user