Project

General

Profile

Actions

Bug #13452

closed

Incorrect wildcard expansion in /usr/bin/sh

Added by David Cantrell 11 months ago. Updated 11 months ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

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

Actions #1

Updated by Peter Tribble 11 months 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

Actions #2

Updated by David Cantrell 11 months 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.

Actions #3

Updated by Andy Fiddaman 11 months ago

  • Status changed from New to Rejected

Closing as requested - no bug to fix.

Actions

Also available in: Atom PDF