Skip to content

Commit 5bbaec4

Browse files
committed
workaround symlink check
1 parent ef59f12 commit 5bbaec4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/PosixModuleBuiltins.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,18 @@ Object stat(String path, boolean followSymlinks) {
424424
} else if (f.isSymbolicLink()) {
425425
mode |= S_IFLNK;
426426
} else {
427-
// TODO: differentiate these
428-
mode |= S_IFSOCK | S_IFBLK | S_IFCHR | S_IFIFO;
427+
// TODO: remove the additional check for symlink once GR-13265 is fixed
428+
TruffleFile canonicalFile = null;
429+
try {
430+
canonicalFile = f.getCanonicalFile();
431+
} catch (IOException e) {
432+
}
433+
if (!f.getAbsoluteFile().equals(canonicalFile)) {
434+
mode |= S_IFLNK;
435+
} else {
436+
// TODO: differentiate these
437+
mode |= S_IFSOCK | S_IFBLK | S_IFCHR | S_IFIFO;
438+
}
429439
}
430440
try {
431441
mtime = fileTimeToSeconds(f.getLastModifiedTime(linkOptions));

0 commit comments

Comments
 (0)