diff options
| author | 2022-12-06 14:14:27 -0800 | |
|---|---|---|
| committer | 2022-12-06 14:14:27 -0800 | |
| commit | 81317a52ea13b39de22d2cdeff8ecc231224f9e7 (patch) | |
| tree | 677bc306ab6b56937f024a5bdf3e8b624b7137c6 /src/options.zig | |
| parent | 7d29782896f31ae5249f00e9505fd978e9733644 (diff) | |
| download | bun-81317a52ea13b39de22d2cdeff8ecc231224f9e7.tar.gz bun-81317a52ea13b39de22d2cdeff8ecc231224f9e7.tar.zst bun-81317a52ea13b39de22d2cdeff8ecc231224f9e7.zip | |
Fix glibc symbol version issues preventing `bun install` from being used in older glibc versions (#1580)
* Prevent integer overflow in connectError
* Add missing deepEquals() type to Bun
* fix missing glibc symbols
* Fix missing symbol issues
* Try this
* Update glibc-versions-hack.cpp
* Update glibc-versions-hack.cpp
* Update glibc-versions-hack.cpp
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/options.zig')
| -rw-r--r-- | src/options.zig | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/src/options.zig b/src/options.zig index 4f62ddfe5..97f0cf62f 100644 --- a/src/options.zig +++ b/src/options.zig @@ -1838,42 +1838,7 @@ pub const OutputFile = struct { } } - const os = std.os; - - if (comptime @import("builtin").target.isDarwin()) { - const rc = os.system.fcopyfile(fd_in, fd_out, null, os.system.COPYFILE_DATA); - if (rc == 0) { - return; - } - } - - if (@import("builtin").target.os.tag == .linux) { - // Try copy_file_range first as that works at the FS level and is the - // most efficient method (if available). - var offset: u64 = 0; - cfr_loop: while (true) { - const math = std.math; - // The kernel checks the u64 value `offset+count` for overflow, use - // a 32 bit value so that the syscall won't return EINVAL except for - // impossibly large files (> 2^64-1 - 2^32-1). - const amt = try os.copy_file_range(fd_in, offset, fd_out, offset, math.maxInt(u32), 0); - // Terminate when no data was copied - if (amt == 0) break :cfr_loop; - offset += amt; - } - return; - } - - // Sendfile is a zero-copy mechanism iff the OS supports it, otherwise the - // fallback code will copy the contents chunk by chunk. - const empty_iovec = [0]os.iovec_const{}; - var offset: u64 = 0; - sendfile_loop: while (true) { - const amt = try os.sendfile(fd_out, fd_in, offset, 0, &empty_iovec, &empty_iovec, 0); - // Terminate when no data was copied - if (amt == 0) break :sendfile_loop; - offset += amt; - } + try bun.copyFile(fd_in, fd_out); } }; |
