From: "Pedro Falcato" <pedro.falcato@gmail.com>
To: devel@edk2.groups.io, n.jayaprakash@intel.com
Cc: Rebecca Cran <rebecca@bsdio.com>,
Michael D Kinney <michael.d.kinney@intel.com>,
Kloper Dimitry <dimitry.kloper@intel.com>
Subject: Re: [edk2-devel] [edk2-libc Patch 1/1] edk2-libc/StdLib: Fix console jump to 0, 0 issue in lseek()
Date: Fri, 25 Aug 2023 00:39:26 +0100 [thread overview]
Message-ID: <CAKbZUD2Mc1dztYhoZbvJyiX6F8YkNLMY9yV+dpk=P57L_5xY-A@mail.gmail.com> (raw)
In-Reply-To: <20230824163405.1386-2-n.jayaprakash@intel.com>
On Thu, Aug 24, 2023 at 5:34 PM Jayaprakash, N <n.jayaprakash@intel.com> wrote:
>
> 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 <rebecca@bsdio.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Jayaprakash N <n.jayaprakash@intel.com>
> Signed-off-by: Kloper Dimitry <dimitry.kloper@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
ttys are historically not seekable devices.
per Linux lseek(2): "On Linux, using lseek() on a terminal device
fails with the error ESPIPE"
So this function (and consequently this patch) is wrong.
--
Pedro
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108025): https://edk2.groups.io/g/devel/message/108025
Mute This Topic: https://groups.io/mt/100938751/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2023-08-24 23:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-24 16:34 [edk2-devel] [edk2-libc Patch 0/1] Fix issue with lseek function Jayaprakash, N
2023-08-24 16:34 ` [edk2-devel] [edk2-libc Patch 1/1] edk2-libc/StdLib: Fix console jump to 0, 0 issue in lseek() Jayaprakash, N
2023-08-24 23:39 ` Pedro Falcato [this message]
[not found] ` <177E5EE7D234A063.10408@groups.io>
2023-08-25 10:15 ` Jayaprakash, N
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKbZUD2Mc1dztYhoZbvJyiX6F8YkNLMY9yV+dpk=P57L_5xY-A@mail.gmail.com' \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox