Skip to content

Commit

Permalink
Add bug #26 to contrib/bugs.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ko1nksm committed May 10, 2019
1 parent c08e105 commit 93bf95b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
21 changes: 21 additions & 0 deletions contrib/bugs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,25 @@ HERE
[ "$ch" = "A" ] && no_problem || affect
)

(
title='26: Segmentation fault in eval (ksh 93q, 93r)'
(
str="" i=0
step1() {
if (eval ':' 2>/dev/null); then :; fi
return 0
}
step2() { set --; eval "$(:)"; }
step3() { eval "str=\${str#}"; }
step1
step2
while [ $i -lt 100 ]; do
step3 # 10 Segmentation fault "$@
i=$(($i+1))
done
) &
wait $! 2>/dev/null # wait is not related this bug, it just prevent fail.
[ $? = 0 ] && no_problem || affect
)

echo Done
2 changes: 1 addition & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ chmod +x /bin/sh
mkdir -p /usr/local/bin
ln -s $PWD/shellspec /usr/local/bin/shellspec

exec "$@"
"$@"
1 change: 1 addition & 0 deletions lib/general.sh
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ shellspec_readfile() {
}

shellspec_trim() {
# check $1 to avoid bug #26 in contrib/bugs.sh
eval "if [ \"\$$1\" ]; then $1=\${$1#\"\${$1%%[!$SHELLSPEC_IFS]*}\"}; fi"
}

Expand Down

0 comments on commit 93bf95b

Please sign in to comment.