public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: report error HiiString in HII format PCD must not be empty
@ 2017-06-23  6:43 Yonghong Zhu
  2017-06-23  6:52 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2017-06-23  6:43 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao

Add a check that HiiString field in the HII format PCD entry must not
be an empty string.

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

diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index d094403..4a5311a 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -1137,10 +1137,17 @@ class DscParser(MetaFileParser):
         if len(ValueList) > 1 and ValueList[1] != TAB_VOID \
                               and self._ItemType in [MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT]:
             EdkLogger.error('Parser', FORMAT_INVALID, "The datum type '%s' of PCD is wrong" % ValueList[1],
                             ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
 
+        # Validate the VariableName of DynamicHii and DynamicExHii for PCD Entry must not be an empty string
+        if self._ItemType in [MODEL_PCD_DYNAMIC_HII, MODEL_PCD_DYNAMIC_EX_HII]:
+            DscPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
+            if len(DscPcdValueList[0].replace('L','').replace('"','').strip()) == 0:
+                EdkLogger.error('Parser', FORMAT_INVALID, "The VariableName field in the HII format PCD entry must not be an empty string",
+                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+
         # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0.
         DscPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
         if DscPcdValueList[0] in ['True', 'true', 'TRUE']:
             self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '1', 1);
         elif DscPcdValueList[0] in ['False', 'false', 'FALSE']:
-- 
2.6.1.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] BaseTools: report error HiiString in HII format PCD must not be empty
  2017-06-23  6:43 [Patch] BaseTools: report error HiiString in HII format PCD must not be empty Yonghong Zhu
@ 2017-06-23  6:52 ` Gao, Liming
  0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2017-06-23  6:52 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@lists.01.org

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Zhu, Yonghong
>Sent: Friday, June 23, 2017 2:44 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming <liming.gao@intel.com>
>Subject: [Patch] BaseTools: report error HiiString in HII format PCD must not
>be empty
>
>Add a check that HiiString field in the HII format PCD entry must not
>be an empty string.
>
>Cc: Liming Gao <liming.gao@intel.com>
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
>---
> BaseTools/Source/Python/Workspace/MetaFileParser.py | 7 +++++++
> 1 file changed, 7 insertions(+)
>
>diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py
>b/BaseTools/Source/Python/Workspace/MetaFileParser.py
>index d094403..4a5311a 100644
>--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
>+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
>@@ -1137,10 +1137,17 @@ class DscParser(MetaFileParser):
>         if len(ValueList) > 1 and ValueList[1] != TAB_VOID \
>                               and self._ItemType in [MODEL_PCD_DYNAMIC_DEFAULT,
>MODEL_PCD_DYNAMIC_EX_DEFAULT]:
>             EdkLogger.error('Parser', FORMAT_INVALID, "The datum type '%s' of
>PCD is wrong" % ValueList[1],
>                             ExtraData=self._CurrentLine, File=self.MetaFile,
>Line=self._LineIndex + 1)
>
>+        # Validate the VariableName of DynamicHii and DynamicExHii for PCD
>Entry must not be an empty string
>+        if self._ItemType in [MODEL_PCD_DYNAMIC_HII,
>MODEL_PCD_DYNAMIC_EX_HII]:
>+            DscPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
>+            if len(DscPcdValueList[0].replace('L','').replace('"','').strip()) == 0:
>+                EdkLogger.error('Parser', FORMAT_INVALID, "The VariableName
>field in the HII format PCD entry must not be an empty string",
>+                            ExtraData=self._CurrentLine, File=self.MetaFile,
>Line=self._LineIndex + 1)
>+
>         # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with
>integer 1 or 0.
>         DscPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
>         if DscPcdValueList[0] in ['True', 'true', 'TRUE']:
>             self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '1', 1);
>         elif DscPcdValueList[0] in ['False', 'false', 'FALSE']:
>--
>2.6.1.windows.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-23  6:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-23  6:43 [Patch] BaseTools: report error HiiString in HII format PCD must not be empty Yonghong Zhu
2017-06-23  6:52 ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox