The real function should handle patterns starting with "**/" and also
ending in "/**", as well as when "**" is the entire pattern.
On 2023-09-12, Kaz Kylheku <[email protected]> wrote:
The real function should handle patterns starting with "**/" and also
ending in "/**", as well as when "**" is the entire pattern.
I fixed this in the prototype.
On 2023-09-12, Kaz Kylheku <[email protected]> wrote:<snip>
On 2023-09-12, Kaz Kylheku <[email protected]> wrote:
The real function should handle patterns starting with "**/" and also
ending in "/**", as well as when "**" is the entire pattern.
I fixed this in the prototype.
Issues:
2. Escaping
The interior /**/ pattern could occur in a class like [abc/**/def]
in which case it must not be recognized.
Kaz Kylheku <[email protected]> wrote:
On 2023-09-12, Kaz Kylheku <[email protected]> wrote:<snip>
On 2023-09-12, Kaz Kylheku <[email protected]> wrote:
The real function should handle patterns starting with "**/" and also
ending in "/**", as well as when "**" is the entire pattern.
I fixed this in the prototype.
Issues:
2. Escaping
The interior /**/ pattern could occur in a class like [abc/**/def]
in which case it must not be recognized.
At first I was wondering why you thought you could get away with merely scanning for slash+double-star and double-star+slash--bracket expressions obviously require stateful parsing. But clearly POSIX anticipates (or even expects) that shells would process slashes before parsing component
patterns. I believe this allowance/limitation would likewise apply to glob(3), which specially mentions rule #3 under 2.13.3; unlike case and fnmatch(3), which are normally used for generic string matching.
Kaz Kylheku <[email protected]> wrote:
On 2023-09-12, Kaz Kylheku <[email protected]> wrote:<snip>
On 2023-09-12, Kaz Kylheku <[email protected]> wrote:
The real function should handle patterns starting with "**/" and also
ending in "/**", as well as when "**" is the entire pattern.
I fixed this in the prototype.
Issues:
2. Escaping
The interior /**/ pattern could occur in a class like [abc/**/def]
in which case it must not be recognized.
FWIW, OpenBSD sh seems not to tolerate slashes in bracket expressions:
At first I was wondering why you thought you could get away with merely scanning for slash+double-star and double-star+slash--bracket expressions obviously require stateful parsing.
But I guess none of that is helpful if you're trying to match some sophisticated Bash behavior.
On 2023-09-14, William Ahern <[email protected]> wrote:
Kaz Kylheku <[email protected]> wrote:
On 2023-09-12, Kaz Kylheku <[email protected]> wrote:<snip>
On 2023-09-12, Kaz Kylheku <[email protected]> wrote:
The real function should handle patterns starting with "**/" and also >>>>> ending in "/**", as well as when "**" is the entire pattern.
I fixed this in the prototype.
Issues:
2. Escaping
The interior /**/ pattern could occur in a class like [abc/**/def]
in which case it must not be recognized.
FWIW, OpenBSD sh seems not to tolerate slashes in bracket expressions:
Yes; and it doesn't make sense. Or not in glob, anyway.
Nevertheless, a star glob preprocessor above glob should heed the class syntax and not treat /**/; just pass that through to glob and let it
fail.
Matching slashes with class syntax makes sense in situations when
we are not matching paths. Or matching paths more freely.
obvously it's allowed in a POSIX shell case statement, and in fnmatch()
(in the absence of FNM_PATHNAME) and and so on.
At first I was wondering why you thought you could get away with merely
scanning for slash+double-star and double-star+slash--bracket expressions
obviously require stateful parsing.
I was initially after the behavior: proof-of-concept. When things have
driven around the block, then we tighten the lugnuts.
In the current version I have it look for ** being the whole thing,
starting with **/, ending with /** or containing /**/ where the
leading / is not escaped or in a character class.
I think I may havae a bug: for detecting the trailing /**, we should
avoid interpreting it if it follows a backslash; let glob deal
with it.
But I guess none of that is helpful if you're trying to match some
sophisticated Bash behavior.
I used this to cob together a function called glob* that is now
integrated in TXR Lisp.
The current glob function is a wrapper for glob written in C,
which now calls superglob if the extension flag GLOB_XSTAR is present.
glob accepts a list of patterns, not just a single pattern; the results
from multiple patterns are catenated.
glob* is written in Lisp, and performs its own brace expansion to
generate a list of patterns passed to glob with GLOB_XSTAR.
I wish I had pushed this up to GitHub as I rely on the (sh) printf %b format specifier for decoding encoded filenames. POSIX sh printf %b clashes with
the newly defined %b in C2x. There's a discussion on the Open Group mailing-list about whether POSIX 202x/SuSv5 should deprecate %b, and someone did a query across GitHub code only to find that almost all the usages of %b are the same copy-pasted code which could be easily replaced if POSIX deprecated/removed the old %b specifier.
On 2023-09-14, William Ahern wrote:
[...]
I wish I had pushed this up to GitHub as I rely on the (sh) printf %b format >> specifier for decoding encoded filenames. POSIX sh printf %b clashes with
the newly defined %b in C2x. There's a discussion on the Open Group
mailing-list about whether POSIX 202x/SuSv5 should deprecate %b, and someone >> did a query across GitHub code only to find that almost all the usages of %b >> are the same copy-pasted code which could be easily replaced if POSIX
deprecated/removed the old %b specifier.
How complete would such a query be? I mean, are there other
"centralized" web repositories of code with a significant user base?
(There is also code at other locations grouping several projects, FSF's savannah comes to mind, but I don't think it has a centralized code
search, does it? Same goes for SourceForge?)
How complete would such a query be? I mean, are there other
"centralized" web repositories of code with a significant user base?
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 714 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 136:21:59 |
| Calls: | 12,087 |
| Files: | 14,997 |
| Messages: | 6,517,376 |