This file is indexed.

/usr/share/cvs/contrib/debug_check_log is in cvs 2:1.12.13+real-15.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#!/bin/sh

# Copyright (C) 2000-2005 The Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

#
# This program is intended to take a check.log file generated by a failed run of
# sanity.sh as input and run expr line by line on it.  It seems a much easier
# way of spotting a single failed line in a 100 line test result.
#

#
# Contributed by Derek R. Price <derek.price@openavenue.com>
#



usage ()
{
	echo "\
usage: $0 [-afh] [file...]

       -a          process alternate pattern
       -f          process first pattern (default)
       -h          print this text

     file          files to process (default = check.log)"
}

# Do a line by line match with expr
#
# INPUTS
#    $1 = text file name
#    $2 = pattern file name
expr_line_by_line ()
{
	dcl_line=0
	dcl_wrong=
	# We are assuming a newline at the end of the file.  The way sanity.sh
	# uses echo to create the log message guarantees this newline and since
	# expr ignores the last newline when the anchor is present anyhow, no
	# information is being lost in the transition
	while test $dcl_line -lt `wc -l <$1` -a $dcl_line -lt `wc -l <$2`; do
		dcl_line=`expr $dcl_line + 1`
		if test `sed -ne${dcl_line}p <$1 |wc -c` -eq 1 \
				-a `sed -ne${dcl_line}p <$2 |wc -c` -eq 1; then
			# This is a workaround for what I am calling a bug in GNU
			# expr - it won't match the empty string to the empty
			# string.  In this case the assumption is that a single
			# character is always a newline.  Since we already checked
			# for the end of the file, we know sed will echo the
			# newline.
			: 
		elif expr "`sed -ne${dcl_line}p <$1`" : \
				"`sed -ne${dcl_line}p <$2`\$" >/dev/null; then
			:
		else
			echo "$dcl_line: `sed -ne${dcl_line}p <$1`"
			echo "$dcl_line: `sed -ne${dcl_line}p <$2`\$"
			dcl_wrong="$dcl_wrong $dcl_line"
		fi
	done
	if test `wc -l <$1` -ne `wc -l <$2`; then
		echo "output & pattern contain differing number of lines"
	elif test -z "$dcl_wrong"; then
		echo "no mismatched lines"
	else
		echo "mismatched lines: $dcl_wrong"
	fi
}

# Process a single check.log file
#
# INPUTS
#    $1 = filename
process_check_log ()
{
	# abort if we can't find any expressions
	if grep '^\*\* got: $' <$1 >/dev/null; then
		:
	else
		echo "WARNING:  No expressions in file: $1" >&2
		echo "          Either not a check.log or sanity.sh exited for some other reason," >&2
		echo "          like bad exit status.  Try tail." >&2
		return
	fi

	dcl_exprfiles=""
	if grep '^\*\* or: $' <$1 >/dev/null; then
		# file contains a second regex
		if test $dcl_dofirst -eq 1; then
			# get the first pattern
			sed -ne '/^\*\* expected: $/,/^\*\* or: $/p' <$1 >/tmp/dcle$$
			dcl_exprfiles="$dcl_exprfiles /tmp/dcle$$"
		fi
		if test $dcl_doalternate -eq 1; then
			# get the alternate pattern
			sed -ne '/^\*\* or: $/,/^\*\* got: $/p' <$1 >/tmp/dclo$$
			dcl_exprfiles="$dcl_exprfiles /tmp/dclo$$"
		else
			echo "WARNING:  Ignoring alternate pattern in file: $1" >&2
		fi
	else
		# file doesn't contain a second regex
		if test $dcl_dofirst = 1; then
			# get the only pattern
			sed -ne '/^\*\* expected: $/,/^\*\* got: $/p' <$1 >/tmp/dcle$$
			dcl_exprfiles="$dcl_exprfiles /tmp/dcle$$"
		fi
		if test $dcl_doalternate -eq 1; then
			echo "WARNING:  No alternate pattern in file:  $1" >&2
		fi
	fi

	# and get the actual output
	sed -ne '/^\*\* got: $/,$p' <$1 >/tmp/dclg$$
	sed -ne '1D
$D
p' </tmp/dclg$$ >/tmp/dclh$$
	mv /tmp/dclh$$ /tmp/dclg$$

	# compare the output against each pattern requested
	for dcl_f in $dcl_exprfiles; do
		sed -ne '1D
$D
p' <$dcl_f >/tmp/dclp$$
		mv /tmp/dclp$$ $dcl_f

		case $dcl_f in
			/tmp/dcle*)
				echo "********** $1 : Primary **********"
				;;
			/tmp/dclo*)
				echo "********** $1 : Alternate **********"
				;;
		esac

		expr_line_by_line /tmp/dclg$$ $dcl_f

		rm $dcl_f
	done

	rm /tmp/dclg$$
}

###
### MAIN
###

# set up defaults
dcl_doalternate=0
dcl_dofirst=0

# process options
while getopts afh arg; do
	case $arg in
		a)
			dcl_doalternate=1
			;;
		f)
			dcl_dofirst=1
			;;
		\?|h)
			usage
			exit 1
			;;
	esac
done

# dispose of processed args
shift `expr $OPTIND - 1`
OPTIND=1

# set the default mode
if test $dcl_doalternate -eq 0; then
	dcl_dofirst=1
fi

# set default arg
if test $# -eq 0; then
	if test -f src/check.log && test -r src/check.log; then
		set src/check.log
	else
		set check.log
	fi
fi

for file in "$@"; do
	process_check_log $file;
done

exit 0