summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/hstow14
1 files changed, 11 insertions, 3 deletions
diff --git a/bin/hstow b/bin/hstow
index 3fce0a72..7aba04de 100755
--- a/bin/hstow
+++ b/bin/hstow
@@ -53,11 +53,19 @@ fi
# Here we unconditionally bypass readlink(1), for speed.
# The long regexp is because only BREs have backreferences in POSIX.
readlinks () {
- local restc=$1 assume="${2:-false}" first= rest=
+ local restc=$1 assume="${2:-false}" first= rest= ls=
while read -r first rest; do
if $assume || [ -h "$first" ]; then
- [ -n "$rest" ] && rest="$rest$tab"
- rest="$rest$(ls -ld "$first")"
+ ls="$(ls -ld "$first")"
+ case "$ls" in
+ $cchars)
+ printf \
+ 'hstow: skipping %s due to control chars in link target\n' \
+ "$first" >&2
+ continue
+ ;;
+ esac
+ [ -n "$rest" ] && rest="$rest$tab$ls" || rest=$ls
fi
printf '%s\t%s\n' "$first" "$rest"
done | sed 's/^\([^\t]\{1,\}\)\t\('\