[Bug 256473] FreeBSD shells are case insensitive for character ranges

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 07 Jun 2021 22:58:32 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256473

            Bug ID: 256473
           Summary: FreeBSD shells are case insensitive for character
                    ranges
           Product: Base System
           Version: 12.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: jwb@freebsd.org

When running /bin/tcsh or /bin/sh, character ranges of either upper case or
lower case also expand to files with the other case:

FreeBSD moray.acadix  bacon ~ 1017: ls -d [A-Z]*
Biostar/             Grad-school-biosci/  Save/
Books/               igv/                 scripts/
Coral@               Moto/                VirtualBox VMs/
Data/                ncbi/                wpa_supplicant.conf
Desktop/             Ports/
Documents/           Prog/
FreeBSD moray.acadix  bacon ~ 1018: bash

Using bash from ports, I do not see this behavior:

[bacon@moray ~]$ ls -d [A-Z]*
Biostar            Data               Grad-school-biosci Prog
Books              Desktop            Moto               Save
Coral              Documents          Ports              VirtualBox VMs

Also checked tcsh on a CentOS system and did not see this behavior.

Lastly I do NOT see this behavior from glob(3), so it seems to be limited to
shells in the FreeBSD base.

#include <stdio.h>
#include <sysexits.h>
#include <glob.h>
#include <unistd.h>

int     main(int argc,char *argv[])

{
    glob_t g;

    g.gl_offs = 2;
    glob("[A-Z]*", GLOB_DOOFFS, NULL, &g);
    g.gl_pathv[0] = "ls";
    g.gl_pathv[1] = "-d";
    execvp("ls", g.gl_pathv);

    return EX_OK;
}

-- 
You are receiving this mail because:
You are the assignee for the bug.