From 4141f35ef4afa9583705bd756ad344fe0fffe808 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Fri, 23 Feb 2024 11:16:17 -0500 Subject: [PATCH] staticdata: fix assert from partially disabled native code (#53439) This should fix the assertion failure that has been plaguing the Pkg tests, as discussed in https://github.com/JuliaLang/julia/pull/52123#issuecomment-1959965395 (cherry picked from commit 6cbed3198554381a6ed57b2d81f6c2ae0adfc4e5) --- src/staticdata.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/staticdata.c b/src/staticdata.c index f899899aff242..c8fd4053aaf73 100644 --- a/src/staticdata.c +++ b/src/staticdata.c @@ -3768,8 +3768,11 @@ JL_DLLEXPORT jl_value_t *jl_restore_package_image_from_file(const char *fname, j jl_image_t pkgimage = jl_init_processor_pkgimg(pkgimg_handle); - if (ignore_native){ - memset(&pkgimage.fptrs, 0, sizeof(pkgimage.fptrs)); + if (ignore_native) { + // Must disable using native code in possible downstream users of this code: + // https://github.com/JuliaLang/julia/pull/52123#issuecomment-1959965395. + // The easiest way to do that is to disable it in all of them. + jl_options.use_sysimage_native_code = JL_OPTIONS_USE_SYSIMAGE_NATIVE_CODE_NO; } jl_value_t* mod = jl_restore_incremental_from_buf(pkgimg_handle, pkgimg_data, &pkgimage, *plen, depmods, completeinfo, pkgname, 0);