Skip to content

Commit 9c63604

Browse files
committed
Remove seek post-check in emulated backend
It breaks working with files in append mode.
1 parent 52d52e2 commit 9c63604

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -729,7 +729,6 @@ private SelectableChannel[] getSelectableChannels(int[] fds) throws PosixExcepti
729729
public long lseek(int fd, long offset, int how,
730730
@Bind("$node") Node inliningTarget,
731731
@Exclusive @Cached InlinedBranchProfile errorBranch,
732-
@Exclusive @Cached InlinedConditionProfile notSupported,
733732
@Exclusive @Cached InlinedConditionProfile noFile,
734733
@Exclusive @Cached InlinedConditionProfile notSeekable,
735734
@Shared("eq") @Cached TruffleString.EqualNode eqNode) throws PosixException {
@@ -754,9 +753,6 @@ public long lseek(int fd, long offset, int how,
754753
errorBranch.enter(inliningTarget);
755754
throw posixException(OSErrorEnum.fromException(e, eqNode));
756755
}
757-
if (notSupported.profile(inliningTarget, newPos < 0)) {
758-
throw createUnsupportedFeature("cannot seek beyond the file size");
759-
}
760756
return newPos;
761757
}
762758

@@ -779,8 +775,7 @@ private static long setPosition(long pos, int how, SeekableByteChannel fc) throw
779775
throw new IllegalArgumentException();
780776
}
781777
fc.position(newPos);
782-
long p = fc.position();
783-
return p != newPos ? -1 : p;
778+
return fc.position();
784779
}
785780

786781
@ExportMessage(name = "ftruncate")

0 commit comments

Comments
 (0)