* [PATCH v1 1/1] PatchCheck - add error message for invalid parameter
[not found] <cover.1533252046.git.jaben.carsey@intel.com>
@ 2018-08-02 23:21 ` Jaben Carsey
2018-08-03 9:44 ` Gao, Liming
0 siblings, 1 reply; 5+ messages in thread
From: Jaben Carsey @ 2018-08-02 23:21 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu
Currently if an invalid parameter is passed, it gives a stack trace.
This changes it to an error message.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
BaseTools/Scripts/PatchCheck.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 7b7fba8b7044..96b3cdf1fd8a 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -1,7 +1,7 @@
## @file
# Check a patch for various format issues
#
-# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made
# available under the terms and conditions of the BSD License which
@@ -528,6 +528,8 @@ class CheckGitCommits:
print('Checking git commit:', commit)
patch = self.read_patch_from_git(commit)
self.ok &= CheckOnePatch(commit, patch).ok
+ if not commits:
+ print("Couldn't find commit matching: '{}'".format(rev_spec))
def read_commit_list_from_git(self, rev_spec, max_count):
# Run git to get the commit patch
@@ -536,7 +538,7 @@ class CheckGitCommits:
cmd.append('--max-count=' + str(max_count))
cmd.append(rev_spec)
out = self.run_git(*cmd)
- return out.split()
+ return out.split() if out else []
def read_patch_from_git(self, commit):
# Run git to get the commit patch
@@ -548,7 +550,8 @@ class CheckGitCommits:
p = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
- return p.communicate()[0].decode('utf-8', 'ignore')
+ Result = p.communicate()
+ return Result[0].decode('utf-8', 'ignore') if Result[0] and Result[0].find("fatal")!=0 else None
class CheckOnePatchFile:
"""Performs a patch check for a single file.
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] PatchCheck - add error message for invalid parameter
2018-08-02 23:21 ` [PATCH v1 1/1] PatchCheck - add error message for invalid parameter Jaben Carsey
@ 2018-08-03 9:44 ` Gao, Liming
2018-08-03 15:06 ` Carsey, Jaben
0 siblings, 1 reply; 5+ messages in thread
From: Gao, Liming @ 2018-08-03 9:44 UTC (permalink / raw)
To: Carsey, Jaben, edk2-devel@lists.01.org
Jaben:
Could you give me one failure case? Then, I can further understand the patch.
Thanks
Liming
>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>Jaben Carsey
>Sent: Friday, August 03, 2018 7:21 AM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming <liming.gao@intel.com>
>Subject: [edk2] [PATCH v1 1/1] PatchCheck - add error message for invalid
>parameter
>
>Currently if an invalid parameter is passed, it gives a stack trace.
>This changes it to an error message.
>
>Cc: Liming Gao <liming.gao@intel.com>
>Cc: Yonghong Zhu <yonghong.zhu@intel.com>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
>---
> BaseTools/Scripts/PatchCheck.py | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
>diff --git a/BaseTools/Scripts/PatchCheck.py
>b/BaseTools/Scripts/PatchCheck.py
>index 7b7fba8b7044..96b3cdf1fd8a 100755
>--- a/BaseTools/Scripts/PatchCheck.py
>+++ b/BaseTools/Scripts/PatchCheck.py
>@@ -1,7 +1,7 @@
> ## @file
> # Check a patch for various format issues
> #
>-# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
>+# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
> #
> # This program and the accompanying materials are licensed and made
> # available under the terms and conditions of the BSD License which
>@@ -528,6 +528,8 @@ class CheckGitCommits:
> print('Checking git commit:', commit)
> patch = self.read_patch_from_git(commit)
> self.ok &= CheckOnePatch(commit, patch).ok
>+ if not commits:
>+ print("Couldn't find commit matching: '{}'".format(rev_spec))
>
> def read_commit_list_from_git(self, rev_spec, max_count):
> # Run git to get the commit patch
>@@ -536,7 +538,7 @@ class CheckGitCommits:
> cmd.append('--max-count=' + str(max_count))
> cmd.append(rev_spec)
> out = self.run_git(*cmd)
>- return out.split()
>+ return out.split() if out else []
>
> def read_patch_from_git(self, commit):
> # Run git to get the commit patch
>@@ -548,7 +550,8 @@ class CheckGitCommits:
> p = subprocess.Popen(cmd,
> stdout=subprocess.PIPE,
> stderr=subprocess.STDOUT)
>- return p.communicate()[0].decode('utf-8', 'ignore')
>+ Result = p.communicate()
>+ return Result[0].decode('utf-8', 'ignore') if Result[0] and
>Result[0].find("fatal")!=0 else None
>
> class CheckOnePatchFile:
> """Performs a patch check for a single file.
>--
>2.16.2.windows.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] PatchCheck - add error message for invalid parameter
2018-08-03 9:44 ` Gao, Liming
@ 2018-08-03 15:06 ` Carsey, Jaben
2018-08-08 1:28 ` Gao, Liming
2018-08-08 3:39 ` Zhu, Yonghong
0 siblings, 2 replies; 5+ messages in thread
From: Carsey, Jaben @ 2018-08-03 15:06 UTC (permalink / raw)
To: Gao, Liming, edk2-devel@lists.01.org
Absolutely. I should have thought to add that.
"Python ScriptCheck.py t"
Assuming there is no commit or file called "t". Basically just anything that is not a commit identifier nor a filename. I found it when I tried to select a commit and misspelled it.
-Jaben
> -----Original Message-----
> From: Gao, Liming
> Sent: Friday, August 03, 2018 2:44 AM
> To: Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org
> Subject: RE: [edk2] [PATCH v1 1/1] PatchCheck - add error message for
> invalid parameter
> Importance: High
>
> Jaben:
> Could you give me one failure case? Then, I can further understand the
> patch.
>
> Thanks
> Liming
> >-----Original Message-----
> >From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> >Jaben Carsey
> >Sent: Friday, August 03, 2018 7:21 AM
> >To: edk2-devel@lists.01.org
> >Cc: Gao, Liming <liming.gao@intel.com>
> >Subject: [edk2] [PATCH v1 1/1] PatchCheck - add error message for invalid
> >parameter
> >
> >Currently if an invalid parameter is passed, it gives a stack trace.
> >This changes it to an error message.
> >
> >Cc: Liming Gao <liming.gao@intel.com>
> >Cc: Yonghong Zhu <yonghong.zhu@intel.com>
> >Contributed-under: TianoCore Contribution Agreement 1.1
> >Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
> >---
> > BaseTools/Scripts/PatchCheck.py | 9 ++++++---
> > 1 file changed, 6 insertions(+), 3 deletions(-)
> >
> >diff --git a/BaseTools/Scripts/PatchCheck.py
> >b/BaseTools/Scripts/PatchCheck.py
> >index 7b7fba8b7044..96b3cdf1fd8a 100755
> >--- a/BaseTools/Scripts/PatchCheck.py
> >+++ b/BaseTools/Scripts/PatchCheck.py
> >@@ -1,7 +1,7 @@
> > ## @file
> > # Check a patch for various format issues
> > #
> >-# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
> >+# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
> > #
> > # This program and the accompanying materials are licensed and made
> > # available under the terms and conditions of the BSD License which
> >@@ -528,6 +528,8 @@ class CheckGitCommits:
> > print('Checking git commit:', commit)
> > patch = self.read_patch_from_git(commit)
> > self.ok &= CheckOnePatch(commit, patch).ok
> >+ if not commits:
> >+ print("Couldn't find commit matching: '{}'".format(rev_spec))
> >
> > def read_commit_list_from_git(self, rev_spec, max_count):
> > # Run git to get the commit patch
> >@@ -536,7 +538,7 @@ class CheckGitCommits:
> > cmd.append('--max-count=' + str(max_count))
> > cmd.append(rev_spec)
> > out = self.run_git(*cmd)
> >- return out.split()
> >+ return out.split() if out else []
> >
> > def read_patch_from_git(self, commit):
> > # Run git to get the commit patch
> >@@ -548,7 +550,8 @@ class CheckGitCommits:
> > p = subprocess.Popen(cmd,
> > stdout=subprocess.PIPE,
> > stderr=subprocess.STDOUT)
> >- return p.communicate()[0].decode('utf-8', 'ignore')
> >+ Result = p.communicate()
> >+ return Result[0].decode('utf-8', 'ignore') if Result[0] and
> >Result[0].find("fatal")!=0 else None
> >
> > class CheckOnePatchFile:
> > """Performs a patch check for a single file.
> >--
> >2.16.2.windows.1
> >
> >_______________________________________________
> >edk2-devel mailing list
> >edk2-devel@lists.01.org
> >https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] PatchCheck - add error message for invalid parameter
2018-08-03 15:06 ` Carsey, Jaben
@ 2018-08-08 1:28 ` Gao, Liming
2018-08-08 3:39 ` Zhu, Yonghong
1 sibling, 0 replies; 5+ messages in thread
From: Gao, Liming @ 2018-08-08 1:28 UTC (permalink / raw)
To: Carsey, Jaben, edk2-devel@lists.01.org
Jaben:
I verify this case. Your patch fixes it.
Tested-by: Liming Gao <liming.gao@intel.com>
Thanks
Liming
>-----Original Message-----
>From: Carsey, Jaben
>Sent: Friday, August 03, 2018 11:07 PM
>To: Gao, Liming <liming.gao@intel.com>; edk2-devel@lists.01.org
>Subject: RE: [edk2] [PATCH v1 1/1] PatchCheck - add error message for invalid
>parameter
>
>Absolutely. I should have thought to add that.
>
>"Python ScriptCheck.py t"
>
>Assuming there is no commit or file called "t". Basically just anything that is
>not a commit identifier nor a filename. I found it when I tried to select a
>commit and misspelled it.
>
>-Jaben
>
>> -----Original Message-----
>> From: Gao, Liming
>> Sent: Friday, August 03, 2018 2:44 AM
>> To: Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org
>> Subject: RE: [edk2] [PATCH v1 1/1] PatchCheck - add error message for
>> invalid parameter
>> Importance: High
>>
>> Jaben:
>> Could you give me one failure case? Then, I can further understand the
>> patch.
>>
>> Thanks
>> Liming
>> >-----Original Message-----
>> >From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> >Jaben Carsey
>> >Sent: Friday, August 03, 2018 7:21 AM
>> >To: edk2-devel@lists.01.org
>> >Cc: Gao, Liming <liming.gao@intel.com>
>> >Subject: [edk2] [PATCH v1 1/1] PatchCheck - add error message for invalid
>> >parameter
>> >
>> >Currently if an invalid parameter is passed, it gives a stack trace.
>> >This changes it to an error message.
>> >
>> >Cc: Liming Gao <liming.gao@intel.com>
>> >Cc: Yonghong Zhu <yonghong.zhu@intel.com>
>> >Contributed-under: TianoCore Contribution Agreement 1.1
>> >Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
>> >---
>> > BaseTools/Scripts/PatchCheck.py | 9 ++++++---
>> > 1 file changed, 6 insertions(+), 3 deletions(-)
>> >
>> >diff --git a/BaseTools/Scripts/PatchCheck.py
>> >b/BaseTools/Scripts/PatchCheck.py
>> >index 7b7fba8b7044..96b3cdf1fd8a 100755
>> >--- a/BaseTools/Scripts/PatchCheck.py
>> >+++ b/BaseTools/Scripts/PatchCheck.py
>> >@@ -1,7 +1,7 @@
>> > ## @file
>> > # Check a patch for various format issues
>> > #
>> >-# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
>> >+# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
>> > #
>> > # This program and the accompanying materials are licensed and made
>> > # available under the terms and conditions of the BSD License which
>> >@@ -528,6 +528,8 @@ class CheckGitCommits:
>> > print('Checking git commit:', commit)
>> > patch = self.read_patch_from_git(commit)
>> > self.ok &= CheckOnePatch(commit, patch).ok
>> >+ if not commits:
>> >+ print("Couldn't find commit matching: '{}'".format(rev_spec))
>> >
>> > def read_commit_list_from_git(self, rev_spec, max_count):
>> > # Run git to get the commit patch
>> >@@ -536,7 +538,7 @@ class CheckGitCommits:
>> > cmd.append('--max-count=' + str(max_count))
>> > cmd.append(rev_spec)
>> > out = self.run_git(*cmd)
>> >- return out.split()
>> >+ return out.split() if out else []
>> >
>> > def read_patch_from_git(self, commit):
>> > # Run git to get the commit patch
>> >@@ -548,7 +550,8 @@ class CheckGitCommits:
>> > p = subprocess.Popen(cmd,
>> > stdout=subprocess.PIPE,
>> > stderr=subprocess.STDOUT)
>> >- return p.communicate()[0].decode('utf-8', 'ignore')
>> >+ Result = p.communicate()
>> >+ return Result[0].decode('utf-8', 'ignore') if Result[0] and
>> >Result[0].find("fatal")!=0 else None
>> >
>> > class CheckOnePatchFile:
>> > """Performs a patch check for a single file.
>> >--
>> >2.16.2.windows.1
>> >
>> >_______________________________________________
>> >edk2-devel mailing list
>> >edk2-devel@lists.01.org
>> >https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] PatchCheck - add error message for invalid parameter
2018-08-03 15:06 ` Carsey, Jaben
2018-08-08 1:28 ` Gao, Liming
@ 2018-08-08 3:39 ` Zhu, Yonghong
1 sibling, 0 replies; 5+ messages in thread
From: Zhu, Yonghong @ 2018-08-08 3:39 UTC (permalink / raw)
To: Carsey, Jaben, Gao, Liming, edk2-devel@lists.01.org
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 Carsey, Jaben
Sent: Friday, August 03, 2018 11:07 PM
To: Gao, Liming <liming.gao@intel.com>; edk2-devel@lists.01.org
Subject: Re: [edk2] [PATCH v1 1/1] PatchCheck - add error message for invalid parameter
Absolutely. I should have thought to add that.
"Python ScriptCheck.py t"
Assuming there is no commit or file called "t". Basically just anything that is not a commit identifier nor a filename. I found it when I tried to select a commit and misspelled it.
-Jaben
> -----Original Message-----
> From: Gao, Liming
> Sent: Friday, August 03, 2018 2:44 AM
> To: Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org
> Subject: RE: [edk2] [PATCH v1 1/1] PatchCheck - add error message for
> invalid parameter
> Importance: High
>
> Jaben:
> Could you give me one failure case? Then, I can further understand
> the patch.
>
> Thanks
> Liming
> >-----Original Message-----
> >From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf
> >Of Jaben Carsey
> >Sent: Friday, August 03, 2018 7:21 AM
> >To: edk2-devel@lists.01.org
> >Cc: Gao, Liming <liming.gao@intel.com>
> >Subject: [edk2] [PATCH v1 1/1] PatchCheck - add error message for
> >invalid parameter
> >
> >Currently if an invalid parameter is passed, it gives a stack trace.
> >This changes it to an error message.
> >
> >Cc: Liming Gao <liming.gao@intel.com>
> >Cc: Yonghong Zhu <yonghong.zhu@intel.com>
> >Contributed-under: TianoCore Contribution Agreement 1.1
> >Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
> >---
> > BaseTools/Scripts/PatchCheck.py | 9 ++++++---
> > 1 file changed, 6 insertions(+), 3 deletions(-)
> >
> >diff --git a/BaseTools/Scripts/PatchCheck.py
> >b/BaseTools/Scripts/PatchCheck.py
> >index 7b7fba8b7044..96b3cdf1fd8a 100755
> >--- a/BaseTools/Scripts/PatchCheck.py
> >+++ b/BaseTools/Scripts/PatchCheck.py
> >@@ -1,7 +1,7 @@
> > ## @file
> > # Check a patch for various format issues # -# Copyright (c) 2015
> >- 2017, Intel Corporation. All rights reserved.<BR>
> >+# Copyright (c) 2015 - 2018, Intel Corporation. All rights
> >+reserved.<BR>
> > #
> > # This program and the accompanying materials are licensed and made
> ># available under the terms and conditions of the BSD License which
> >@@ -528,6 +528,8 @@ class CheckGitCommits:
> > print('Checking git commit:', commit)
> > patch = self.read_patch_from_git(commit)
> > self.ok &= CheckOnePatch(commit, patch).ok
> >+ if not commits:
> >+ print("Couldn't find commit matching:
> >+ '{}'".format(rev_spec))
> >
> > def read_commit_list_from_git(self, rev_spec, max_count):
> > # Run git to get the commit patch @@ -536,7 +538,7 @@ class
> >CheckGitCommits:
> > cmd.append('--max-count=' + str(max_count))
> > cmd.append(rev_spec)
> > out = self.run_git(*cmd)
> >- return out.split()
> >+ return out.split() if out else []
> >
> > def read_patch_from_git(self, commit):
> > # Run git to get the commit patch @@ -548,7 +550,8 @@ class
> >CheckGitCommits:
> > p = subprocess.Popen(cmd,
> > stdout=subprocess.PIPE,
> > stderr=subprocess.STDOUT)
> >- return p.communicate()[0].decode('utf-8', 'ignore')
> >+ Result = p.communicate()
> >+ return Result[0].decode('utf-8', 'ignore') if Result[0] and
> >Result[0].find("fatal")!=0 else None
> >
> > class CheckOnePatchFile:
> > """Performs a patch check for a single file.
> >--
> >2.16.2.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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-08-08 3:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1533252046.git.jaben.carsey@intel.com>
2018-08-02 23:21 ` [PATCH v1 1/1] PatchCheck - add error message for invalid parameter Jaben Carsey
2018-08-03 9:44 ` Gao, Liming
2018-08-03 15:06 ` Carsey, Jaben
2018-08-08 1:28 ` Gao, Liming
2018-08-08 3:39 ` Zhu, Yonghong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox