File: strip-trailing-cr

package info (click to toggle)
diffutils 1%3A3.10-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,784 kB
  • sloc: ansic: 90,222; sh: 11,672; perl: 450; makefile: 225; sed: 16
file content (25 lines) | stat: -rwxr-xr-x 593 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
# Before diff-3.7, this would provoke a UMR

. "${srcdir=.}/init.sh"; path_prepend_ ../src

fail=0

require_valgrind_

printf '\r' > r || framework_failure_
echo b > b || framework_failure_

# Use valgrind only when no Sanitizer is in use:
ASAN_OPTIONS=help=true diff --help 2>&1 |grep Sanitizer > /dev/null \
  && eval 'valgrind() { "$@"; }' \
  || eval 'valgrind() { env valgrind --quiet --error-exitcode=3 "$@"; }'

for opt in '' u c Dfoo; do
  returns_ 1 valgrind \
    diff -a$opt --strip-trailing-cr r b > out 2> err || fail=1
done

compare /dev/null err || fail=1

Exit $fail