* [PATCH] checkpatch: Remove obsolete period from "ambiguous SHA1" query
@ 2019-08-30 16:31 Sean Christopherson
2019-08-30 16:37 ` Joe Perches
0 siblings, 1 reply; 8+ messages in thread
From: Sean Christopherson @ 2019-08-30 16:31 UTC (permalink / raw)
To: Andy Whitcroft, Joe Perches; +Cc: linux-kernel
Git dropped the period from its "ambiguous SHA1" error message in commit
0c99171ad2 ("get_short_sha1: mark ambiguity error for translation"),
circa 2016. Drop the period from checkpatch's associated query so as to
match both the old and new error messages.
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 93a7edfe0f05..ef3642c53100 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -962,7 +962,7 @@ sub git_commit_info {
return ($id, $desc) if ($#lines < 0);
- if ($lines[0] =~ /^error: short SHA1 $commit is ambiguous\./) {
+ if ($lines[0] =~ /^error: short SHA1 $commit is ambiguous/) {
# Maybe one day convert this block of bash into something that returns
# all matching commit ids, but it's very slow...
#
--
2.22.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] checkpatch: Remove obsolete period from "ambiguous SHA1" query
2019-08-30 16:31 [PATCH] checkpatch: Remove obsolete period from "ambiguous SHA1" query Sean Christopherson
@ 2019-08-30 16:37 ` Joe Perches
2019-08-30 17:17 ` Sean Christopherson
0 siblings, 1 reply; 8+ messages in thread
From: Joe Perches @ 2019-08-30 16:37 UTC (permalink / raw)
To: Sean Christopherson, Andy Whitcroft, Andrew Morton; +Cc: linux-kernel
On Fri, 2019-08-30 at 09:31 -0700, Sean Christopherson wrote:
> Git dropped the period from its "ambiguous SHA1" error message in commit
> 0c99171ad2 ("get_short_sha1: mark ambiguity error for translation"),
> circa 2016. Drop the period from checkpatch's associated query so as to
> match both the old and new error messages.
>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> scripts/checkpatch.pl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 93a7edfe0f05..ef3642c53100 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -962,7 +962,7 @@ sub git_commit_info {
>
> return ($id, $desc) if ($#lines < 0);
>
> - if ($lines[0] =~ /^error: short SHA1 $commit is ambiguous\./) {
> + if ($lines[0] =~ /^error: short SHA1 $commit is ambiguous/) {
> # Maybe one day convert this block of bash into something that returns
> # all matching commit ids, but it's very slow...
> #
Thanks.
Did git ever change to actually support human readable
messages in multiple languages?
If so, this won't work for non-english output.
It probably doesn't matter though.
Acked-by: Joe Perches <joe@perches.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] checkpatch: Remove obsolete period from "ambiguous SHA1" query
2019-08-30 16:37 ` Joe Perches
@ 2019-08-30 17:17 ` Sean Christopherson
2019-08-30 18:01 ` Joe Perches
0 siblings, 1 reply; 8+ messages in thread
From: Sean Christopherson @ 2019-08-30 17:17 UTC (permalink / raw)
To: Joe Perches; +Cc: Andy Whitcroft, Andrew Morton, linux-kernel
On Fri, Aug 30, 2019 at 09:37:51AM -0700, Joe Perches wrote:
> On Fri, 2019-08-30 at 09:31 -0700, Sean Christopherson wrote:
> > Git dropped the period from its "ambiguous SHA1" error message in commit
> > 0c99171ad2 ("get_short_sha1: mark ambiguity error for translation"),
> > circa 2016. Drop the period from checkpatch's associated query so as to
> > match both the old and new error messages.
> >
> > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> > ---
> > scripts/checkpatch.pl | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 93a7edfe0f05..ef3642c53100 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -962,7 +962,7 @@ sub git_commit_info {
> >
> > return ($id, $desc) if ($#lines < 0);
> >
> > - if ($lines[0] =~ /^error: short SHA1 $commit is ambiguous\./) {
> > + if ($lines[0] =~ /^error: short SHA1 $commit is ambiguous/) {
> > # Maybe one day convert this block of bash into something that returns
> > # all matching commit ids, but it's very slow...
> > #
>
> Thanks.
>
> Did git ever change to actually support human readable
> messages in multiple languages?
Yep, e.g.:
error: Kurzer SHA-1 745f ist mehrdeutig.
> If so, this won't work for non-english output.
Yep again. The next check for 'fatal: ambiguous argument' obviously fails
as well and checkpatch ends up using git's error message as the id and
description.
ERROR: Please use git ... - ie: 'commit error: Kurze ("")'
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] checkpatch: Remove obsolete period from "ambiguous SHA1" query
2019-08-30 17:17 ` Sean Christopherson
@ 2019-08-30 18:01 ` Joe Perches
2019-08-30 18:29 ` Joe Perches
2019-09-03 16:08 ` [PATCH] checkpatch: Remove obsolete period from "ambiguous SHA1" query Sean Christopherson
0 siblings, 2 replies; 8+ messages in thread
From: Joe Perches @ 2019-08-30 18:01 UTC (permalink / raw)
To: Sean Christopherson; +Cc: Andy Whitcroft, Andrew Morton, linux-kernel
On Fri, 2019-08-30 at 10:17 -0700, Sean Christopherson wrote:
> On Fri, Aug 30, 2019 at 09:37:51AM -0700, Joe Perches wrote:
> > On Fri, 2019-08-30 at 09:31 -0700, Sean Christopherson wrote:
> > > Git dropped the period from its "ambiguous SHA1" error message in commit
> > > 0c99171ad2 ("get_short_sha1: mark ambiguity error for translation"),
> > > circa 2016. Drop the period from checkpatch's associated query so as to
> > > match both the old and new error messages.
> > >
> > > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> > > ---
> > > scripts/checkpatch.pl | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > index 93a7edfe0f05..ef3642c53100 100755
> > > --- a/scripts/checkpatch.pl
> > > +++ b/scripts/checkpatch.pl
> > > @@ -962,7 +962,7 @@ sub git_commit_info {
> > >
> > > return ($id, $desc) if ($#lines < 0);
> > >
> > > - if ($lines[0] =~ /^error: short SHA1 $commit is ambiguous\./) {
> > > + if ($lines[0] =~ /^error: short SHA1 $commit is ambiguous/) {
> > > # Maybe one day convert this block of bash into something that returns
> > > # all matching commit ids, but it's very slow...
> > > #
> >
> > Thanks.
> >
> > Did git ever change to actually support human readable
> > messages in multiple languages?
>
> Yep, e.g.:
>
> error: Kurzer SHA-1 745f ist mehrdeutig.
>
> > If so, this won't work for non-english output.
>
> Yep again. The next check for 'fatal: ambiguous argument' obviously fails
> as well and checkpatch ends up using git's error message as the id and
> description.
>
> ERROR: Please use git ... - ie: 'commit error: Kurze ("")'
Does git exit with unique failure codes?
If so, maybe the waitid/siginfo_t error could be used instead.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] checkpatch: Remove obsolete period from "ambiguous SHA1" query
2019-08-30 18:01 ` Joe Perches
@ 2019-08-30 18:29 ` Joe Perches
2019-09-01 19:29 ` [PATCH] checkpatch: Make git output use LANGUAGE=en_US.utf8 Joe Perches
2019-09-03 16:08 ` [PATCH] checkpatch: Remove obsolete period from "ambiguous SHA1" query Sean Christopherson
1 sibling, 1 reply; 8+ messages in thread
From: Joe Perches @ 2019-08-30 18:29 UTC (permalink / raw)
To: Sean Christopherson; +Cc: Andy Whitcroft, Andrew Morton, linux-kernel
On Fri, 2019-08-30 at 11:01 -0700, Joe Perches wrote:
> On Fri, 2019-08-30 at 10:17 -0700, Sean Christopherson wrote:
> > On Fri, Aug 30, 2019 at 09:37:51AM -0700, Joe Perches wrote:
> > > On Fri, 2019-08-30 at 09:31 -0700, Sean Christopherson wrote:
> > > > Git dropped the period from its "ambiguous SHA1" error message in commit
> > > > 0c99171ad2 ("get_short_sha1: mark ambiguity error for translation"),
> > > > circa 2016. Drop the period from checkpatch's associated query so as to
> > > > match both the old and new error messages.
> > > >
> > > > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> > > > ---
> > > > scripts/checkpatch.pl | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > > index 93a7edfe0f05..ef3642c53100 100755
> > > > --- a/scripts/checkpatch.pl
> > > > +++ b/scripts/checkpatch.pl
> > > > @@ -962,7 +962,7 @@ sub git_commit_info {
> > > >
> > > > return ($id, $desc) if ($#lines < 0);
> > > >
> > > > - if ($lines[0] =~ /^error: short SHA1 $commit is ambiguous\./) {
> > > > + if ($lines[0] =~ /^error: short SHA1 $commit is ambiguous/) {
> > > > # Maybe one day convert this block of bash into something that returns
> > > > # all matching commit ids, but it's very slow...
> > > > #
> > >
> > > Thanks.
> > >
> > > Did git ever change to actually support human readable
> > > messages in multiple languages?
> >
> > Yep, e.g.:
> >
> > error: Kurzer SHA-1 745f ist mehrdeutig.
> >
> > > If so, this won't work for non-english output.
> >
> > Yep again. The next check for 'fatal: ambiguous argument' obviously fails
> > as well and checkpatch ends up using git's error message as the id and
> > description.
> >
> > ERROR: Please use git ... - ie: 'commit error: Kurze ("")'
>
> Does git exit with unique failure codes?
> If so, maybe the waitid/siginfo_t error could be used instead.
>
Maybe something like this works?
---
scripts/checkpatch.pl | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f4b6127ff469..dc001b7899ed 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -62,6 +62,7 @@ my $conststructsfile = "$D/const_structs.checkpatch";
my $typedefsfile = "";
my $color = "auto";
my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE
+my $git_command ='export LANG=en_US.utf-8; git';
sub help {
my ($exitcode) = @_;
@@ -918,7 +919,7 @@ sub seed_camelcase_includes {
$camelcase_seeded = 1;
if (-e ".git") {
- my $git_last_include_commit = `git log --no-merges --pretty=format:"%h%n" -1 -- include`;
+ my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
chomp $git_last_include_commit;
$camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
} else {
@@ -946,7 +947,7 @@ sub seed_camelcase_includes {
}
if (-e ".git") {
- $files = `git ls-files "include/*.h"`;
+ $files = `${git_command} ls-files "include/*.h"`;
@include_files = split('\n', $files);
}
@@ -970,7 +971,7 @@ sub git_commit_info {
return ($id, $desc) if ((which("git") eq "") || !(-e ".git"));
- my $output = `git log --no-color --format='%H %s' -1 $commit 2>&1`;
+ my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`;
$output =~ s/^\s*//gm;
my @lines = split("\n", $output);
@@ -1020,7 +1021,7 @@ if ($git) {
} else {
$git_range = "-1 $commit_expr";
}
- my $lines = `git log --no-color --no-merges --pretty=format:'%H %s' $git_range`;
+ my $lines = `${git_command} log --no-color --no-merges --pretty=format:'%H %s' $git_range`;
foreach my $line (split(/\n/, $lines)) {
$line =~ /^([0-9a-fA-F]{40,40}) (.*)$/;
next if (!defined($1) || !defined($2));
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] checkpatch: Make git output use LANGUAGE=en_US.utf8
2019-08-30 18:29 ` Joe Perches
@ 2019-09-01 19:29 ` Joe Perches
2019-09-03 15:19 ` Sean Christopherson
0 siblings, 1 reply; 8+ messages in thread
From: Joe Perches @ 2019-09-01 19:29 UTC (permalink / raw)
To: Andrew Morton; +Cc: Andy Whitcroft, Sean Christopherson, linux-kernel
git output parsing depends on the language being en_US english.
Make the backtick execution of all `git <foo>` commands set the
LANGUAGE of the process to en_US.utf8 before executing the actual
command using `export LANGUAGE=en_US.utf8; git <foo>`.
Because the command is executed in a child process, the parent
LANGUAGE is unchanged.
Reported-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Joe Perches <joe@perches.com>
---
scripts/checkpatch.pl | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f4b6127ff469..113c017cc8e7 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -62,6 +62,8 @@ my $conststructsfile = "$D/const_structs.checkpatch";
my $typedefsfile = "";
my $color = "auto";
my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE
+# git output parsing needs US English output, so first set backtick child process LANGUAGE
+my $git_command ='export LANGUAGE=en_US.UTF-8; git';
sub help {
my ($exitcode) = @_;
@@ -918,7 +920,7 @@ sub seed_camelcase_includes {
$camelcase_seeded = 1;
if (-e ".git") {
- my $git_last_include_commit = `git log --no-merges --pretty=format:"%h%n" -1 -- include`;
+ my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
chomp $git_last_include_commit;
$camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
} else {
@@ -946,7 +948,7 @@ sub seed_camelcase_includes {
}
if (-e ".git") {
- $files = `git ls-files "include/*.h"`;
+ $files = `${git_command} ls-files "include/*.h"`;
@include_files = split('\n', $files);
}
@@ -970,7 +972,7 @@ sub git_commit_info {
return ($id, $desc) if ((which("git") eq "") || !(-e ".git"));
- my $output = `git log --no-color --format='%H %s' -1 $commit 2>&1`;
+ my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`;
$output =~ s/^\s*//gm;
my @lines = split("\n", $output);
@@ -1020,7 +1022,7 @@ if ($git) {
} else {
$git_range = "-1 $commit_expr";
}
- my $lines = `git log --no-color --no-merges --pretty=format:'%H %s' $git_range`;
+ my $lines = `${git_command} log --no-color --no-merges --pretty=format:'%H %s' $git_range`;
foreach my $line (split(/\n/, $lines)) {
$line =~ /^([0-9a-fA-F]{40,40}) (.*)$/;
next if (!defined($1) || !defined($2));
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] checkpatch: Make git output use LANGUAGE=en_US.utf8
2019-09-01 19:29 ` [PATCH] checkpatch: Make git output use LANGUAGE=en_US.utf8 Joe Perches
@ 2019-09-03 15:19 ` Sean Christopherson
0 siblings, 0 replies; 8+ messages in thread
From: Sean Christopherson @ 2019-09-03 15:19 UTC (permalink / raw)
To: Joe Perches; +Cc: Andrew Morton, Andy Whitcroft, linux-kernel
On Sun, Sep 01, 2019 at 12:29:25PM -0700, Joe Perches wrote:
> git output parsing depends on the language being en_US english.
>
> Make the backtick execution of all `git <foo>` commands set the
> LANGUAGE of the process to en_US.utf8 before executing the actual
> command using `export LANGUAGE=en_US.utf8; git <foo>`.
>
> Because the command is executed in a child process, the parent
> LANGUAGE is unchanged.
>
> Reported-by: Sean Christopherson <sean.j.christopherson@intel.com>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
Reviewed-and-tested-by: Sean Christopherson <sean.j.christopherson@intel.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] checkpatch: Remove obsolete period from "ambiguous SHA1" query
2019-08-30 18:01 ` Joe Perches
2019-08-30 18:29 ` Joe Perches
@ 2019-09-03 16:08 ` Sean Christopherson
1 sibling, 0 replies; 8+ messages in thread
From: Sean Christopherson @ 2019-09-03 16:08 UTC (permalink / raw)
To: Joe Perches; +Cc: Andy Whitcroft, Andrew Morton, linux-kernel
On Fri, Aug 30, 2019 at 11:01:29AM -0700, Joe Perches wrote:
> On Fri, 2019-08-30 at 10:17 -0700, Sean Christopherson wrote:
> > On Fri, Aug 30, 2019 at 09:37:51AM -0700, Joe Perches wrote:
> > > On Fri, 2019-08-30 at 09:31 -0700, Sean Christopherson wrote:
> > > > Git dropped the period from its "ambiguous SHA1" error message in commit
> > > > 0c99171ad2 ("get_short_sha1: mark ambiguity error for translation"),
> > > > circa 2016. Drop the period from checkpatch's associated query so as to
> > > > match both the old and new error messages.
> > > >
> > > > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> > > > ---
> > > > scripts/checkpatch.pl | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > > index 93a7edfe0f05..ef3642c53100 100755
> > > > --- a/scripts/checkpatch.pl
> > > > +++ b/scripts/checkpatch.pl
> > > > @@ -962,7 +962,7 @@ sub git_commit_info {
> > > >
> > > > return ($id, $desc) if ($#lines < 0);
> > > >
> > > > - if ($lines[0] =~ /^error: short SHA1 $commit is ambiguous\./) {
> > > > + if ($lines[0] =~ /^error: short SHA1 $commit is ambiguous/) {
> > > > # Maybe one day convert this block of bash into something that returns
> > > > # all matching commit ids, but it's very slow...
> > > > #
> > >
> > > Thanks.
> > >
> > > Did git ever change to actually support human readable
> > > messages in multiple languages?
> >
> > Yep, e.g.:
> >
> > error: Kurzer SHA-1 745f ist mehrdeutig.
> >
> > > If so, this won't work for non-english output.
> >
> > Yep again. The next check for 'fatal: ambiguous argument' obviously fails
> > as well and checkpatch ends up using git's error message as the id and
> > description.
> >
> > ERROR: Please use git ... - ie: 'commit error: Kurze ("")'
>
> Does git exit with unique failure codes?
Nope, AFAICT usage errors get exit(129) and everything else gets exit(128).
> If so, maybe the waitid/siginfo_t error could be used instead.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-09-03 16:08 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-30 16:31 [PATCH] checkpatch: Remove obsolete period from "ambiguous SHA1" query Sean Christopherson
2019-08-30 16:37 ` Joe Perches
2019-08-30 17:17 ` Sean Christopherson
2019-08-30 18:01 ` Joe Perches
2019-08-30 18:29 ` Joe Perches
2019-09-01 19:29 ` [PATCH] checkpatch: Make git output use LANGUAGE=en_US.utf8 Joe Perches
2019-09-03 15:19 ` Sean Christopherson
2019-09-03 16:08 ` [PATCH] checkpatch: Remove obsolete period from "ambiguous SHA1" query Sean Christopherson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).