On (05/10/15 16:49), Nikolai Kondrashov wrote:
>On 10/05/2015 04:38 PM, Lukas Slebodnik wrote:
>>On (05/10/15 15:59), Nikolai Kondrashov wrote:
>>>Hi everyone,
>>>
>>>The attached patch fixes the issue of whitespace_test failing when no 
>>>trailing
>>>whitespace was detected at all.
>>>
>>I do not understand the explanation.
>
>Sorry, if I wasn't clear.
>
>>Trailing whitespaces are not detected with unchaged file po/ca.po either.
>
>The trailing whitespace is there in the unchanged "po/ca.po" file. I.e. there
>*is* trailing whitespace in the source tree. However, we chose to ignore it.
>It is detected by "git grep" but suppressed by AWK, in whitespace_test.
>
>With updated "po/ca.po" the trailing whitespace is removed. As a consequence,
>there is no more trailing whitespace in the whole source tree and "git grep"
>returns 1, as it hasn't found anything. That makes whitespace_test quit with
>status 1, failing the test.
>
>The patch makes whitespace_test ignore exit status 1 from "git grep" (but
>still abort on other error codes), AWK happily processes empty output and all
>is fine.
>
I was not able to find anything about return codes in the man "git grep"
but it seems that it's related to /usr/bin/grep

man grep says:
EXIT STATUS
       Normally the exit status is 0 if a line is selected, 1 if no lines were
       selected, and 2 if an error occurred.  However, if the -q or --quiet or
       --silent  is  used and a line is selected, the exit status is 0 even if
       an error occurred.

Patch work as expected. It was tested with:
* trainling spaces in ignored files
* without trailing spaces in git
* with trailing spaces in C code.

It would be good to update either commit message or add comment to the code
about this behaviour. So we would not wonder in future why there is 1.

LS
_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to