RFR: CODETOOLS-7901088 webrev -f does not work on nawk
Daniel Fuchs
daniel.fuchs at oracle.com
Fri Nov 7 09:40:14 UTC 2014
Hi Magnus,
Thanks for finding the issue!
I see the same mistake in the function 'outgoing_from_mercurial_forest'
and twice again in the function fstatus - so it seems there are a few
other places to modify:
-----------------------------
diff --git a/webrev.ksh b/webrev.ksh
--- a/webrev.ksh
+++ b/webrev.ksh
@@ -1306,7 +1306,7 @@ function outgoing_from_mercurial_forest
/^comparing/ {next}
/^no changes/ {next}
/^searching/ {next}
- /^\[.*\]:$/ {tree=substr($1,length(hgroot)+3);
tree=substr(tree,0,length(tree)-2);
+ /^\[.*\]:$/ {tree=substr($1,length(hgroot)+3);
tree=substr(tree,1,length(tree)-2);
if (tree == "") { tree="."; }
trees[ntree++] = tree;
revs[tree]=-1;
@@ -1420,7 +1420,7 @@ function fstatus
# the AWK code which still tries to handle both cases
#
hg tstatus -mdn $FSTAT_OPT 2>/dev/null | $FILTER | $AWK -v
"hgroot=$hgroot" '
- /^\[.*\]:$/ {tree=substr($1,length(hgroot)+3);
tree=substr(tree,0,length(tree)-2); next}
+ /^\[.*\]:$/ {tree=substr($1,length(hgroot)+3);
tree=substr(tree,1,length(tree)-2); next}
$1 != "" {n=index($1,tree);
if (n != 1)
{ printf("%s/%s\n",tree,$1)}
@@ -1464,7 +1464,7 @@ function fstatus
#
hg tstatus -aC $FSTAT_OPT 2>/dev/null | $FILTER | $AWK -v
"hgroot=$hgroot" '
- /^\[.*\]:$/ {tree=substr($1,length(hgroot)+3);
tree=substr(tree,0,length(tree)-2); next}
+ /^\[.*\]:$/ {tree=substr($1,length(hgroot)+3);
tree=substr(tree,1,length(tree)-2); next}
/^A .*/ {n=index($2,tree);
if (n != 1)
{ printf("A %s/%s\n",tree,$2)}
@@ -1504,7 +1504,7 @@ function fstatus
done
done
hg tstatus -rn $FSTAT_OPT 2>/dev/null | $FILTER | $AWK -v
"hgroot=$hgroot" '
- /^\[.*\]:$/ {tree=substr($1,length(hgroot)+3);
tree=substr(tree,0,length(tree)-2); next}
+ /^\[.*\]:$/ {tree=substr($1,length(hgroot)+3);
tree=substr(tree,1,length(tree)-2); next}
$1 != "" {n=index($1,tree);
if (n != 1)
{ printf("%s/%s\n",tree,$1)}
-----------------------------
The machine I am currently on doesn't work well with trees
(it has an old Mercurial) - I will test your patch in a few moments
on a more recent system and will let you know the result!
best regards,
-- daniel
On 11/7/14 8:43 AM, Magnus Ihse Bursie wrote:
> Webrev -f does not work when using nawk, due to an incorrect substr
> based on 0 instead of 1 as index to the first position. (See prior
> discussion on webrev-dev).
>
> Bug: https://bugs.openjdk.java.net/browse/CODETOOLS-7901088
> Patch inline:
>
> diff --git a/webrev.ksh b/webrev.ksh
> --- a/webrev.ksh
> +++ b/webrev.ksh
> @@ -1420,7 +1420,7 @@
> # the AWK code which still tries to handle both cases
> #
> hg tstatus -mdn $FSTAT_OPT 2>/dev/null | $FILTER | $AWK -v
> "hgroot=$hgroot" '
> - /^\[.*\]:$/ {tree=substr($1,length(hgroot)+3);
> tree=substr(tree,0,length(tree)-2); next}
> + /^\[.*\]:$/ {tree=substr($1,length(hgroot)+3);
> tree=substr(tree,1,length(tree)-2); next}
> $1 != "" {n=index($1,tree);
> if (n != 1)
> { printf("%s/%s\n",tree,$1)}
>
> /Magnus
>
More information about the code-tools-dev
mailing list