This file is indexed.

/usr/bin/cvs-switchroot is in cvs 2:1.12.13+real-26.

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
#!/bin/mksh
# $MirOS: src/scripts/mnt-cvsroot,v 1.19 2016/10/21 21:09:59 tg Exp $
#-
# Copyright © 2005, 2008, 2011
#	mirabilos <m@mirbsd.org>
#
# Provided that these terms and disclaimer and all copyright notices
# are retained or reproduced in an accompanying document, permission
# is granted to deal in this work without restriction, including un‐
# limited rights to use, publicly perform, distribute, sell, modify,
# merge, give away, or sublicence.
#
# This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
# the utmost extent permitted by applicable law, neither express nor
# implied; without malicious intent or gross negligence. In no event
# may a licensor, author or contributor be held liable for indirect,
# direct, other damage, loss, or other issues arising in any way out
# of dealing in the work, even if advised of the possibility of such
# damage or existence of a defect, except proven that it results out
# of said person’s immediate fault when using the work as intended.
#-
# Change CVSROOT of a checked out tree (and save space with it)
# With option -T: change Tag instead of Root

me=${0##*/}
function die {
	print -ru2 -- "$me: $*"
	exit 1
}

if [[ $1 = -T ]]; then
	tagmode=-T
	fn=Tag
	shift
else
	tagmode=
	fn=Root
fi
newroot=$1
useroot=0
if [[ $newroot = - ]]; then
	shift
	newroot=$(realpath "$1")
	[[ -d $newroot ]] && if [[ -d $newroot/CVS ]]; then
		newroot=$newroot/CVS/$fn
	else
		newroot=$newroot/$fn
	fi
	useroot=1
fi
if [[ -z $newroot || $newroot = -? ]]; then
	print -u2 "Syntax: $me newroot [dir [...]]"
	print -u2 "\t$me - .../CVS/Root [dir [...]]"
	print -u2 "\t$me -T - .../CVS/Tag [dir [...]]"
	exit 1
fi
shift

[[ -n $1 ]] || set -- .

# realpath(2)ise arguments
set -A arg
i=0
for name in "$@"; do
	arg[i++]=$(realpath "$name")
done

T="$(mktemp ${arg[0]}/$me.XXXXXXXXXX)" || die fatal: cannot mktemp

if (( useroot )); then
	rm -f "$T"
	ln "$newroot" "$T" || cp "$newroot" "$T" || \
	    die "fatal: cannot copy '$newroot' to temporary '$T'"
fi

trap 'rm -f "$T"; exit 0' 0
trap 'rm -f "$T"; trap - EXIT; exit 1' 1 2 3 5 13 15

if (( !useroot )); then
	chmod 664 "$T"
	print -r -- "$newroot" >"$T"
fi

let rv=0
find "${arg[@]}" -path \*/CVS/$fn -print0 |&
while IFS= read -d '' -pr name; do
	rm "$name" || die "error: cannot rm <$name>"
	ln -f "$T" "$name" || if ! U="$(mktemp ${arg[0]}/$me.XXXXXXXXXX)"; then
		cp "$T" "$name"
	elif cat "$T" >"$U" && ln -f "$U" "$name"; then
		rm -f "$T"
		T="$U"
	else
		rm -f "$U"
		cp "$T" "$name"
	fi
done

exit 0