[edk2] [Patch] BaseTools: Add check for INF statement must be a .inf file

Yonghong Zhu posted 1 patch 6 years, 10 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/GenFds/FdfParser.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[edk2] [Patch] BaseTools: Add check for INF statement must be a .inf file
Posted by Yonghong Zhu 6 years, 10 months ago
Per FDF spec, INF statement must use a .inf file, we add this error
check.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/GenFds/FdfParser.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 0190be8..44a3564 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -1,9 +1,9 @@
 ## @file
 # parse FDF file
 #
-#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
 #  Copyright (c) 2015, Hewlett Packard Enterprise Development, L.P.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
 #  which accompanies this distribution.  The full text of the license may be found at
@@ -2484,10 +2484,12 @@ class FdfParser:
         self.__GetInfOptions(ffsInf)
 
         if not self.__GetNextToken():
             raise Warning("expected INF file path", self.FileName, self.CurrentLineNumber)
         ffsInf.InfFileName = self.__Token
+        if not ffsInf.InfFileName.endswith('.inf'):
+            raise Warning("expected .inf file path", self.FileName, self.CurrentLineNumber)
 
         ffsInf.CurrentLineNum = self.CurrentLineNumber
         ffsInf.CurrentLineContent = self.__CurrentLine()
 
         #Replace $(SAPCE) with real space
-- 
2.6.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] BaseTools: Add check for INF statement must be a .inf file
Posted by Gao, Liming 6 years, 10 months ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Zhu,
>Yonghong
>Sent: Wednesday, February 07, 2018 2:44 PM
>To: edk2-devel@lists.01.org
>Subject: [edk2] [Patch] BaseTools: Add check for INF statement must be a .inf
>file
>
>Per FDF spec, INF statement must use a .inf file, we add this error
>check.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
>---
> BaseTools/Source/Python/GenFds/FdfParser.py | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
>b/BaseTools/Source/Python/GenFds/FdfParser.py
>index 0190be8..44a3564 100644
>--- a/BaseTools/Source/Python/GenFds/FdfParser.py
>+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
>@@ -1,9 +1,9 @@
> ## @file
> # parse FDF file
> #
>-#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
>+#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
> #  Copyright (c) 2015, Hewlett Packard Enterprise Development, L.P.<BR>
> #
> #  This program and the accompanying materials
> #  are licensed and made available under the terms and conditions of the BSD
>License
> #  which accompanies this distribution.  The full text of the license may be
>found at
>@@ -2484,10 +2484,12 @@ class FdfParser:
>         self.__GetInfOptions(ffsInf)
>
>         if not self.__GetNextToken():
>             raise Warning("expected INF file path", self.FileName,
>self.CurrentLineNumber)
>         ffsInf.InfFileName = self.__Token
>+        if not ffsInf.InfFileName.endswith('.inf'):
>+            raise Warning("expected .inf file path", self.FileName,
>self.CurrentLineNumber)
>
>         ffsInf.CurrentLineNum = self.CurrentLineNumber
>         ffsInf.CurrentLineContent = self.__CurrentLine()
>
>         #Replace $(SAPCE) with real space
>--
>2.6.1.windows.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel