[edk2] [Patch] BaseTools: Fix one bug of nest !include parser

Yonghong Zhu posted 1 patch 5 years, 10 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/Workspace/MetaFileParser.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
[edk2] [Patch] BaseTools: Fix one bug of nest !include parser
Posted by Yonghong Zhu 5 years, 10 months ago
From: Yunhua Feng <yunhuax.feng@intel.com>

The case is DSC file include file1, file1 include file2, after parse
file2 finished, DSC parser get the wrong section type, then it would
report invalid error.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
 BaseTools/Source/Python/Workspace/MetaFileParser.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 8ab1dd2..4252e6d 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -1568,11 +1568,15 @@ class DscParser(MetaFileParser):
             # Parse the included file
             Parser.Start()
 
             # update current status with sub-parser's status
             self._SectionName = Parser._SectionName
-            self._SectionType = Parser._SectionType
+            if not self._InSubsection:
+                self._SectionType = Parser._SectionType
+            self._SubsectionType = Parser._SubsectionType
+            self._InSubsection = Parser._InSubsection
+
             self._Scope = Parser._Scope
             self._Enabled = Parser._Enabled
 
             # Insert all records in the table for the included file into dsc file table
             Records = IncludedFileTable.GetAll()
-- 
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: Fix one bug of nest !include parser
Posted by Kinney, Michael D 5 years, 10 months ago
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>

Mike
 
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-
> bounces@lists.01.org] On Behalf Of Yonghong Zhu
> Sent: Monday, June 11, 2018 6:01 PM
> To: edk2-devel@lists.01.org
> Cc: Feng, YunhuaX <yunhuax.feng@intel.com>; Gao, Liming
> <liming.gao@intel.com>
> Subject: [edk2] [Patch] BaseTools: Fix one bug of nest
> !include parser
> 
> From: Yunhua Feng <yunhuax.feng@intel.com>
> 
> The case is DSC file include file1, file1 include file2,
> after parse
> file2 finished, DSC parser get the wrong section type,
> then it would
> report invalid error.
> 
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Yonghong Zhu <yonghong.zhu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
> ---
>  BaseTools/Source/Python/Workspace/MetaFileParser.py | 6
> +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git
> a/BaseTools/Source/Python/Workspace/MetaFileParser.py
> b/BaseTools/Source/Python/Workspace/MetaFileParser.py
> index 8ab1dd2..4252e6d 100644
> ---
> a/BaseTools/Source/Python/Workspace/MetaFileParser.py
> +++
> b/BaseTools/Source/Python/Workspace/MetaFileParser.py
> @@ -1568,11 +1568,15 @@ class DscParser(MetaFileParser):
>              # Parse the included file
>              Parser.Start()
> 
>              # update current status with sub-parser's
> status
>              self._SectionName = Parser._SectionName
> -            self._SectionType = Parser._SectionType
> +            if not self._InSubsection:
> +                self._SectionType = Parser._SectionType
> +            self._SubsectionType =
> Parser._SubsectionType
> +            self._InSubsection = Parser._InSubsection
> +
>              self._Scope = Parser._Scope
>              self._Enabled = Parser._Enabled
> 
>              # Insert all records in the table for the
> included file into dsc file table
>              Records = IncludedFileTable.GetAll()
> --
> 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
Re: [edk2] [Patch] BaseTools: Fix one bug of nest !include parser
Posted by Zhu, Yonghong 5 years, 10 months ago
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> 

Best Regards,
Zhu Yonghong

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yonghong Zhu
Sent: Tuesday, June 12, 2018 9:01 AM
To: edk2-devel@lists.01.org
Cc: Feng, YunhuaX <yunhuax.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2] [Patch] BaseTools: Fix one bug of nest !include parser

From: Yunhua Feng <yunhuax.feng@intel.com>

The case is DSC file include file1, file1 include file2, after parse
file2 finished, DSC parser get the wrong section type, then it would report invalid error.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
 BaseTools/Source/Python/Workspace/MetaFileParser.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 8ab1dd2..4252e6d 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -1568,11 +1568,15 @@ class DscParser(MetaFileParser):
             # Parse the included file
             Parser.Start()
 
             # update current status with sub-parser's status
             self._SectionName = Parser._SectionName
-            self._SectionType = Parser._SectionType
+            if not self._InSubsection:
+                self._SectionType = Parser._SectionType
+            self._SubsectionType = Parser._SubsectionType
+            self._InSubsection = Parser._InSubsection
+
             self._Scope = Parser._Scope
             self._Enabled = Parser._Enabled
 
             # Insert all records in the table for the included file into dsc file table
             Records = IncludedFileTable.GetAll()
--
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