Bug #13452
closedIncorrect wildcard expansion in /usr/bin/sh
0%
Description
Given this directory structure:
$ find foo -type f
foo/bar.txt
foo/1/2/bar.txt
foo/1/bar.txt
I would expect this shell expansion:
$ echo foo/*.txt foo/*/*.txt foo/*/*/*.txt
foo/bar.txt foo/1/bar.txt foo/1/2/bar.txt
But when the shell is /usr/bin/sh I get this instead:
$ echo foo/*.txt foo/*/*.txt foo/*/*/*.txt
foo/bar.txt foo/./bar.txt foo/1/bar.txt foo/../foo/bar.txt foo/././bar.txt foo/./1/bar.txt foo/1/../bar.txt foo/1/./bar.txt foo/1/2/bar.txt
Updated by Peter Tribble over 2 years ago
If I try this I get the expected result.
$ echo foo/*.txt foo/*/*.txt foo/*/*/*.txt
foo/bar.txt foo/1/bar.txt foo/1/2/bar.txt
This is probably something in the environment modifying globbing. Quite possibly having FIGNORE as an empty string will reproduce:
$ FIGNORE="" echo foo/*.txt foo/*/*.txt foo/*/*/*.txt
foo/bar.txt foo/./bar.txt foo/1/bar.txt foo/../foo/bar.txt foo/././bar.txt foo/./1/bar.txt foo/1/../bar.txt foo/1/./bar.txt foo/1/2/bar.txt
Updated by David Cantrell over 2 years ago
Peter Tribble wrote in #note-1:
This is probably something in the environment modifying globbing. Quite possibly having FIGNORE as an empty string will reproduce:
$ FIGNORE="" echo foo/*.txt foo/*/*.txt foo/*/*/*.txt
foo/bar.txt foo/./bar.txt foo/1/bar.txt foo/../foo/bar.txt foo/././bar.txt foo/./1/bar.txt foo/1/../bar.txt foo/1/./bar.txt foo/1/2/bar.txt
Yes! FIGNORE is the culprit, although in my case it's not empty:
$ echo $FIGNORE
.DS_Store:.AppleDouble
$ echo foo/*.txt foo/*/*.txt foo/*/*/*.txt
foo/bar.txt foo/./bar.txt foo/1/bar.txt foo/../foo/bar.txt foo/././bar.txt foo/./1/bar.txt foo/1/../bar.txt foo/1/./bar.txt foo/1/2/bar.txt
That works just fine for ignoring Apple-droppings in bash, but ksh has completely different semantics for FIGNORE so was getting terribly confused.
This ticket can be closed, as there's no bug to fix.
Updated by Andy Fiddaman over 2 years ago
- Status changed from New to Rejected
Closing as requested - no bug to fix.