Skip to content

Commit 11e7b75

Browse files
committed
unpack_ram: More graceful handling of low unpack ram
Some people try setting RUSTUP_UNPACK_RAM below the minimum RAM needed for a threaded operation. Since, in principle, we need at least IO_CHUNK_SIZE and thus in theory 2x IO_CHUNK_SIZE, this change softens the failure mode from a panic to a warning and then tries anyway. This is *likely* to succeed and as such we'll let it happen. The warning should make it clear if there's a problem, and should not appear for no-sysinfo platforms since they default to minimum_ram anyway. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
1 parent a1d5912 commit 11e7b75

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/dist/component/package.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,15 @@ fn unpack_ram(
193193
}
194194
};
195195

196-
if io_chunk_size > unpack_ram {
197-
panic!("RUSTUP_UNPACK_RAM must be larger than {}", io_chunk_size);
196+
if minimum_ram > unpack_ram {
197+
warn!(
198+
"Available/permitted unpack RAM ({}) less than {}. Unpacking may fail.",
199+
unpack_ram, minimum_ram
200+
);
201+
minimum_ram
202+
} else {
203+
unpack_ram
198204
}
199-
unpack_ram
200205
}
201206

202207
/// Handle the async result of io operations

0 commit comments

Comments
 (0)