PDA

View Full Version : 10.04LTS->14.04LTS upgrade, now case INsensitive



groost
July 12th, 2014, 05:44 PM
Last week I did a fresh install of 14.04 over an existing (special real-time copy of) 10.04 (necessary to run LinuxCNC), keeping the existing /home partition and combining separate /, /usr, and /var partitions into a single / 9GB-ish partition formatted for ext4 filesystem, as is home.

I have been surprised by the unexpected behavior of SHELL BUILTIN COMMANDS in bash, which now DO NOT respect the uppercase or lowercase of filenames.

% mkdir test
% cd test
% touch A.file x.file Z.file
% echo [A-Z]*
A.file x.file Z.file

But note:

% echo [X]*
X*
does NOT include x.file... :confused:

(It may not be a matter of 'case insensitivity' but one of [A-Z] including 'x' somehow.)

My first introduction to this changed behavior from 10.04 :( came by way of a

% rm [A-Z]*
which took out [a-z]* along with it...

I've looked at quite a few things:

% mv ~/.bashrc ~/.bashrcRENAMED
% sudo /etc/bash.bashrc /etc/bash.bashrcRENAMED
% shopt | grep case
nocaseglob off
nocasematch off
% echo set completion-ignore-case Off >> ~/.inputrc
% which rm [ls|echo]
/bin/rm [ls|echo]
% bash
with no change in behavior. I copied the test dir to the home partition (also ext4) and observed the same behavior.

I did find one interesting thing: the _longopt() function(?) which is visible from the set command:

% set | less
in the definition of which I find this entry, which I do not pretend to understand, nor even to recognize as germane, but which strikes me as "unbalanced" because it has 'A-Z' on one side and not the other:

_longopt ()
{
local cur prev words cword split;
_init_completion -s || return;
case "${prev,,}" in
--help | --usage | --version)
return 0
;;
--*dir*)
_filedir -d;
return 0
;;
--*file* | --*path*)
_filedir;
return 0
;;
--+([-a-z0-9_]))
local argtype=$( $1 --help 2>&1 | sed -ne "s|.*$prev\[\{0,1\}=[<[]\{0,1\}\([-A-Za-z0-9_]\{1,\}\).*|\1|p" );
case ${argtype,,} in
*dir*)
_filedir -d;
return 0
;;
*file* | *path*)
_filedir;
return 0
;;
esac
;;
esac;


I've been over my head in Linux many times in my 22 or so years using it, but I'm going to need decompression after this dive.

What, oh tell, do!, could be the cause? Or what further investigations I might make?

Thank you for your thoughts on 't.

Bucky Ball
July 12th, 2014, 09:41 PM
Thread moved to Programming Talk.

You might have better luck here. ;)

sisco311
July 12th, 2014, 10:31 PM
The collation order depends on the current locale:


[sisco@acme xtmp]$ mkdir test && cd test
[sisco@acme test]$ > a
[sisco@acme test]$ > A
[sisco@acme test]$ > b
[sisco@acme test]$ > B
[sisco@acme test]$ > z
[sisco@acme test]$ > Z
[sisco@acme test]$ locale
LANG=en_GB.utf8
LC_CTYPE="en_GB.utf8"
LC_NUMERIC="en_GB.utf8"
LC_TIME="en_GB.utf8"
LC_COLLATE="en_GB.utf8"
LC_MONETARY="en_GB.utf8"
LC_MESSAGES="en_GB.utf8"
LC_PAPER="en_GB.utf8"
LC_NAME="en_GB.utf8"
LC_ADDRESS="en_GB.utf8"
LC_TELEPHONE="en_GB.utf8"
LC_MEASUREMENT="en_GB.utf8"
LC_IDENTIFICATION="en_GB.utf8"
LC_ALL=
[sisco@acme test]$ echo [a-z]
a A b B z
[sisco@acme test]$ echo [A-Z]
A b B z Z
[sisco@acme test]$ LC_ALL=C
[sisco@acme test]$ echo [a-z]
a b z
[sisco@acme test]$ LC_ALL=C
[sisco@acme test]$ echo [A-Z]
A B Z
[sisco@acme test]$ LC_ALL=
[sisco@acme test]$ echo [a-z]
a A b B z
[sisco@acme test]$ echo [[:lower:]]
a b z
[sisco@acme test]$ echo [A-Z]
A b B z Z
[sisco@acme test]$ echo [[:upper:]]
A B Z


As you can see the collation order with the British locale is aAbBcC...zZ ;)

Check out BashPitfalls 030,
http://mywiki.wooledge.org/locale
http://mywiki.wooledge.org/glob
and

man 7 glob

groost
July 13th, 2014, 10:09 PM
Thread moved to Programming Talk.

You might have better luck here. ;)

"Programming" Talk.

Thank you, Bucky. I would never have guessed that. I thought that was Perl, PHP, C++, FORTRAN, etc. I was thinking this was by way of a configuration setting somewhere.

groost
July 13th, 2014, 10:21 PM
Sisco,

I'm US all the way apparently:

% locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

However, following your lead, I discovered what I think is a change in the collation sequence since 10.04:

% echo [A-Z]
A b B x X z Z

% echo [a-z]
a A b B x X z

I was pretty sure, at one time, the collation sequence was something [A-Za-z] or v.v.

If I now have to worry that [A-Z] includes lowercase, a large part of the benefit of case-sensitivity is lost.

Thanks.

groost
July 13th, 2014, 10:31 PM
The issue is old:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/120687

AND, just as important, I found the same behavior on my still-extant 10.04 LTS install(!).

"I coulda sworn..." (And, I bet I lost stuff over the years that I didn't know this... :^p )

Thanks again.