Bug 198011 - [util-linux] look is ignoring locale.
Summary: [util-linux] look is ignoring locale.
Status: NEW
Alias: None
Product: Tools
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 high
Assignee: Tools.Other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-28 10:23 UTC by Simon
Modified: 2017-11-28 10:23 UTC (History)
0 users

See Also:
Kernel Version: 4.12.12
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Simon 2017-11-28 10:23:04 UTC
Hi,  
look command should respect locale instead of using C hardcoded.  
  
My default LC_COLLATE="de_DE.utf8" and I used:  
> # sort -d file > file.sortd  
> # look string file.sortd  
and got the wrong output (empty)  
  
But with:  
> # LC_COLLATE=C sort -d file > file.sortd  
> # look string file.sortd  
the output is correct.  
  
So it seems look always uses the C locale regardless of real set locale, which leads to quite confusing behaviour as this is not even documented in the man page and therefore yields unexpected errors.  
(Btw it would be nice if look had a param like grep -m NUM to stop after NUM outputs, at the moment I'm using look .. | head -n NUM instead.)

Note You need to log in before you can comment on or make changes to this bug.