This file is indexed.

/usr/sbin/locale-gen is in locales 2.23-0ubuntu3.

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
#!/bin/bash

set -e

LOCALEGEN=/etc/locale.gen
LOCALES=/usr/share/i18n/locales
USER_LOCALES=/usr/local/share/i18n/locales
SUPPORTED=/var/lib/locales/supported.d
ALIASES=/usr/share/locale/locale.alias
if [ -n "$POSIXLY_CORRECT" ]; then
  unset POSIXLY_CORRECT
fi


[ -f $LOCALEGEN ] || exit 0;
[ -s $LOCALEGEN ] || exit 0;

KEEP=
IS_LANG=no
ARCHIVE=yes

#  Handle command-line options
prev=
while true
do
	option="$1"
	if [ -n "$prev" ]; then
                eval "$prev=\$option"
                prev=
                continue
	fi

	case $option in
	-h|--help)
		cat <<EOT
Usage: locale-gen [OPTIONS]
Options:
 -h, --help         display this message and exit
     --purge        remove existing locales before processing
     --archive      store compiled locale data inside a single archive
     --no-archive   do not store compiled locale data inside a single archive
                    (default)
     --aliases=FILE read locale aliases from FILE. (Default: /etc/locale.alias)
     --lang         treat argument as generic language code
EOT
		exit 0
		;;
	--purge)
		# This is the default when called without arguments
		;;
	--no-purge)
		KEEP=1
		;;
	--archive)
		ARCHIVE=yes
		;;
	--no-archive)
		ARCHIVE=no
		;;
	--keep-existing)
		KEEP=1
		;;
	--aliases)
		prev=ALIASES
		;;
	--aliases=*)
		ALIASES=$(expr "x$option" : 'x[^=]*=\(.*\)')
		;;
	--lang)
		IS_LANG=yes
		;;
	--*)
		echo "locale-gen: invalid option -- $option"
		echo "Try 'locale-gen --help' for more information."
		exit 1
		;;
	*)
		break
		;;
	esac

	shift
done

no_archive=
[ "$ARCHIVE" = yes ] || no_archive="--no-archive"
locale_alias=
[ -n "$ALIASES" ] && [ -r "$ALIASES" ] && locale_alias="-A $ALIASES"

if [ -z "$1" ] && [ -z "$KEEP" ]; then
	# Remove all old locale dir and locale-archive before generating new
	# locale data.
	rm -rf /usr/lib/locale/locale-archive || true
	for dir in /usr/lib/locale/*; do
		[ -e "$dir" ] || continue
		if [ "${dir#/usr/lib/locale/}" = C.UTF-8 ]; then
			# owned by libc-bin
			continue
		fi
		rm -rf "$dir" 2>/dev/null || true
	done
fi

umask 022

is_entry_ok() {
  if [ -n "$locale" -a -n "$charset" ] ; then
    true
  else
    echo "error: Bad entry '$locale $charset'"
    false
  fi
}

add_to_locale_gen() {
  echo "$1" | while read locale; do
    if ! grep -q "^[# ]*$locale *\$" $LOCALEGEN; then
      echo "# $locale" >> $LOCALEGEN
    fi
    sed -i -e "0,/^[# ]*$locale *$/ s/^[# ]*$locale *$/$locale/" $LOCALEGEN
  done
}

if [ -z "$1" ]; then
  GENERATE="`cat $SUPPORTED/* $LOCALEGEN 2>/dev/null || true`"
else
  GENERATE=
  while [ -n "$1" ]; do
    if [ -f "$SUPPORTED/$1" ]; then
      GENERATE="$GENERATE\n`cat $SUPPORTED/$1`"
    elif [ $IS_LANG = no ] && L=`grep "^${1/%.utf8/.UTF-8} " /usr/share/i18n/SUPPORTED`; then
      # convert utf8 to UTF-8 and check if the requested locale exists
      GENERATE="$GENERATE\n$L"
      add_to_locale_gen "$L"
    elif [ $IS_LANG = no ] && L=`grep "^${1%.[uU][tT][fF]*} UTF-8" /usr/share/i18n/SUPPORTED`; then
      # recognize 'll_CC.UTF-8' or 'll_CC.utf8' as ll_CC without codeset
      GENERATE="$GENERATE\n$L"
      add_to_locale_gen "$L"
    else
      # try to come up with a sensible default
      L=`grep -E "^${1}( |[._@][^[:space:]]* )UTF-8" /usr/share/i18n/SUPPORTED || true`
      if [ -z "$L" ]; then
        echo "Error: '$1' is not a supported language or locale" >&2
        exit 1
      fi
      GENERATE="$GENERATE\n$L"
      add_to_locale_gen "$L"
    fi
    shift
  done
fi

echo "Generating locales (this might take a while)..."
echo -e "$GENERATE" | sort -u | while read locale charset; do \
	case $locale in \#*) continue;; "") continue;; esac; \
	is_entry_ok || continue
	if [ "$KEEP" ] && PERL_BADLANG=0 perl -MPOSIX -e \
	    'exit 1 unless setlocale(LC_ALL, $ARGV[0])' "$locale"; then
		continue
	fi
	echo -n "  `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"; \
	echo -n ".$charset"; \
	echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
	echo -n '...'; \
	if [ -f $USER_LOCALES/$locale ] ; then
	    input=$USER_LOCALES/$locale
        elif [ -f $LOCALES/$locale ]; then 
	    input=$locale
        else
	    input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`
	    if [ -f $USER_LOCALES/$input ]; then
	        input=$USER_LOCALES/$input
            fi
	fi
	localedef $no_archive -i $input -c -f $charset $locale_alias $locale || :; \
	echo ' done'; \
done
echo "Generation complete."