This file is indexed.

/usr/sbin/ldbashconfig is in libbash 0.9.11-1.

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

###########################################################################
# Copyright (c) 2004-2009 Hai Zaar and Gil Ran                            #
#                                                                         #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of version 3 of the GNU General Public License as       #
# published by the Free Software Foundation.                              #
#                                                                         #
###########################################################################

# Configurator for ldbash
# It creates the .cache file for ldbash (usually /etc/ldbash.cache)

prefix=/usr
exec_prefix=${prefix}

LD_BASH_PATH=${exec_prefix}/lib/bash

LD_BASH_CACHE=/etc/ldbash.cache

# We want to use getopt_long...
source $LD_BASH_PATH/getopts.sh
source $LD_BASH_PATH/hashstash.sh

#############################################################
###################       FUNCTIONS      ####################
#############################################################

#
# $retval ldbashconfig_returnDuplicates $retval returnDuplicates <arr>
#
#	Finds all the duplicated values in arr and returns them.
#
#	Parameters:
#		arr		- An array.
#	Return value:
#		A list of all the values that apear at least twice in the array.
returnDuplicates()
{
	retval=""

	# Set a value to $CurrVal, so it will enter the loop
	local CurrVal=1
	
	while [[ $CurrVal ]] ; do
		# Set the next value of the array in $CurrVal
		CurrVal=$1

		# Remove the next value from the array
		shift

		# Check if the value apears in the rest of the array
		if [[ " $* " = *" $CurrVal "* ]] ; then
			# Add the value to the retval
			retval="${retval} ${CurrVal}"
		fi
	done

	# Prevent duplications in the retval
	retval=`echo $retval | awk '{for (i=1;i<=NF;i++) print $i}' | sort -u`
}

##############################################################
##################          MAIN          ####################
##############################################################

getopt_long '-p|--prefix->LIBS_PREFIX
			 -v|--version->Version
			 -h|--help->Help' $*
eval $retval

if [[ $Help ]] ; then
	echo "usage: ldbashconfig"
	echo "		[-h|--help]"
	echo "		[-v|--version]"
	echo "		[-p|--prefix]"
	[[ $Version ]] || exit
fi

if [[ $Version ]] ; then
	echo "libbash 0.9.11"
	echo "Writen by Gil Ran and Hai Zaar"
	exit
fi

if [[ $LIBS_PREFIX ]] ; then
	echo $LD_BASH_PATH
	exit
fi

# Keep the existing file (for a case there will be errors)
cp -f $LD_BASH_CACHE ${LD_BASH_CACHE}.prev$$ 2> /dev/null || echo "" > $LD_BASH_CACHE ${LD_BASH_CACHE}.prev$$

# grep the lines that define exports					(output looks like: ./script.sh: # EXPORT=func1 func2	)
# replace the .sh<white-space>#<white-space> with a _ 	(output looks like: ./script_EXPORT=func1 func2			)
# replace the dirname of the script with a _			(output looks like: _script_EXPORT=func1 func2			)
# replace the = with ="<space>							(output looks like: _script_EXPORT=" func1 func2		)
# put <space>" at the end of the line					(output looks like: _script_EXPORT=" func1 func2 "		)
grep -H EXPORT= $LD_BASH_PATH/*.sh | 		\
	sed -e 's/\.sh:[ |\t]*#[ |\t]*/_/g'	\
		-e 's/^.*\///g' 				\
		-e 's/=/=" /g'					\
		-e 's/$/ "/g' 						> $LD_BASH_CACHE

# This does the same for requirements
grep -H REQUIRE= $LD_BASH_PATH/*.sh | 		\
	sed -e 's/\.sh:[ |\t]*#[ |\t]*/_/g'	\
		-e 's/^.*\///g' 				\
		-e 's/=/=" /g' 					\
		-e 's/$/ "/g'						>> $LD_BASH_CACHE

# Get the names of all the functions exported in the file.
# Step by step:
# Get the lines that define EXPORT variables
# Take the value of the variable
# Remove any " from the result
AllFuncs=( `grep _EXPORT $LD_BASH_CACHE	|
			awk -F= '{print $2}' 		|
			sed -e 's/"//g'`)

# Check if any duplications found
returnDuplicates ${AllFuncs[*]}
if [[ $retval ]] ; then
	echo "Error - duplicated definition of:"
	echo "	$retval"
	echo "Restoring old configuration"
	cp -f ${LD_BASH_CACHE}.prev$$ $LD_BASH_CACHE 
fi

# Remove the old file
rm -f ${LD_BASH_CACHE}.prev$$