Type: Bug Priority: Medium Component: C++ Playground / Output Validation
Summary
In the C++ Playground tool, the output validation incorrectly interprets escape sequences. The program executes successfully but fails the test due to a mismatch between expected and actual output caused by improper handling of newline characters.
### Classification
**Type:** Bug
**Priority:** Medium
**Component:** C++ Playground / Output Validation
### Summary
In the **C++ Playground** tool, the output validation incorrectly interprets escape sequences. The program executes successfully but fails the test due to a mismatch between expected and actual output caused by improper handling of newline characters.
### Steps to Reproduce
1. Navigate to [learn.spikersoft.com/tools/cpp-playground](https://learn.spikersoft.com/tools/cpp-playground).
2. Enter the following code:
```cpp
#include <iostream>
int main() {
std::cout << "Hello, world!/n";
return 0;
}
Root cause: C/C++ lesson stdout was compared byte-exactly in both the browser grader (ClangLessonGraderService) and the authoritative server-side grader (ClangLessonGradingExecutor). An otherwise-correct program failed over invisible trailing characters — a missing/extra final newline (std::endl vs "\n") or CRLF line endings — which is the "improper handling of newline characters" described here.
Fix: both graders now normalize line endings (CRLF/CR → LF) and trim trailing whitespace before comparing, while preserving internal newlines so multi-line output is still graded faithfully. Local (browser) and server grading stay in agreement.
Note on the repro: the sample uses std::cout << "Hello, world!/n"; — /n (forward slash) is not an escape sequence, so the program prints the literal Hello, world!/n and correctly fails. The newline escape is \n (backslash). That specific line is a typo; this fix addresses the genuine latent defect it surfaced (brittle exact-match grading).
Fixed across both graders.
**Root cause:** C/C++ lesson stdout was compared byte-exactly in both the browser grader (`ClangLessonGraderService`) and the authoritative server-side grader (`ClangLessonGradingExecutor`). An otherwise-correct program failed over invisible trailing characters — a missing/extra final newline (`std::endl` vs `"\n"`) or CRLF line endings — which is the "improper handling of newline characters" described here.
**Fix:** both graders now normalize line endings (CRLF/CR → LF) and trim trailing whitespace before comparing, while preserving internal newlines so multi-line output is still graded faithfully. Local (browser) and server grading stay in agreement.
- Frontend: spikersoft-angular `fix/issue-151-stdout-newline-tolerance` (merged).
- Backend: spikersoft-backend PR #6.
**Note on the repro:** the sample uses `std::cout << "Hello, world!/n";` — `/n` (forward slash) is not an escape sequence, so the program prints the literal `Hello, world!/n` and correctly fails. The newline escape is `\n` (backslash). That specific line is a typo; this fix addresses the genuine latent defect it surfaced (brittle exact-match grading).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Classification
Type: Bug
Priority: Medium
Component: C++ Playground / Output Validation
Summary
In the C++ Playground tool, the output validation incorrectly interprets escape sequences. The program executes successfully but fails the test due to a mismatch between expected and actual output caused by improper handling of newline characters.
Steps to Reproduce
Fixed across both graders.
Root cause: C/C++ lesson stdout was compared byte-exactly in both the browser grader (
ClangLessonGraderService) and the authoritative server-side grader (ClangLessonGradingExecutor). An otherwise-correct program failed over invisible trailing characters — a missing/extra final newline (std::endlvs"\n") or CRLF line endings — which is the "improper handling of newline characters" described here.Fix: both graders now normalize line endings (CRLF/CR → LF) and trim trailing whitespace before comparing, while preserving internal newlines so multi-line output is still graded faithfully. Local (browser) and server grading stay in agreement.
fix/issue-151-stdout-newline-tolerance(merged).Note on the repro: the sample uses
std::cout << "Hello, world!/n";—/n(forward slash) is not an escape sequence, so the program prints the literalHello, world!/nand correctly fails. The newline escape is\n(backslash). That specific line is a typo; this fix addresses the genuine latent defect it surfaced (brittle exact-match grading).