Passed: OpenSmalltalk/opensmalltalk-vm#1261 (Cog - 3421494)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Passed: OpenSmalltalk/opensmalltalk-vm#1261 (Cog - 3421494)

Travis CI
 
OpenSmalltalk / opensmalltalk-vm

branch icon Cog

build has passed
Build #1261 passed
arrow to build duration

clock icon 2 hours, 31 minutes, and 30 seconds

akgrant43 avatarakgrant43

Merge pull request #232 from akgrant43/21643-FilePlugin-primitiveFileAtEnd

FilePlugin currently splits files in to two groups:

1) Stdio streams and
2) everything else.

To test for the end of file, FilePlugin>>primitiveFileAtEnd:

1) Uses feof() for stdio streams.
2) Compares the current position to the file size for everything else.

This returns the expected results for regular files, but fails for
non-regular files, e.g.:

```
(FileSystem / 'dev' / 'urandom') binaryReadStream next: 8.
'/proc/cpuinfo' asFileReference contents
```

both return empty collections.

Modify sqFileAtEnd() (FilePlugin>>primitiveFileAtEnd) so that #atEnd
returns true when the last character has been read.

Both Squeak and Pharo expect that #atEnd can be used to control
iteration over a stream, answering true as soon as the last character
has been read, and importantly not requiring #next values to be tested
for an end-of-stream.

Previously, stdio streams just used feof(), which requires reading past
the end of the stream, and so required the value returned by #next to be
tested for nil. This causes problems with streams over other
collections where nil is a valid value.

sqFileAtEnd() would also fail to return the correct value for other
files such as kernel virtual files, e.g. /proc/cpuinfo, and devices like
/dev/urandom, because they have a reported file size of 0.

This change also takes a step towards removing the special handling of
stdio files on Unix, significantly simplifying the code base.

This change doesn't break any existing code that uses #next == nil to
test for end-of-stream.

Want to know about upcoming build environment updates?

Would you like to stay up-to-date with the upcoming Travis CI build environment updates? We set up a mailing list for you!

SIGN UP HERE
book icon

Documentation about Travis CI







This email was sent to [hidden email]    unsubscribe from this list