From 6099f3b0157a5aeff1935199215be26f1ad8ccbc Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Mon, 10 May 2021 01:14:53 -0700 Subject: [PATCH] Always resolve to canonical path --- native/jni/core/scripting.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/native/jni/core/scripting.cpp b/native/jni/core/scripting.cpp index dc3dcbd38..7cbcac317 100644 --- a/native/jni/core/scripting.cpp +++ b/native/jni/core/scripting.cpp @@ -192,9 +192,11 @@ void install_module(const char *file) { if (access(file, F_OK)) abort(stderr, "'%s' does not exist", file); + char *zip = realpath(file, nullptr); setenv("OUTFD", "1", 1); - setenv("ZIPFILE", file, 1); + setenv("ZIPFILE", zip, 1); setenv("ASH_STANDALONE", "1", 1); + free(zip); int fd = xopen("/dev/null", O_RDONLY); xdup2(fd, STDERR_FILENO);