From owner-freebsd-current@freebsd.org Sat Nov 21 01:57:56 2015 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0270A32777 for ; Sat, 21 Nov 2015 01:57:56 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 33F9911CD; Sat, 21 Nov 2015 01:57:56 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by wmvv187 with SMTP id v187so94689478wmv.1; Fri, 20 Nov 2015 17:57:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=x8VqDsKXQGnCunXzhlmrtQXWwXI6d3gxJBSQYuhM/5c=; b=TAjqDGOV2oLJLAG5lietbevfLasmLCWjc7pMUFHMhW9E3dDHWYU3ASecBEoVaqQXga jkBZuSDTlEG/82gVrEJyj11CLzT0NngtKbbmroH+ORUaKOMitu5v8TfZE3OxOnuhtQLV t5Je3EbezU2d5ABV7nOUXk2ko5tBAI3xzgx740zMOBPZH0C5fGoJNpmL6eyWY2dTrvIq /lGvFQQC/c+mQ2pie2n8T8rw488zLk1NHrs2Cm2f/gnpnMsAZn4GN859rMGvEV4BQst6 73pZJPJ4yE9YGKK+DKYn5FKDfabmhLpzSIlUkgMjB7nVGDKRrDmqMiarqONVD0FMQizP 7aBA== X-Received: by 10.28.215.211 with SMTP id o202mr2874355wmg.85.1448071073883; Fri, 20 Nov 2015 17:57:53 -0800 (PST) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id lv4sm1902999wjb.43.2015.11.20.17.57.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Nov 2015 17:57:52 -0800 (PST) Sender: Baptiste Daroussin Date: Sat, 21 Nov 2015 02:57:51 +0100 From: Baptiste Daroussin To: Andrey Chernov Cc: Jilles Tjoelker , "Sergey V. Dyatko" , freebsd-current@freebsd.org Subject: Re: /bin/ls formatting broken for non-C(?) locales Message-ID: <20151121015750.GG21071@ivaldir.etoilebsd.net> References: <20151120110556.6e20a71f@laptop.minsk.domain> <20151120104253.GA21071@ivaldir.etoilebsd.net> <20151120110212.GB21071@ivaldir.etoilebsd.net> <20151120122352.GA5751@stack.nl> <20151121003541.GF21071@ivaldir.etoilebsd.net> <564FBEA9.7070100@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XRI2XbIfl/05pQwm" Content-Disposition: inline In-Reply-To: <564FBEA9.7070100@freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Nov 2015 01:57:56 -0000 --XRI2XbIfl/05pQwm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 21, 2015 at 03:45:29AM +0300, Andrey Chernov wrote: > On 21.11.2015 3:35, Baptiste Daroussin wrote: >=20 > > Here is what I do propose (sorry for the ugly pad_to_col name, if one h= as better > > please share :D > >=20 > > https://reviews.freebsd.org/D4239 >=20 > The whole function is ugly, not only its name. Please no hardcoded > constants assuming some internal encoding knowledge, they are wrong for > non-UTF-8 encodings in any case, use wide chars instead. >=20 > BTW, the same 3 chars restriction is in tar, cpio, pax, lots of ftp > clients, i.e. where 'ls' emulated. >=20 Updated to use wide char functions. tested with ru_RU.UTF-8 and ru_RU.KOI8-= R, fr_FR.UTF-8, ja_JP.eucJP and some chinese locales. Concerning tar and cpio, I can probably push the same thing into bsdtar (wh= ich will fix the same issue they also have on linux), ftp is safe, pax is not a= nd could probably be fixed as well. FYI on linux only ls has been fixed. gnutar uses a different format for its output. Bapt --XRI2XbIfl/05pQwm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlZPz54ACgkQ8kTtMUmk6EwMTQCeNqfmdFtXf7+cB7Kx7XPxO6ZZ nNoAoJFJL5NLcwkQoXkvo8/lTZaRCdOH =u3F3 -----END PGP SIGNATURE----- --XRI2XbIfl/05pQwm--