Skip to content

Commit ffdf454

Browse files
committed
call TruffleFile.getCanonicalFile() with FOLLOW_LINKS, we need to trigger an eventual file extraction from VFS
1 parent 152de7f commit ffdf454

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/CApiContext.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
import java.io.PrintStream;
5454
import java.lang.invoke.VarHandle;
5555
import java.lang.ref.WeakReference;
56-
import java.nio.file.LinkOption;
5756
import java.util.ArrayList;
5857
import java.util.Arrays;
5958
import java.util.HashMap;
@@ -819,7 +818,7 @@ public static CApiContext ensureCapiWasLoaded(Node node, PythonContext context,
819818
TruffleFile homePath = env.getInternalTruffleFile(context.getCAPIHome().toJavaStringUncached());
820819
// e.g. "libpython-native.so"
821820
String libName = context.getLLVMSupportExt("python");
822-
TruffleFile capiFile = homePath.resolve(libName).getCanonicalFile(LinkOption.NOFOLLOW_LINKS);
821+
TruffleFile capiFile = homePath.resolve(libName).getCanonicalFile();
823822
try {
824823
SourceBuilder capiSrcBuilder;
825824
final boolean useNative = PythonOptions.NativeModules.getValue(env.getOptions());

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/common/CExtContext.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
import static com.oracle.graal.python.util.PythonUtils.tsLiteral;
5353

5454
import java.io.IOException;
55-
import java.nio.file.LinkOption;
5655
import java.util.Set;
5756
import java.util.logging.Level;
5857

@@ -320,7 +319,7 @@ public static Object loadCExtModule(Node location, PythonContext context, Module
320319
InteropLibrary interopLib;
321320

322321
if (cApiContext.useNativeBackend) {
323-
TruffleFile realPath = context.getPublicTruffleFileRelaxed(spec.path, context.getSoAbi()).getCanonicalFile(LinkOption.NOFOLLOW_LINKS);
322+
TruffleFile realPath = context.getPublicTruffleFileRelaxed(spec.path, context.getSoAbi()).getCanonicalFile();
324323
getLogger().config(String.format("loading module %s (real path: %s) as native", spec.path, realPath));
325324
String loadExpr = String.format("load(%s) \"%s\"", dlopenFlagsToString(context.getDlopenFlags()), realPath);
326325
if (PythonOptions.UsePanama.getValue(context.getEnv().getOptions())) {
@@ -366,7 +365,7 @@ public static Object loadLLVMLibrary(Node location, PythonContext context, Truff
366365
Env env = context.getEnv();
367366
try {
368367
TruffleString extSuffix = context.getSoAbi();
369-
TruffleFile realPath = context.getPublicTruffleFileRelaxed(path, extSuffix).getCanonicalFile(LinkOption.NOFOLLOW_LINKS);
368+
TruffleFile realPath = context.getPublicTruffleFileRelaxed(path, extSuffix).getCanonicalFile();
370369
CallTarget callTarget = env.parseInternal(Source.newBuilder(J_LLVM_LANGUAGE, realPath).build());
371370
return callTarget.call();
372371
} catch (SecurityException e) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/hpy/jni/GraalHPyJNIContext.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
import static com.oracle.graal.python.util.PythonUtils.tsLiteral;
5858

5959
import java.io.IOException;
60-
import java.nio.file.LinkOption;
6160
import java.util.Arrays;
6261
import java.util.LinkedList;
6362
import java.util.List;
@@ -461,7 +460,7 @@ public static String getJNILibrary() {
461460
PythonContext context = PythonContext.get(null);
462461
TruffleFile libPath = context.getPublicTruffleFileRelaxed(context.getJNIHome()).resolve(PythonContext.J_PYTHON_JNI_LIBRARY_NAME).getAbsoluteFile();
463462
try {
464-
return libPath.getCanonicalFile(LinkOption.NOFOLLOW_LINKS).toString();
463+
return libPath.getCanonicalFile().toString();
465464
} catch (IOException e) {
466465
LOGGER.severe(String.format("Cannot determine canonical path for %s: %s", libPath, e));
467466
throw new IllegalStateException(e);

0 commit comments

Comments
 (0)