<commit_before>#!/usr/bin/env bash

function relpath() {
    path_to=`readlink -f "$2"`
    source=`readlink -f "$1"`
    rel=$(perl -MFile::Spec -e "print File::Spec->abs2rel(q($path_to),q($source))")
    echo $rel
}

# Location of our embedded directory
embedded_dir=$1

for so_path in $(find "${embedded_dir}" -name "*.so"); do
    chrpath --list "${so_path}"
    if [ $? -eq 0 ]; then
        echo "-> ${so_path}"
        set -e
        so_dir=$(dirname "${so_path}")
        rel_embedded=$(relpath "${so_dir}" "${embedded_dir}")
        rpath="\$ORIGIN/${rel_embedded}/lib:\$ORIGIN/${rel_embedded}/lib64"
        chrpath --replace "${rpath}" "${so_path}"
        chrpath --convert "${so_path}"
        set +e
    fi
done

echo "complete."<commit_msg>Apply updates to executable files as well<commit_after>#!/usr/bin/env bash

set -x

function relpath() {
    path_to=`readlink -f "$2"`
    source=`readlink -f "$1"`
    rel=$(perl -MFile::Spec -e "print File::Spec->abs2rel(q($path_to),q($source))")
    echo $rel
}

# Location of our embedded directory
embedded_dir=$1

for so_path in $(find "${embedded_dir}" -name "*.so"); do
    chrpath --list "${so_path}"
    if [ $? -eq 0 ]; then
        set -e
        so_dir=$(dirname "${so_path}")
        rel_embedded=$(relpath "${so_dir}" "${embedded_dir}")
        rpath="\$ORIGIN/${rel_embedded}/lib:\$ORIGIN/${rel_embedded}/lib64"
        chrpath --replace "${rpath}" "${so_path}"
        set +e
    fi
done

for exe_path in $(find "${embedded_dir}" -type f); do
    chrpath --list "${exe_path}"
    if [ $? -eq 0 ]; then
        set -e
        exe_dir=$(dirname "${exe_path}")
        rel_embedded=$(relpath "${exe_dir}" "${embedded_dir}")
        rpath="\$ORIGIN/${rel_embedded}/lib:\$ORIGIN/${rel_embedded}/lib64"
        chrpath --replace "${rpath}" "${exe_path}"
        set +e
    fi
done

echo "complete."
{'fraction_non_alphanumeric': 0.19785522788203752, 'fraction_numerical': 0.009115281501340482, 'mean_word_length': 2.9533898305084745, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1368633', 'n_tokens_mistral': 681, 'n_tokens_neox': 650, 'n_words': 155}