New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when closing an unopened file on debian 8. #9456

Closed
flenniken opened this Issue Oct 20, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@flenniken
Copy link

flenniken commented Oct 20, 2018

Nim crashes when closing an unopened file on debian 8. It works on the Mac. The document doesn't say what it is suppose to do, but it would easier to use, if closing did nothing when the file wasn't open. Whether you change it or not, I think the documentation should specify how it behaves in this case.

Here is the close doc:

https://github.com/nim-lang/Nim/blob/master/lib/system.nim#L3092

Here are the steps to reproduce the issue:

root@ad928cb4f3d1:~/code/test# cat t2.nim

var file:File
file.close()

root@ad928cb4f3d1:~/code/test# nim c -r --hints:off t2
CC: t2
Traceback (most recent call last)
t2.nim(3)                t2
sysio.nim(133)           close
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Error: execution of an external program failed: './t2 '

root@ad928cb4f3d1:~/code/test# cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
root@ad928cb4f3d1:~/code/test# 

Vindaar added a commit to Vindaar/Nim that referenced this issue Oct 20, 2018

@Vindaar Vindaar referenced this issue Oct 20, 2018

Merged

Fixes #9456 #9457

@Vindaar

This comment has been minimized.

Copy link
Contributor

Vindaar commented Oct 20, 2018

I guess we should check whether the pointer is nil. :)

@krux02 krux02 closed this in #9457 Oct 20, 2018

krux02 added a commit that referenced this issue Oct 20, 2018

narimiran added a commit to narimiran/Nim that referenced this issue Oct 31, 2018

narimiran added a commit to narimiran/Nim that referenced this issue Nov 1, 2018

narimiran added a commit that referenced this issue Nov 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment