Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uprobe: set_path select library - fix #39 #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions user/uprobe
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,30 @@ function set_path {
fi
fi

# In some systems, ldconfig can return more than one library from a
# given $name. Here I count them:
nr_libraries_in_path=$(echo $path | wc -w)

# User will be able to chose the library he wants to use.
# If no library is chosen, the program quits, which is the
# same behavior as before this patch.
if [[ $nr_libraries_in_path -gt "1" ]]
then
echo "More than 1 library found. Select the library you want to use."
for ((i = $nr_libraries_in_path ; i > 0 ; i-- ))
do
library=$(echo $path | cut -f $i -d " ")
echo -n $library " use this library? [y/N]: "
read answer
if [[ $answer == "y" ]]
then
path=$library
break
fi
done
fi

# test if $path is executable
if [[ ! -x $path ]]; then
die "ERROR: resolved \"$name\" to \"$path\", but file missing"
fi
Expand Down