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
|
||||
libarchive/libarchive
|
||||
COMMIT
|
||||
898dc8319355b7e985f68a9819f182aaed61b53a
|
||||
7118f97c26bf0b2f426728b482f86508efc81d02
|
||||
)
|
||||
|
||||
register_cmake_command(
|
||||
@@ -20,11 +20,14 @@ register_cmake_command(
|
||||
-DENABLE_WERROR=OFF
|
||||
-DENABLE_BZip2=OFF
|
||||
-DENABLE_CAT=OFF
|
||||
-DENABLE_CPIO=OFF
|
||||
-DENABLE_UNZIP=OFF
|
||||
-DENABLE_EXPAT=OFF
|
||||
-DENABLE_ICONV=OFF
|
||||
-DENABLE_LIBB2=OFF
|
||||
-DENABLE_LibGCC=OFF
|
||||
-DENABLE_LIBXML2=OFF
|
||||
-DENABLE_WIN32_XMLLITE=OFF
|
||||
-DENABLE_LZ4=OFF
|
||||
-DENABLE_LZMA=OFF
|
||||
-DENABLE_LZO=OFF
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
+++ CMakeLists.txt
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR)
|
||||
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12...3.5 FATAL_ERROR)
|
||||
if(POLICY CMP0065)
|
||||
cmake_policy(SET CMP0065 NEW) #3.4 don't use `-rdynamic` with executables
|
||||
endif()
|
||||
-cmake_minimum_required(VERSION 3.17 FATAL_ERROR)
|
||||
+cmake_minimum_required(VERSION 3.17...3.30 FATAL_ERROR)
|
||||
|
||||
PROJECT(libarchive C)
|
||||
#
|
||||
|
||||
@@ -1,22 +1,29 @@
|
||||
--- a/libarchive/archive_write_add_filter_gzip.c
|
||||
+++ b/libarchive/archive_write_add_filter_gzip.c
|
||||
@@ -58,6 +58,7 @@ archive_write_set_compression_gzip(struct archive *a)
|
||||
struct private_data {
|
||||
--- a/libarchive/archive_write_add_filter_gzip.c 2025-07-21 06:29:58.505101515 +0000
|
||||
+++ b/libarchive/archive_write_add_filter_gzip.c 2025-07-21 06:44:09.023676935 +0000
|
||||
@@ -59,12 +59,13 @@
|
||||
int compression_level;
|
||||
int timestamp;
|
||||
+ unsigned char os;
|
||||
char *original_filename;
|
||||
+ unsigned char os;
|
||||
#ifdef HAVE_ZLIB_H
|
||||
z_stream stream;
|
||||
int64_t total_in;
|
||||
@@ -106,6 +107,7 @@ archive_write_add_filter_gzip(struct archive *_a)
|
||||
archive_set_error(&a->archive, ENOMEM, "Out of memory");
|
||||
unsigned char *compressed;
|
||||
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);
|
||||
}
|
||||
+ data->os = 3; /* default Unix */
|
||||
f->data = data;
|
||||
+ data->os = 3; /* default Unix */
|
||||
f->open = &archive_compressor_gzip_open;
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -47,7 +54,7 @@
|
||||
/* Note: The "warn" return is just to inform the options
|
||||
* supervisor that we didn't handle it. It will generate
|
||||
* 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;
|
||||
else
|
||||
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))});
|
||||
},
|
||||
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 perm = archive_entry.perm();
|
||||
|
||||
var entry_info: EntryInfo = .{
|
||||
.pathname = String.cloneUTF8(pathname),
|
||||
.pathname = pathname_string,
|
||||
.kind = String.static(@tagName(kind)),
|
||||
.perm = perm,
|
||||
};
|
||||
@@ -2605,8 +2612,10 @@ pub const bindings = struct {
|
||||
|
||||
const read = archive.readData(read_buf.items);
|
||||
if (read < 0) {
|
||||
return global.throw("failed to read archive entry \"{}\": {s}", .{
|
||||
bun.fmt.fmtPath(u8, pathname, .{}),
|
||||
const pathname_utf8 = pathname_string.toUTF8(bun.default_allocator);
|
||||
defer pathname_utf8.deinit();
|
||||
return global.throw("failed to read archive entry \"{s}\": {s}", .{
|
||||
pathname_utf8.slice(),
|
||||
Archive.errorString(@ptrCast(archive)),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
const wchar_t = u16;
|
||||
|
||||
// Match libarchive's platform-specific type definitions
|
||||
const la_int64_t = i64;
|
||||
const la_ssize_t = isize;
|
||||
|
||||
const struct_archive = opaque {};
|
||||
const struct_archive_entry = opaque {};
|
||||
// const time_t = @import("std").c.time_t;
|
||||
|
||||
Reference in New Issue
Block a user