From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: bob.c.feng@intel.com) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by groups.io with SMTP; Wed, 18 Sep 2019 01:07:51 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Sep 2019 01:07:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,520,1559545200"; d="scan'208";a="216862860" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga002.fm.intel.com with ESMTP; 18 Sep 2019 01:07:51 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 18 Sep 2019 01:07:51 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 18 Sep 2019 01:07:51 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 18 Sep 2019 01:07:50 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.32]) by shsmsx102.ccr.corp.intel.com ([169.254.2.113]) with mapi id 14.03.0439.000; Wed, 18 Sep 2019 16:07:49 +0800 From: "Bob Feng" To: "devel@edk2.groups.io" , "Shi, Steven" CC: "Gao, Liming" Subject: Re: [edk2-devel] [PATCH v2 1/1] BaseTools: Add more parameter checking for CopyFileOnChange() Thread-Topic: [edk2-devel] [PATCH v2 1/1] BaseTools: Add more parameter checking for CopyFileOnChange() Thread-Index: AQHVbdAv23n5F0ixEUGCKcuIYaB7DKcxFD/w Date: Wed, 18 Sep 2019 08:07:49 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D161536B6F@SHSMSX104.ccr.corp.intel.com> References: <20190918032109.3844-1-steven.shi@intel.com> <20190918032109.3844-2-steven.shi@intel.com> In-Reply-To: <20190918032109.3844-2-steven.shi@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: bob.c.feng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bob Feng =20 -----Original Message----- From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Stev= en Shi Sent: Wednesday, September 18, 2019 11:21 AM To: devel@edk2.groups.io Cc: Gao, Liming ; Feng, Bob C Subject: [edk2-devel] [PATCH v2 1/1] BaseTools: Add more parameter checkin= g for CopyFileOnChange() 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 d= ir or not. This patch is to add more input parameter type checking and erro= r message output for method CopyFileOnChange. Cc: Liming Gao Cc: Bob Feng Signed-off-by: Steven Shi --- BaseTools/Source/Python/Common/Misc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyt= hon/Common/Misc.py index 714eb840ea..a488536cb4 100755 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -536,7 +536,8 @@ def CopyFileOnChange(SrcFile, Dst, FileLock=3DNone): SrcFile =3D LongFilePath(SrcFile) Dst =3D LongFilePath(Dst) =20 - if not os.path.exists(SrcFile): + if os.path.isdir(SrcFile): + EdkLogger.error(None, FILE_COPY_FAILURE,=20 + ExtraData=3D'CopyFileOnChange SrcFile is a dir, not a file: %s' %=20 + SrcFile) return False =20 if os.path.isdir(Dst): -- 2.17.1.windows.2