[Bugfix:Autograding] Fix Python input echo and newline#12626
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12626 +/- ##
=========================================
Coverage 21.66% 21.66%
Complexity 9637 9637
=========================================
Files 268 268
Lines 36222 36222
Branches 487 487
=========================================
Hits 7847 7847
Misses 27892 27892
Partials 483 483
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Eli-J-Schwartz
left a comment
There was a problem hiding this comment.
Hi @tijaruS,
I tested, the changes, and the dispatched input now shows up in the student view, just as intended.

However, the original issue mentioned the usage of piped input, such as python3 submission.py < input.txt. Since this doesn't involve the dispatcher, it isn't covered by this fix, still wouldn't appear correctly. Do you have any thoughts as to how to add this info to the student view as well.
I also expect many of the autograder tests to fail, since there is now additional text in the output that wasn't there before; the tests should be updated for this new behavior. Also, make sure the description part of the title is 40 characters or less.
|
Since I have not heard from the PR author in over 2 weeks, and the functionality is incomplete, I am closing this PR as abandoned. |
|
Hi! I am working on this. Can this be reopened? |
|
Of course, my apologies! Let me know when you make further progress. |
|
Sure, thank you for opening. |
|
closed due to inactivity |
Why is this change important & necessary?
Fixes #7583
This PR fixes two major discrepancies between local Python execution and Submitty's autograding environment:
dispatcher_actions(interactive input), student output logs previously omitted the user's typed input because STDIN was redirected from a pipe.\r) were not being normalized, leading to unexpected character counts and logic errors in student code.What is the new behavior?
execute.cpp) now identifies the student's output file and manually appends an echo of every input line sent via the dispatcher. This ensures the STDOUT log matches what a student would see in a real terminal.cin_readerthread now surgically strips trailing\rcharacters from input lines, ensuring cross-platform compatibility for instructor-provided input files.get_std_outfilehelper to accurately locate the redirection target from the command string.How to reproduce or test
dispatcher_actionsto provide interactive input.s = input("Enter name: ")and a length checklen(s).Screenshots
Before
After
Other information