Bug 198011

Summary: [util-linux] look is ignoring locale.
Product: Tools Reporter: Simon (sur3)
Component: OtherAssignee: Tools.Other (tools_other)
Status: NEW ---    
Severity: high    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.12.12 Subsystem:
Regression: No Bisected commit-id:

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.)