Reviewed the changes and it looks good. Also verified that the fix solves the problem.
Reviewed-by : Jayaprakash N <n.jayaprak...@intel.com> -----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Jayaprakash, N Sent: Thursday, August 24, 2023 10:04 PM To: devel@edk2.groups.io Cc: Jayaprakash, N <n.jayaprak...@intel.com>; Rebecca Cran <rebe...@bsdio.com>; Kinney, Michael D <michael.d.kin...@intel.com>; Kloper, Dimitry <dimitry.klo...@intel.com> Subject: [edk2-devel] [edk2-libc Patch 1/1] edk2-libc/StdLib: Fix console jump to 0, 0 issue in lseek() REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4531 Python code opens console file descriptor and uses lseek() with position == 0 and SEEK_CUR as 'do nothing, check console is alive' operation. Current implementation of daConsole ignores whence argument, this is wrong in case lseek(0, SEEK_CUR) will send cursor to (0,0). This fix is not generic, but solves the particular situation. Cc: Rebecca Cran <rebe...@bsdio.com> Cc: Michael D Kinney <michael.d.kin...@intel.com> Cc: Jayaprakash N <n.jayaprak...@intel.com> Signed-off-by: Kloper Dimitry <dimitry.klo...@intel.com> --- StdLib/LibC/Uefi/Devices/Console/daConsole.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/StdLib/LibC/Uefi/Devices/Console/daConsole.c b/StdLib/LibC/Uefi/Devices/Console/daConsole.c index 56571af..ba031d6 100644 --- a/StdLib/LibC/Uefi/Devices/Console/daConsole.c +++ b/StdLib/LibC/Uefi/Devices/Console/daConsole.c @@ -141,8 +141,16 @@ da_ConSeek( EFIerrno = RETURN_UNSUPPORTED; return -1; } - // Everything is OK to do the final verification and "seek". + Proto = (EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)Stream->Dev; + + if(Position == 0 && whence == SEEK_CUR) { + CursorPos.XYpos.Column = (UINT32)Proto->Mode->CursorColumn; + CursorPos.XYpos.Row = (UINT32)Proto->Mode->CursorRow; + return CursorPos.Offset; + } + + // Everything is OK to do the final verification and "seek". CursorPos.Offset = Position; EFIerrno = Proto->SetCursorPosition(Proto, -- 2.40.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108035): https://edk2.groups.io/g/devel/message/108035 Mute This Topic: https://groups.io/mt/100952873/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-