From owner-freebsd-current@freebsd.org Wed Nov 25 14:05:20 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 23E3DA36CA2 for ; Wed, 25 Nov 2015 14:05:20 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) (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 973561BC7 for ; Wed, 25 Nov 2015 14:05:19 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by lfaz4 with SMTP id z4so61629525lfa.0 for ; Wed, 25 Nov 2015 06:05:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type; bh=/XqZMqgeDezPzgoOKmG026elzzJPK0AEq1zZYf43158=; b=L9KZN3ubpcrERXLXYPsOxrO9e4Kz9v8Lnordbk0nq5sdyd5NqcBc7BjLu6cb6B0cop kcaifjT83cm46UfNnnsKGTBox+yegvHqc2F6rXg8HpRzTtZl7gAgGqTHFID7h3m+W05u oqLLG08pwDfcRhJGShlXV5f4nH0FgXJ5S6iSd68mw0rshswlLDz734e9oxZsXvhlf1OL VXrOQY5RHTGXJ+DUvsSGhGnQwxWO2MSgAyBf1PUFN1pxR4zOlxj612HrsQ5jRQT9A5OW gMSa9kcCyFSRQEZ9ptQnCH9nM+6SxkTlhoiclTlXpgI3cZFbp6Ww9RaZ1ZCrC6uPz37F zmUw== X-Gm-Message-State: ALoCoQm78BXkJh8AEOF0/6TymUuAMaFh42A5NsPVmNx8neqCdD+9PAmHfoGXHbgyqa4Fls4rFosh X-Received: by 10.25.145.81 with SMTP id t78mr7841350lfd.86.1448458460649; Wed, 25 Nov 2015 05:34:20 -0800 (PST) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id o67sm3133949lfb.0.2015.11.25.05.34.18 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Nov 2015 05:34:19 -0800 (PST) Subject: Re: /bin/ls formatting broken for non-C(?) locales To: Baptiste Daroussin 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> <5650DACA.2090501@freebsd.org> <20151125001513.GC70014@ivaldir.etoilebsd.net> <56550F69.8050609@freebsd.org> <20151125125325.GB77370@ivaldir.etoilebsd.net> Cc: Ed Schouten , Jilles Tjoelker , "Sergey V. Dyatko" , FreeBSD Current From: Andrey Chernov Message-ID: <5655B8D9.8060805@freebsd.org> Date: Wed, 25 Nov 2015 16:34:17 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151125125325.GB77370@ivaldir.etoilebsd.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5a6HHSNuFHhw07DPRVifHKtfIA4gI4q4w" 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: Wed, 25 Nov 2015 14:05:20 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --5a6HHSNuFHhw07DPRVifHKtfIA4gI4q4w Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 25.11.2015 15:53, Baptiste Daroussin wrote: > What I did for now is set max_month_width to -1 and in ls_strftime I fa= llback on > the plain strftime meaning you keep localized information but the align= ement is > broken as of now. It will be enough. >> 3) wcwidth/wcswidth may return -1 too, it needs to be checked too. > done and truncate the name of the month to the latest valid character I think there is no point for sofisticated truncating, if locale is not valid. F.e. you may truncate to just 1 char. The thing above will be enough for all such cases. > Review updated (if you prefer a diff by mail just tell me, given you do= not have > a phabricator account.) I don't have phabricator. This one if ((n =3D max_month_width - wab_months_width[i]) > 0) { wcslcat(wab_months[i], L" "/* MAX_ABMON_WIDTH */, max_month_width + 1); } should be if ((n =3D max_month_width - wab_months_width[i]) > 0) wcslcat(wab_months[i], L" "/* MAX_ABMON_WIDTH */, n); I.e. you append n spaces and n is the difference between max and current.= --=20 http://ache.vniz.net/ --5a6HHSNuFHhw07DPRVifHKtfIA4gI4q4w Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJWVbjaAAoJEKUckv0MjfbKP6UH/i3wGDoHi0LaQJaLz0JnIkv7 TqGLSQ0P0CxGMhGh1q9CF6VCklNLubpj5WOUto82afpLUF0aHh7GYYJJHVevKEhT fGpPKOqQn4Hlk9EdlYUbYdBejXMfwT7cM+WUkdRpknM+jnRaqTG4dlyFPLayAjTI L3v1V8TfjVRODJDSaNdDNT5B+78TOiYMd294QXzhCBGLA/U1KLpAvW2lutNyNOma pqt05UPrKc6wyDquz+6I4g+NwUNBt37w7/u+shsJX8cP9BwrkHIDWN4O3xJtebXx 4NazKlo7oIS0ykpxzwuJkRY7jzEsxl8IXvrEYnSlezTU2IjjmJTXSfQgcLutapM= =HiLH -----END PGP SIGNATURE----- --5a6HHSNuFHhw07DPRVifHKtfIA4gI4q4w--