From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.14204.1627865770149126635 for ; Sun, 01 Aug 2021 17:56:10 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=u+fQ7RXF; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: yuwei.chen@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10063"; a="213391123" X-IronPort-AV: E=Sophos;i="5.84,287,1620716400"; d="scan'208";a="213391123" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Aug 2021 17:56:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,287,1620716400"; d="scan'208";a="466114575" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by orsmga008.jf.intel.com with ESMTP; 01 Aug 2021 17:56:08 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Sun, 1 Aug 2021 17:56:08 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Sun, 1 Aug 2021 17:56:08 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Sun, 1 Aug 2021 17:56:08 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.169) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Sun, 1 Aug 2021 17:56:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jASg0+pk6aMLe0//IcIkI/xS39ybkvfkDwO9lBAFpOO6FmemvZGaVsLjoQs6WEq9LvfwgJth539Zq8z+X+DqOdRD759VHEiZRyu+aRgJugsJvCWAzxRLskDdioI8o6IKwHDSDIr8hMKeM2BfE2WFvEUIqef7sr+jBPLyYErbMsVn7J+cVYzYY0FZj8qxqucEjimVQFmu1iWL8mMQpsyVxnFT5sooHW3gaM3tJw1cqFsk9TRpAv8lJRHZJ1JfBS2jqxMasvwnkns5DZILQJYNAdisXHUo2B2YaEMFDQEnuobXBs3+QU2fj0PtUQ9XoDrLLjhkC0ZmN3qKyajX/RmX8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d42AYMycYrt+nLBYj5AxYLZJf7isdB1iIDJADkazDu4=; b=P4T7hoK6oVXUjM3weFrga1NX1SefqjEo6DLQcVYbsH7pdivAh2PcXFE1UnkjoFU6ujE4AwKBBQi1X0n31wBE09D3Jwr+Hp1+gp48VegEixTXlZdS9cV7XDiX3SO7en38/HS70/AVdhcqThhTtb7eOlSV5bRY1R1w9W7k1MDXVgr3rkLl8bh2/fhqV765dy21Il+2rmGVpJ3WyzmsIEK+FfSAx3rL04tufXBUQRANxB24Vjf2gECXbD3qmHDAWnWnZcfS9BTG1n5imf0LCu2SMANwHHS3KyM5o8qZIKS4imbU3lm2admNEAbCw3yHApojCEhp82+XmeTBxWs7B8dA9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d42AYMycYrt+nLBYj5AxYLZJf7isdB1iIDJADkazDu4=; b=u+fQ7RXFkimxgkAnyjYXrsPWQ2mLt+bZN1IDCymin5CTzNaL28ws7+8dXg50DANRS6fjaoCmqQliJIr+flupXK5FTxFUoLf8tzHaLaihChOambJQgHT+gN765g7yeudd6z9TTtqhwFFeXXJ0/RhIxZHSnbcYCJorAG+rKhPYh+Y= Received: from DM5PR11MB1594.namprd11.prod.outlook.com (2603:10b6:4:5::16) by DM6PR11MB3881.namprd11.prod.outlook.com (2603:10b6:5:199::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.25; Mon, 2 Aug 2021 00:56:01 +0000 Received: from DM5PR11MB1594.namprd11.prod.outlook.com ([fe80::bc37:8710:44d2:42c4]) by DM5PR11MB1594.namprd11.prod.outlook.com ([fe80::bc37:8710:44d2:42c4%8]) with mapi id 15.20.4373.026; Mon, 2 Aug 2021 00:56:01 +0000 From: "Yuwei Chen" To: "Feng, Bob C" , "devel@edk2.groups.io" CC: Liming Gao Subject: Re: [Patch] BaseTools: use shutil.copyfile instead shutil.copy2 Thread-Topic: [Patch] BaseTools: use shutil.copyfile instead shutil.copy2 Thread-Index: AQHXg6YUhGFnek4CGE2ZWZQKFreeXatfarWQ Date: Mon, 2 Aug 2021 00:56:01 +0000 Message-ID: References: <20210728114523.687-1-bob.c.feng@intel.com> In-Reply-To: <20210728114523.687-1-bob.c.feng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 81a85c35-da6f-40b7-c481-08d955504c6e x-ms-traffictypediagnostic: DM6PR11MB3881: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3631; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8McLMhudQZQD8VXDpa8fzAZAowPaQMpnOTuAtnmABFWV2huJLv5cqqi3XXi3k6UU+Bugro6Xnt8qkiFFuUQDabYpaTQ7VnXKurQaN1ucBIvfwMCpi3XF08pET/Eo/UGz9I/9d7W9+Euka7CKhsiYSZMOHHfpmfqxuh06kDWatL5N3Qp60j/fRJtfb5GMPmX721wP6SaHdOL4nBLc17EJzbAodxjrcoSgd1qT/TjJh33P3+rl4IDReAT4sQ+cd6c1hXaX+ucTSuns1d1cxLNWOsA6Wrv7yMQ2PvJwAQoba1lnq7ARCBBFN6UObHdK3DvUcA+LDQWvN0ZbFzpO4TV16z9pOt1+WUwM+LEy4ME770fd0eQech2H3ygptEP775q1a9CvHRmHH7gsIytqIzpz0qi5WT6GUlpRJSiDTul0VooiLSp+jmZPOt2TdUUXTOdC01LV5/E0Cyusrt2PHA1RvUtwJf5/f/CHj8smU2U8xsOsUPmt828zwi46Nm+cbyluFOL0vgNG6zp/3ax8XKPo8KB8Le0FOAv/TRUIrs6HUTxfdJnjhAzztSbqlsoutnpwTG+3P7sWpqq0gX00bZ/ZhWdp20pCSFnYQ1CjKRuyOVtw+A/s7Opjl6khakCkDph2scr9ydrPGPJWl/ZAsD2LgjGW17y7IpZaxWflsC2yXHdylCeD3Msk2D4NUXDxtr812roii8qs/TXrOKU0na9HhA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR11MB1594.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(9686003)(66556008)(76116006)(66946007)(66446008)(38100700002)(508600001)(38070700005)(2906002)(83380400001)(64756008)(55016002)(66476007)(122000001)(33656002)(6506007)(53546011)(8676002)(7696005)(26005)(8936002)(186003)(71200400001)(4326008)(5660300002)(86362001)(52536014)(316002)(110136005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?EcpA7JL5/L5kRFI83xD/bg3SO4wC3pz9iyo7DuPsSgQdeBdnJYPyvMJHf+wS?= =?us-ascii?Q?3uopj9wao30+3owZqfqwtbi5cXkNpkuXhCwLNJKXf0Kd6noNjGGNOw6F+hdw?= =?us-ascii?Q?l7A6hZnTnP9fpjv06zwa3pUdz72lsv+KiAOt0/4JaquSr73NfeJIH8GX+3bz?= =?us-ascii?Q?wECfkanP2bVgILJkq+tvxf+QbBg7kYVERc+dklcd1oTjbh+2PPBCRHnIwE1a?= =?us-ascii?Q?MB7tTLBdJJJXs6WhqEAh/0MzRiigolBdWtfJMfamICwynCROBbN//QSm6KR/?= =?us-ascii?Q?ZYsK97MpUUbzhKhX8XIJ4H3fdIEsEoq/Ta3xgShi+De9RcvGeWKljOx2ttVB?= =?us-ascii?Q?ztaF5YTk7cczmE1yUprqVbjTWDCmgmgazGyqPc7dftvSCri46/WMrEMYRRKx?= =?us-ascii?Q?4RAhOdCHZYn8tR2Pnhk/GF/C5Y2vjbeNKJya6D6m+kWg2P3FTCSSbmM22r1S?= =?us-ascii?Q?vEoRtsIRQD9NCOYn+LzZdNxrPEMBubRQV3aEXBZLWOrDTv9GhgBk9HieFXO4?= =?us-ascii?Q?/u0VoLaM3ykf6YfOLD+LC6IoUImifPUs61VPV24TVqXlU5HMgbOT2j3IcZDM?= =?us-ascii?Q?i9NGTj5tHYOFRxJz2sDD3M0K5sqVFBV95MqQJD7gr4OK+vC6pium4MrBoqGg?= =?us-ascii?Q?Feijcc6FJ0q7OPcJ2lO7dUwEJ8RMUDXK17WwDAlaVsShva1EU6aXljlxkI7u?= =?us-ascii?Q?hpv2YMMk1m0LdLCzFhHepHVQ4C8PlLmkYUFVMfV4mo+oBooa9InsadynGWDQ?= =?us-ascii?Q?zUGD1cAKnx3WI553beeb5ADN7tcW+NMOIYTXWWgLOzumHW1uKzu8uqGNaiB6?= =?us-ascii?Q?oS/sJAQ6iIe377RTvgXOJUwM0/F4OalOlu4DNmTtSfn5dIyJ4lqYEFpWxICW?= =?us-ascii?Q?/JTiFW81cpZBmEk0Gn7UlEG0OhV7JCMRXRJZqhVHzYZFD5UjmXgWALBAeGxx?= =?us-ascii?Q?6CbghV06o/KY+6FjWYKDk6BiMLolqBWVnloQqYIDujExdHkSBL6s2+66nReb?= =?us-ascii?Q?niivyb2GgPKHz9Yg27NpgUKbDF+FZnklEfPCgB61q299bxMYI30VmapI9Oq+?= =?us-ascii?Q?3znOCyM1H14rn+ML0vtbk1jLPhH2f/wWJbYF8TT7tFKpC+1ijnMNdSzR+smK?= =?us-ascii?Q?yWx+SzNUhGOtrRzubZKU7l2aQYb5vDn4jpIcRu2DQm7nX5ipzipiG5xo64Gw?= =?us-ascii?Q?7xXK5RQj0//vLLE/IUpHWQyG46LwfsfA9J6fOk29+5podlb0miM0LVUDBtyg?= =?us-ascii?Q?+XVb2IWlvx6kC5SulLDb+EJoo/nb2f4Q8vn72oJAfM8KY13p39xL/nLJY5tq?= =?us-ascii?Q?sJB3LGYKB3kh7746RbqHpkUc?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM5PR11MB1594.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81a85c35-da6f-40b7-c481-08d955504c6e X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Aug 2021 00:56:01.6388 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: jFNkijhd/SLaQ5pQm3ns6aNDp6VSe15HSlaLlhRlvADqAWz8mgE98i2Y8IVFMamfDH0DHYk/C3Q307/T4XNs3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3881 Return-Path: yuwei.chen@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yuwei Chen > -----Original Message----- > From: Feng, Bob C > Sent: Wednesday, July 28, 2021 7:45 PM > To: devel@edk2.groups.io > Cc: Liming Gao ; Chen, Christine > > Subject: [Patch] BaseTools: use shutil.copyfile instead shutil.copy2 >=20 > In Split tool, the copy file actions only need to copy file content but n= ot need > to copy file metadata. >=20 > copy2() copies the file metadata that causes split unit test failed under= edk2- > basetools CI environment. >=20 > So this patch changes the call of copy2() to copyfile(). >=20 > Signed-off-by: Bob Feng > Cc: Liming Gao > Cc: Yuwei Chen > --- > BaseTools/Source/Python/Split/Split.py | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/Split/Split.py > b/BaseTools/Source/Python/Split/Split.py > index e223a72a94..e70d5c22c4 100644 > --- a/BaseTools/Source/Python/Split/Split.py > +++ b/BaseTools/Source/Python/Split/Split.py > @@ -146,18 +146,18 @@ def splitFile(inputfile, position, outputdir=3DNone= , > outputfile1=3DNone, outputfile2 > logger.error("Can't make dir: %s" % outputfolder) raise(= e) if > position <=3D 0: if outputfile2 !=3D os.path.abspath(inputfile):- > shutil.copy2(os.path.abspath(inputfile), outputfile2)+ > shutil.copyfile(os.path.abspath(inputfile), outputfile2) with > open(outputfile1, "wb") as fout: fout.write(b'') else: > inputfilesize =3D getFileSize(inputfile) if position >=3D inputfi= lesize: if > outputfile1 !=3D os.path.abspath(inputfile):- > shutil.copy2(os.path.abspath(inputfile), outputfile1)+ > shutil.copyfile(os.path.abspath(inputfile), outputfile1) with > open(outputfile2, "wb") as fout: fout.write(b'') = else: try: > tempdir =3D tempfile.mkdtemp()@@ -169,12 +169,12 @@ def splitFile(inputfi= le, > position, outputdir=3DNone, outputfile1=3DNone, outputfile2 > fout1.write(content1) conte= nt2 =3D > fin.read(inputfilesize - position) with open(tempfile= 2, "wb") as > fout2: fout2.write(content2)- shut= il.copy2(tempfile1, > outputfile1)- shutil.copy2(tempfile2, outputfile2)+ > shutil.copyfile(tempfile1, outputfile1)+ shutil.copyfile(t= empfile2, > outputfile2) except Exception as e: logger.er= ror("Split file > failed") raise(e) finally: if= os.path.exists(tempdir):-- > 2.29.1.windows.1