1#! /shell/bug/test/for/moderni/sh
2# See the file LICENSE in the main modernish directory for the licence.
3
4# BUG_IFSGLOBP: in pathname expansion (filename globbing), if a
5# wildcard character is part of IFS, it is matched literally instead of as a
6# matching character. This applies to glob characters '*', '?' and '['.
7# Bug found in bash (all versions up to at least 4.4).
8# Ref: https://lists.gnu.org/archive/html/bug-bash/2016-11/msg00013.html
9
10# Save IFS (note: _Msh_test is guaranteed unset at start)
11isset IFS && _Msh_test=$IFS
12
13# Turn on globbing temporarily if it's off (set -f)
14case $- in
15( *f* )	set +f
16	IFS='*'			# BUG_IFSGLOBC compat: don't set IFS before "case"
17	set -- /*
18	set -f ;;
19( * )	IFS='*'
20	set -- /* ;;
21esac
22
23# Restore IFS
24case ${_Msh_test+s} in		# BUG_IFSGLOBC compat: no wildcards in this 'case'
25( s )	IFS=${_Msh_test} ;;
26( '' )	unset -v IFS ;;
27esac
28
29# Check if the glob pattern expanded; if not, bug
30let "$# == 1" && str eq "$1" "/*"
31