On 08.10.2011 00:20, Michal Soltys wrote: > mostly with reference to earlier commit: > > - bash doesn't need unsetting locals > - make normalize_path() a bit faster, also make sure we remove all > trailing slashes > - normalize paths before tests > > Signed-off-by: Michal Soltys <soltys@xxxxxxxx> > --- > dracut-functions | 22 ++++++++++------------ > 1 files changed, 10 insertions(+), 12 deletions(-) > > diff --git a/dracut-functions b/dracut-functions > index 12dfa70..ce593c9 100755 > --- a/dracut-functions > +++ b/dracut-functions > @@ -83,31 +83,29 @@ print_vars() { > } > > normalize_path() { > - p=$1 > - while [[ ${p#*//*} != $p ]]; do > - p=${p/\/\///} > - done > - echo $p > + shopt -q -s extglob > + set -- "${1//+(\/)//}" > + shopt -q -u extglob > + echo "${1%/}" > } > > convert_abs_rel() { > - local __current __absolute __abssize __cursize __newpath="" __oldifs > - local -i __i __level=0 > + local __current __absolute __abssize __cursize __newpath __oldifs > + local -i __i __level > # PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '; > > + set -- "$(normalize_path "$1")" "$(normalize_path "$2")" > + > # corner case #1 - self looping link > [[ "$1" == "$2" ]] && { echo "${1##*/}"; return; } > > # corner case #2 - own dir link > [[ "${1%/*}" == "$2" ]] && { echo "."; return; } > > - __current=$(normalize_path "$1") > - __absolute=$(normalize_path "$2") > - > __oldifs="$IFS" > IFS="/" > - __current=($__current) > - __absolute=($__absolute) > + __current=($1) > + __absolute=($2) > IFS="$__oldifs" > > __abssize=${#__absolute[@]} pushed all 5 -- To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html