From nobody Mon May 6 21:10:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+47252+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47252+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1568602306; cv=none; d=zoho.com; s=zohoarc; b=g6VNoRO5wyoPxSH2cmOWHBgSEf3/Nxu0b2CAe8DxunUwUC5L3kUCbnnFuTabEKKG0PztKUK+U+0PT0OWXEy0gkeboycUpv5GXhAi5BFHiaK6BbUblhYSRaOdkAmXi8bvYE8435hS/1flsmltvgzHtnSu/nTjA4lqh4y6Zf97P5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568602306; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=qGf2QRc+HggNNkKlev1AZL8q7ROj/FsX7dZDvI9fElY=; b=D7Rt5kD3EEq4L9JqkxtKQKYxlOAUmuxTD/KK7vc2B4/f1oP/eIi1tMUGbjNhzLE72+5fEJBKl/JfQG1/PJ2tkh2Rk0FwKbEgqPjcEeDqPmvZ4/NsjQ0Jb5g0Ozu5UwtvLOWKgIdkxRUFiSuro6e6spNrRog7tEVq5oFFj2IOAiQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47252+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1568602306818149.5491367279393; Sun, 15 Sep 2019 19:51:46 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ZQYNYY1788612xVwa4XmKLxd; Sun, 15 Sep 2019 19:51:45 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Sun, 15 Sep 2019 19:51:45 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Sep 2019 19:51:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,510,1559545200"; d="scan'208";a="216061786" X-Received: from jshi19-mobl.ccr.corp.intel.com ([10.254.215.41]) by fmsmga002.fm.intel.com with ESMTP; 15 Sep 2019 19:51:44 -0700 From: "Steven Shi" To: devel@edk2.groups.io Cc: liming.gao@intel.com, bob.c.feng@intel.com Subject: [edk2-devel] [PATCH] BaseTools: Add more parameter checking for CopyFileOnChange() Date: Mon, 16 Sep 2019 10:51:39 +0800 Message-Id: <20190916025139.10424-1-steven.shi@intel.com> Precedence: Bulk List-Unsubscribe: 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,steven.shi@intel.com X-Gm-Message-State: 1r5YxmeOt7wwGgvEgJhwn9wzx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1568602305; bh=4CY3mX5M34+k746+m8f55hLv9Fc9Mw3LKw1omqQvFmg=; h=Cc:Date:From:Reply-To:Subject:To; b=hGNc7we2dxY9vXDMUPF1lfy20mYF5bOY9mlwMJj2jnEcnsR4pMFvoNY2183AJ9YsX70 lz9xsdthahsUuPKfg6CqlHG+xGIZjmRbgggqX0Tb3rHx7zDfUlJZ7B/XCWB5CS4+pJrHf rzGZGWqJnjw7gFEXxa1Z4zRIKvhxHJmx6xY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2193 The current CopyFileOnChange() method in Misc.py does not accept the input SrcFile parameter as a dir, but the method does not check the SrcFile is dir or not. This patch is to add more input parameter type checking and error message output for method CopyFileOnChange. Cc: Liming Gao Cc: Bob Feng Signed-off-by: Steven Shi --- BaseTools/Source/Python/Common/Misc.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index 15ae6a9e40..7c93fc4dca 100755 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -541,6 +541,11 @@ def CopyFileOnChange(SrcFile, Dst, FileLock=3DNone): Dst =3D LongFilePath(Dst) =20 if not os.path.exists(SrcFile): + EdkLogger.error(None, FILE_COPY_FAILURE, ExtraData=3D'CopyFileOnCh= ange SrcFile does not exists: %s' % SrcFile) + return False + + if os.path.isdir(SrcFile): + EdkLogger.error(None, FILE_COPY_FAILURE, ExtraData=3D'CopyFileOnCh= ange SrcFile is a dir, not a file: %s' % SrcFile) return False =20 if os.path.isdir(Dst): --=20 2.17.1.windows.2 -=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 (#47252): https://edk2.groups.io/g/devel/message/47252 Mute This Topic: https://groups.io/mt/34160448/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-