From nobody Thu May 16 08:44:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+108016+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+108016+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1692894860; cv=none; d=zohomail.com; s=zohoarc; b=aCB4naZNFZN1EJMnof0pMvMMm8nJJW010RCJbFYMxl3iML6YqhoBkNTYws7FyakmrgdiqPTKOZ75my9cDYO+FQd8ZB95xJ9cgJ7JgdpsCH2frPtMUdRF4an0WPgKpIZM1NZI8h+1NPZ2FgGIFhunwm86B2eiP/yCfOvXnCYayOA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692894860; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=bDy2t5z6X97ZKzudSmvn7HF5LPp7eYrQH3IXO7Px03I=; b=chnuaOArVtVWV8GSIcXlnFEX1giyDcWlpRCIRE/lmgLhCLmxuMQjVznbcrTPngDLIzfPVauz/X/BMqhhCKbJcUl6rrhhsSFjxDIpHVcznCP6r2WX/njB9ggUMGEDhkn7OtDIjsqE5gZcnLguV18ZykpGlF4I95oEO1xa6NNSvUI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+108016+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1692894860422741.0692597786533; Thu, 24 Aug 2023 09:34:20 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=otr5GLHwFpSxt1d2x09+QWLSKKxnvWssoNpCL8C7RfA=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1692894860; v=1; b=bFmPZRvKd7R4I2Fkcd8J4zQU2TAwXHDd14K8rmsWJji5+9HbV3UkW6AV+MlQWlqevCqsgt/t PmgLGp7xIOaOlJJhTDlP0uGNoo/XUy6iUcjZyiSeauu+LoZjmfAvWlRGgBt47ns3cVi/mdpEgfU xbD2n5Jso0Eh2RulLtjxCuWM= X-Received: by 127.0.0.2 with SMTP id gRIgYY1788612xOAgoDXS4G8; Thu, 24 Aug 2023 09:34:20 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.4.1692894855819359108 for ; Thu, 24 Aug 2023 09:34:19 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10812"; a="373367014" X-IronPort-AV: E=Sophos;i="6.02,195,1688454000"; d="scan'208";a="373367014" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2023 09:34:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10812"; a="827220449" X-IronPort-AV: E=Sophos;i="6.02,195,1688454000"; d="scan'208";a="827220449" X-Received: from njayapra-mobl.gar.corp.intel.com ([10.215.198.205]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2023 09:34:17 -0700 From: "Jayaprakash, N" To: devel@edk2.groups.io Cc: Jayaprakash N , Rebecca Cran , Michael D Kinney , Kloper Dimitry Subject: [edk2-devel] [edk2-libc Patch 1/1] edk2-libc/StdLib: Fix console jump to 0, 0 issue in lseek() Date: Thu, 24 Aug 2023 22:04:05 +0530 Message-Id: <20230824163405.1386-2-n.jayaprakash@intel.com> In-Reply-To: <20230824163405.1386-1-n.jayaprakash@intel.com> References: <20230824163405.1386-1-n.jayaprakash@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,n.jayaprakash@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: pdsPXI2tJFmgFUvCpWmOcgnBx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1692894862428100001 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4531 Python code opens console file descriptor and uses lseek() with position =3D=3D 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 Cc: Michael D Kinney Cc: Jayaprakash N Signed-off-by: Kloper Dimitry --- 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/Uef= i/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 =3D RETURN_UNSUPPORTED; return -1; } - // Everything is OK to do the final verification and "seek". + Proto =3D (EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)Stream->Dev; + + if(Position =3D=3D 0 && whence =3D=3D SEEK_CUR) { + CursorPos.XYpos.Column =3D (UINT32)Proto->Mode->CursorColumn; + CursorPos.XYpos.Row =3D (UINT32)Proto->Mode->CursorRow; + return CursorPos.Offset; + } + + // Everything is OK to do the final verification and "seek". CursorPos.Offset =3D Position; =20 EFIerrno =3D Proto->SetCursorPosition(Proto, --=20 2.40.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108016): https://edk2.groups.io/g/devel/message/108016 Mute This Topic: https://groups.io/mt/100938751/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-