Subject: bug#25495: WTF? Chmod (and presumably other coreutils) corrupt their own error messages with "smart" quotes...

From: Eric Blake <[email-masked]>
Date: Fri, 20 Jan 2017 16:33:34 -0600

On 01/20/2017 03:44 PM, Alain Knaff wrote:
> Hi,
> 
> Recently, while browsing error mails of some cron jobs, I noticed that
> chmod puts "smart" quotes into its error messages.
> 
> IMHO, such gimmicks should have no place in core utilities.
> 
> At least this behavior should be optional via configuration or
> environment setting (preferably off by default).

It IS configurable by environment variables: set LC_ALL=C as a
sledgehammer to turn it (and all other localization aspects) off.  You
can also use LC_MESSAGES and fine-tune the creation of a custom one-off
locale if you don't like the behavior of your current locale.

> 
> The faulty code lives in lib/quotearg.c in function gettext_quote
> 
> Even defining a custom locale that just maps quotes to themselves
> doesn't work, because this function specifically tests for that case
> (translation same as msgid), and then "manually" garbles the quotes.

Can you please paste an example of something that's actually garbled? Or
is this merely a case of you mixing locales (where the coreutils are
producing output in one locale/encoding, but your other tools are
post-processing the data in another locale/encoding), where the garbling
is a result of your mismatched locales?

> 
> Who came up with this? :-)

Coreutils has been doing this for years.

> Thanks for fixing this,

It's not obvious what needs to be fixed, without more details from your end.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org