Skip to content

Commit 047be79

Browse files
committed
fix incorrect timestamp attribute usage for posixStat and basicStat fallbacks
1 parent f87e6a7 commit 047be79

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/EmulatedPosixSupport.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ private static long[] unixStat(TruffleFile file, LinkOption... linkOptions) thro
975975
LAST_ACCESS_TIME,
976976
LAST_MODIFIED_TIME,
977977
UNIX_CTIME), linkOptions);
978-
return setTimestamps(attributes, new long[]{
978+
return setTimestamps(attributes, UNIX_CTIME, new long[]{
979979
attributes.get(UNIX_MODE),
980980
attributes.get(UNIX_INODE),
981981
attributes.get(UNIX_DEV),
@@ -1001,7 +1001,7 @@ private long[] posixStat(TruffleFile file, LinkOption... linkOptions) throws IOE
10011001
UNIX_GROUP,
10021002
UNIX_PERMISSIONS), linkOptions);
10031003
final Set<PosixFilePermission> posixFilePermissions = attributes.get(UNIX_PERMISSIONS);
1004-
return setTimestamps(attributes, new long[]{
1004+
return setTimestamps(attributes, CREATION_TIME, new long[]{
10051005
posixPermissionsToMode(fileTypeBitsFromAttributes(attributes), posixFilePermissions),
10061006
getEmulatedInode(file), // ino
10071007
0, // dev
@@ -1040,7 +1040,7 @@ private long[] basicStat(TruffleFile file, LinkOption... linkOptions) throws IOE
10401040
mode |= 0100;
10411041
}
10421042
int inode = getEmulatedInode(file);
1043-
return setTimestamps(attributes, new long[]{
1043+
return setTimestamps(attributes, CREATION_TIME, new long[]{
10441044
mode,
10451045
inode, // ino
10461046
0, // dev
@@ -1053,10 +1053,10 @@ private long[] basicStat(TruffleFile file, LinkOption... linkOptions) throws IOE
10531053
});
10541054
}
10551055

1056-
private static long[] setTimestamps(Attributes attributes, long[] statResult) {
1056+
private static long[] setTimestamps(Attributes attributes, TruffleFile.AttributeDescriptor<FileTime> ctimeDescriptor, long[] statResult) {
10571057
FileTime atime = attributes.get(LAST_ACCESS_TIME);
10581058
FileTime mtime = attributes.get(LAST_MODIFIED_TIME);
1059-
FileTime ctime = attributes.get(UNIX_CTIME);
1059+
FileTime ctime = attributes.get(ctimeDescriptor);
10601060
statResult[7] = fileTimeToSeconds(atime);
10611061
statResult[8] = fileTimeToSeconds(mtime);
10621062
statResult[9] = fileTimeToSeconds(ctime);

0 commit comments

Comments
 (0)