Skip to contentSkip to conversation

xfstests: 219: fix awk filter for duplicate users

PATCH Alex Elder 3 participants 4 messages Feb 3, 2010

lore
Share & tools
lore

Alex Elder

author
#0 lore raw

The filter I added for removing duplicate users from the output of repquota didn't do the job very well. This fixes that, making it so the first time a user is seen its line is printed, not thereafter.

---
 219 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
219 +0 -0
Index: b/219
===================================================================
@@ -86,7 +86,7 @@ test_accounting()
        done
 
        repquota -$type -s -n $SCRATCH_MNT  | grep -v "^#0" |

filter_scratch |
- awk '/^#/ { if (! seen[$1]) { seen[$1]++; next; } } { print }'
+ awk '/^#/ { if (seen[$1]) next; seen[$1]++; } } { print; }'
}

 # real QA test starts here

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw
Quoted 20 lines · Alex Elder

The filter I added for removing duplicate users from the output of repquota didn't do the job very well. This fixes that, making it so the first time a user is seen its line is printed, not thereafter.

---
 219 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/219
===================================================================

219 +0 -0
@@ -86,7 +86,7 @@ test_accounting()
        done
 
        repquota -$type -s -n $SCRATCH_MNT  | grep -v "^#0" |

filter_scratch |

219

Quoted 3 lines
219 +1 -1
-       awk '/^#/ { if (! seen[$1]) { seen[$1]++; next; } } { print }'
+       awk '/^#/ { if (seen[$1]) next; seen[$1]++; } } { print; }'
 }

+awk: /^#/ { if (seen[$1]) next; seen[$1]++; } } { print; }
+awk: ^ syntax error

but thanks for making me feel better ;)

w/o the extra "}" it works for me.

(incidentally is a line continuation " \ " needed too? I guess it works without...)

-Eric

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by
#2 lore raw
In reply to Alex Elder
Quoted 20 lines · Alex Elder

The filter I added for removing duplicate users from the output of repquota didn't do the job very well. This fixes that, making it so the first time a user is seen its line is printed, not thereafter.

---
 219 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/219
===================================================================

219 +0 -0
@@ -86,7 +86,7 @@ test_accounting()
        done
 
        repquota -$type -s -n $SCRATCH_MNT  | grep -v "^#0" |

filter_scratch |

219

Quoted 2 lines
219 +1 -1
-       awk '/^#/ { if (! seen[$1]) { seen[$1]++; next; } } { print }'
+       awk '/^#/ { if (seen[$1]) next; seen[$1]++; } } { print; }'

The patch seems whitespace damages, and there's a "}" too many in the added line. After fixing that up 219 passes again for me.

So more or less:

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

author
#3 lore raw
Quoted 27 lines · Christoph Hellwig
Quoted 20 lines · Alex Elder

The filter I added for removing duplicate users from the output of repquota didn't do the job very well. This fixes that, making it so the first time a user is seen its line is printed, not thereafter.

---
 219 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/219
===================================================================

219 +0 -0
@@ -86,7 +86,7 @@ test_accounting()
        done
 
        repquota -$type -s -n $SCRATCH_MNT  | grep -v "^#0" |

filter_scratch |

219

Quoted 2 lines
219 +1 -1
-       awk '/^#/ { if (! seen[$1]) { seen[$1]++; next; } } { print }'
+       awk '/^#/ { if (seen[$1]) next; seen[$1]++; } } { print; }'

The patch seems whitespace damages, and there's a "}" too many in the added line. After fixing that up 219 passes again for me.

Quoted 4 lines

So more or less:

I copy and pasted the wrong thing into my e-mail. Sorry about that. I will fix both the white space and the curly brace before commit. Thanks for the review.

-Alex

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs