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

[BUG] input() causes mojo to crash when user sends ctrl-d with no input #3908

Open
mahiro21h opened this issue Dec 23, 2024 · 0 comments
Open
Labels
bug Something isn't working mojo-repo Tag all issues with this label

Comments

@mahiro21h
Copy link

Bug description

sending ctrl-d to input() when it asks for input causes mojo to crash. this doesn't happen if you do provide some input before pressing ctrl-d.

also, this is probably not relevant but im including it just in case, i noticed that input() behaved differently compared to python's input() when the user presses ctrl-d after providing some input (the programs' output is identical).

in this python program, input() returns the input after the user presses ctrl-d 3 times:

name = input("Who are you? ")
greeting = "Hi, " + name + "!"
print(greeting)

output:
Who are you? mahiroHi, mahir!

whereas in the mojo program from the mojo manual, for example, input() will return after the users press ctrl-d 2 times.
output:
Who are you? mahiroHi, mahir!

Steps to reproduce

  • write any program that calls input()
  • run the program with mojo run program_name.mojo
  • press ctrl-d when the program asks for input

crash backtrace of the program linked earlier that asks the user for their name to greet them:

(conway-gol) conway-gol -> mojo run main.mojo 
Who are you? Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
Stack dump:
0.	Program arguments: mojo run main.mojo
#0 0x00006144c6a616bb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) Signals.cpp:0:0
#1 0x00006144c6a5f619 llvm::sys::RunSignalHandlers() Signals.cpp:0:0
#2 0x00006144c6a61d3d SignalHandler(int) Signals.cpp:0:0
#3 0x00007005824d81d0 (/usr/lib/libc.so.6+0x3d1d0)
#4 0x00007004e8001e85 
mojo crashed!
Please file a bug report.
Segmentation fault (core dumped)

System information

OS: archlinux
`mojo -v`: mojo 24.6.0 (4487cd6e)
`magic -V`: magic 0.5.1 - (based on pixi 0.37.0)
@mahiro21h mahiro21h added bug Something isn't working mojo-repo Tag all issues with this label labels Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

1 participant