[libav-devel] [PATCH] fate: Make oneline comparison ignore CR

Alex Converse alex.converse at gmail.com
Tue May 8 01:52:25 CEST 2012


On Mon, May 7, 2012 at 4:32 PM, Måns Rullgård <mans at mansr.com> wrote:
> Alex Converse <alex.converse at gmail.com> writes:
>
>> ---
>>  tests/fate-run.sh |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/tests/fate-run.sh b/tests/fate-run.sh
>> index a45e9a9..2522a21 100755
>> --- a/tests/fate-run.sh
>> +++ b/tests/fate-run.sh
>> @@ -61,7 +61,7 @@ stddev(){
>>  }
>>
>>  oneline(){
>> -    val=$(cat "$2")
>> +    val=$(cat "$2" | tr -d '\r')
>>      test x"$val" = x"$1" || { r=$?; printf -- '-%s\n+%s\n' "$ref" "$val"; }
>>      return ${r:-0}
>>  }
>> --
>> 1.7.7.3
>>
>> Fixes tests on mingw-w64. Feel free to suggest other approaches.
>
> Fix mingw.  This is not a compliant shell.
>

The code doesn't run on a MinGW shell, fate-run.sh runs on dash on
Linux, avprobe runs under wine.

> Quoting POSIX:
>
>  [Base Definitions] 3.238 Newline Character (<newline>)
>
>  A character that in the output stream indicates that printing should
>  start at the beginning of the next line. It is the character
>  designated by '\n' in the C language. It is unspecified whether this
>  character is the exact sequence transmitted to an output device by the
>  system to accomplish the movement to the next line.
>
>  [...]
>
>  [Shell & Utilities] 2.6.3 Command Substitution
>
>  [...] The shell shall expand the command substitution by executing
>  command in a subshell environment (see Shell Execution Environment)
>  and replacing the command substitution (the text of command plus the
>  enclosing "$()" or backquotes) with the standard output of the
>  command, removing sequences of one or more <newline> characters at the
>  end of the substitution.
>
> It is clear from this that command substitution should strip from the
> command whatever '\n' in C translates to on the platform.
>
> Our policy is to not work around OS bugs in ugly ways.
>

I don't think this ideological purity does our users any good.


More information about the libav-devel mailing list