Skip to content
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

readLine not working in Linux Mint #24431

Open
McChuck05 opened this issue Nov 12, 2024 · 3 comments
Open

readLine not working in Linux Mint #24431

McChuck05 opened this issue Nov 12, 2024 · 3 comments

Comments

@McChuck05
Copy link

McChuck05 commented Nov 12, 2024

Description

Neither readLine() nor readLineFromStdIn() work today in Linux Mint. I tried both. Assigning to variables didn't help, either.

readLine test:

echo "beginning"
let resp = stdIn.readLine
echo resp
echo "exiting"

readLineFromStdIn test:

import std/rdstdin
echo "beginning"
echo readLineFromStdin("Is Nim awesome? (Y/n): ")
echo "exiting"

Nim Version

Nim 2.2.0

Operating System: Linux Mint 22
Kernel: Linux 6.8.0-48-generic
Architecture: x86-64

gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4)

Current Output

# readLine error report

nim r "readLineTest.nim" (in directory: /home/crf/Nim)
Hint: used config file '/home/crf/.choosenim/toolchains/nim-2.2.0/config/nim.cfg' [Conf]
Hint: used config file '/home/crf/.choosenim/toolchains/nim-2.2.0/config/config.nims' [Conf]
.....................................................................
CC: ../.choosenim/toolchains/nim-2.2.0/lib/system.nim
CC: readLineTest.nim
Hint:  [Link]
Hint: mm: orc; threads: on; opt: none (DEBUG BUILD, `-d:release` generates faster code)
28236 lines; 0.408s; 31.027MiB peakmem; proj: /home/crf/Nim/readLineTest.nim; out: /home/crf/.cache/nim/readLineTest_d/readLineTest_DC3C53A7C166BD37F709101FD7349B2B43D63A00 [SuccessX]
Hint: /home/crf/.cache/nim/readLineTest_d/readLineTest_DC3C53A7C166BD37F709101FD7349B2B43D63A00 [Exec]
beginning
/home/crf/Nim/readLineTest.nim(2) readLineTest
/home/crf/.choosenim/toolchains/nim-2.2.0/lib/std/syncio.nim(506) readLine
/home/crf/.choosenim/toolchains/nim-2.2.0/lib/std/syncio.nim(158) raiseEOF
Error: unhandled exception: EOF reached [EOFError]
Error: execution of an external program failed: '/home/crf/.cache/nim/readLineTest_d/readLineTest_DC3C53A7C166BD37F709101FD7349B2B43D63A00'
Compilation failed.



# readLineFromStdIn error report

nim c -r "readLineTest.nim" (in directory: /home/crf/Nim)
Hint: used config file '/home/crf/.choosenim/toolchains/nim-2.2.0/config/nim.cfg' [Conf]
Hint: used config file '/home/crf/.choosenim/toolchains/nim-2.2.0/config/config.nims' [Conf]
.......................................................................
CC: readLineTest.nim
Hint:  [Link]
Hint: mm: orc; threads: on; opt: none (DEBUG BUILD, `-d:release` generates faster code)
28384 lines; 0.239s; 31.027MiB peakmem; proj: /home/crf/Nim/readLineTest.nim; out: /home/crf/Nim/readLineTest [SuccessX]
Hint: /home/crf/Nim/readLineTest [Exec]
beginning
/home/crf/Nim/readLineTest.nim(3) readLineTest
/home/crf/.choosenim/toolchains/nim-2.2.0/lib/impure/rdstdin.nim(74) readLineFromStdin
Error: unhandled exception: Linenoise returned nil [IOError]
Error: execution of an external program failed: '/home/crf/Nim/readLineTest'
Compilation failed.

Expected Output

beginning
Whatever
Whatever
finished

Known Workarounds

None known at this time.

Additional Information

Last known good: Nim 2.0

@metagn
Copy link
Collaborator

metagn commented Nov 12, 2024

readLine(stdIn) worked two weeks ago.

Do you mean on 2.0? Which specific version?

The only thing that could have changed in the implementation of readLine is csize_t, which might have been affected by #23636 - which is on 2.0.6 and later but not 2.0.4 or earlier. There are also #23924 and slightly unrelated #24313, or maybe none of the ones I mentioned are related.

@McChuck05
Copy link
Author

McChuck05 commented Nov 12, 2024

Do you mean on 2.0? Which specific version?

Sorry, I was mistaken, and edited the original to correct.

An older executable compiled under 2.0 still works correctly today.

Also fails during execution when compiled with cpp.

@metagn
Copy link
Collaborator

metagn commented Nov 13, 2024

An older executable compiled under 2.0 still works correctly today.

Have you maybe tried doing nim c first, then running the executable by itself rather than using nim r on the new versions?

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

No branches or pull requests

2 participants