The expected behavior of the emulator is to pass through new-line control-characters directly from the inside to the outside. On the outside, if the output of the emulator is connected to a file, there should be no addition of a carriage-return. If, however, the output is connected to a terminal, the terminal itself will have been configured to add the carriage-return on its own.
In other words, we expect the following command to have the output shown
This is because the terminal inside the emulator is configured with onlcr, so it is adding the carriage-return whenever it sees a new-line.
The PR configures the terminal with -onlcr so this doesn't happen.
Interestingly, prior to opensbi-1.3.1-ctsi-2, opensbi itself was adding yet another carriage-return on its own, whenever it saw a new-line sent to the legacy putchar we use with HTIF console. So the output was
The expected behavior of the emulator is to pass through new-line control-characters directly from the inside to the outside. On the outside, if the output of the emulator is connected to a file, there should be no addition of a carriage-return. If, however, the output is connected to a terminal, the terminal itself will have been configured to add the carriage-return on its own.
In other words, we expect the following command to have the output shown
Instead, what we see before this PR (but when using a yet-to-be-released kernel linked to opensbi-1.3.1-ctsi-2) is
This is because the terminal inside the emulator is configured with
onlcr
, so it is adding the carriage-return whenever it sees a new-line.The PR configures the terminal with
-onlcr
so this doesn't happen.Interestingly, prior to opensbi-1.3.1-ctsi-2, opensbi itself was adding yet another carriage-return on its own, whenever it saw a new-line sent to the legacy putchar we use with HTIF console. So the output was