git: sh: Add UTF-8 support to pattern matching.

Peter Avalos pavalos at
Sun Aug 21 16:33:10 PDT 2011

commit ead7935bf6ca5dacd4abb1380eb3ac771c15e8c9
Author: Peter Avalos <pavalos at>
Date:   Sun Aug 21 13:48:41 2011 -0700

    sh: Add UTF-8 support to pattern matching.
    ?, [...] patterns match codepoints instead of bytes. They do not match
    invalid sequences. [...] patterns must not contain invalid sequences
    otherwise they will not match anything. This is so that ${var#?} removes
    the first codepoint, not the first byte, without putting UTF-8 knowledge
    into the ${var#pattern} code. However, * continues to match any string
    and an invalid sequence matches an identical invalid sequence. (This
    differs from fnmatch(3).)
    Obtained-from:   FreeBSD SVN rev 221646 & 223010

Summary of changes:
 bin/sh/expand.c                           |   66 ++++++++++++++++++++-----
 tools/regression/bin/sh/builtins/case5.0  |   57 ++++++++++++++++++++++
 tools/regression/bin/sh/expansion/trim8.0 |   75 +++++++++++++++++++++++++++++
 3 files changed, 184 insertions(+), 14 deletions(-)
 create mode 100644 tools/regression/bin/sh/builtins/case5.0
 create mode 100644 tools/regression/bin/sh/expansion/trim8.0

DragonFly BSD source repository

More information about the Commits mailing list