From owner-freebsd-current@freebsd.org Sat Nov 21 00:35:47 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 2784DA2E80E for ; Sat, 21 Nov 2015 00:35:47 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (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 ADA031195 for ; Sat, 21 Nov 2015 00:35:46 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by wmec201 with SMTP id c201so93481733wme.0 for ; Fri, 20 Nov 2015 16:35:44 -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=wnmIvwmfy7boHa0Zc6UFFLkQsSU+7pNqozB7YT8hzZw=; b=waPd8K8HD4OLpDfJqoQQwiv7MGhHvI4MFEBs/7f8OFpkO5gDV8zB2pKlMorfoJwRaC w87oRPeoMD/rAj6kR+pAxhr9ncw4QeiRNFqecKw28PxDgLA/TnacpFtdMiNL2du8MHAB ZkdfdI4sd+mCZs2Zc8V9fEVKqlrKzp03FcsCOItpxiQ4zd/qj39P1qnvFsHj1kn4QGiX AMyMJM4JRPGrfNB8kMwg2W1CuKgrRFeVwke/7YagOrhxsRAZD+NuY70QV7bWBa0RjY+m sPhRWkf8irZZNV9YWbo6LdilLU8S0uStD+gS4P0EdWgQ6i+bD+o5k3pOwfb1+KnuUZWz i64g== X-Received: by 10.194.79.72 with SMTP id h8mr19212540wjx.136.1448066144122; Fri, 20 Nov 2015 16:35:44 -0800 (PST) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id c13sm1726097wmd.14.2015.11.20.16.35.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Nov 2015 16:35:43 -0800 (PST) Sender: Baptiste Daroussin Date: Sat, 21 Nov 2015 01:35:41 +0100 From: Baptiste Daroussin To: Jilles Tjoelker Cc: "Sergey V. Dyatko" , freebsd-current@freebsd.org Subject: Re: /bin/ls formatting broken for non-C(?) locales Message-ID: <20151121003541.GF21071@ivaldir.etoilebsd.net> References: <20151120110556.6e20a71f@laptop.minsk.domain> <20151120104253.GA21071@ivaldir.etoilebsd.net> <20151120110212.GB21071@ivaldir.etoilebsd.net> <20151120122352.GA5751@stack.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XIiC+We3v3zHqZ6Z" Content-Disposition: inline In-Reply-To: <20151120122352.GA5751@stack.nl> 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 00:35:47 -0000 --XIiC+We3v3zHqZ6Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 20, 2015 at 01:23:52PM +0100, Jilles Tjoelker wrote: > On Fri, Nov 20, 2015 at 12:02:13PM +0100, Baptiste Daroussin wrote: > > On Fri, Nov 20, 2015 at 11:42:53AM +0100, Baptiste Daroussin wrote: > > > On Fri, Nov 20, 2015 at 11:05:56AM +0300, Sergey V. Dyatko wrote: > > > > subj. http://i.imgur.com/F9QO29l.png > > > > it is on head@r290573: > > > > WTR: > > > > env LC_ALL=3Duk_UA.UTF-8 ls -la /usr/ports/databases/ or env LC_ALL= =3Dru_RU.UTF-8 > > > > ls -la /usr/ports/databases/ >=20 > > > > env LC_ALL=3DC ls -la /usr/ports/databases/ works fine > > > > also on old stable/10 (r286868) as I can see 'month' field length = 3 symbols=20 >=20 > > > Thanks for reporting, I can reproduce the issue with some other > > > locales. The thing is there seems to be no standard for abbreviated > > > length. Formerly we had a 3 character lenght for abbreviated month. >=20 > > > We now use CLDR which seems to follow the abbreviated rules from IBM: > > > "Each string must be of equal length and contain 5 characters or less" >=20 > > > There are 2 possible fixes: either always pad those in the locale > > > definition which seems wrong or modify ls so that it by itself pads > > > properly. >=20 > > > Neither posix nor ISO-14652 defines the length of the abbreviated form >=20 > > > padding in the locales themself would be wrong so I do propose to > > > pad in the ls command. And padding with 5 characters. >=20 > > For the record glibc/linux had the same problem: > > https://sourceware.org/bugzilla/show_bug.cgi?id=3D9859 >=20 > > "fixed" in coreutils (gnu ls) the way I propose to do for us > > http://git.savannah.gnu.org/gitweb/?p=3Dcoreutils.git;a=3Dcommit;h=3D61= 2b647dd16d5abc03b295abe42d8b4a0fe660f7 >=20 > Coreutils fixed it slightly better: it calculates the maximum width of > the abbreviated month names and pads to that (with a maximum of 5). In > particular, this ensures that the output does not change for locales > that have 3-character abbreviations, such as the POSIX locale. I think > this is valuable. >=20 > They also keep the list of month names from this calculation and they > say this speeds up ls noticeably compared to having strftime() expand %b > for every file. Here is what I do propose (sorry for the ugly pad_to_col name, if one has b= etter please share :D https://reviews.freebsd.org/D4239 Best regards, Bapt --XIiC+We3v3zHqZ6Z Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlZPvF0ACgkQ8kTtMUmk6Ex2lQCbBT6irike5A4NGCDAt4aLmR6W lwoAniJw4ESDV4OI5gZd+E4y+HdTRrT8 =AXP7 -----END PGP SIGNATURE----- --XIiC+We3v3zHqZ6Z--