From owner-freebsd-questions@freebsd.org Sun Jul 19 17:57:37 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42736364CB9 for ; Sun, 19 Jul 2020 17:57:37 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B8syR3tGmz3Zm5 for ; Sun, 19 Jul 2020 17:57:35 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de ([94.222.26.105]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPA (Nemesis) id 1MjSHc-1khr3m0umg-00ktHG; Sun, 19 Jul 2020 19:57:32 +0200 Date: Sun, 19 Jul 2020 19:57:31 +0200 From: Polytropon To: mbj@mbjnet.dk Cc: Morten Bo Johansen via freebsd-questions , Morten Bo Johansen Subject: Re: Locale oddity Message-Id: <20200719195731.66f8ea30.freebsd@edvax.de> In-Reply-To: References: Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:YxeQVg6taKXKXfSD1BLL7JWBZcLwy6vQAo++9uGPYLDEcki9qQP qSIZyNgVIKBSP7findoIak2sJeZljRNfq+kQXMSj8FcciXdxopshc9IwjkF3Xp28SugUBbi g5Zr2x2XMJSYjBfPoPCWabkZZc0heAzJMzc91yQyH/8WkkP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im=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@edvax.de has no SPF policy when checking 217.72.192.74) smtp.mailfrom=freebsd@edvax.de X-Spamd-Result: default: False [3.54 / 15.00]; HAS_REPLYTO(0.00)[freebsd@edvax.de]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; HAS_ORG_HEADER(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[94.222.26.105:received]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8560, ipnet:217.72.192.0/20, country:DE]; ARC_NA(0.00)[]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(0.11)[0.106]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[edvax.de]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.41)[0.410]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.63)[0.629]; MID_CONTAINS_FROM(1.00)[]; RCVD_IN_DNSWL_NONE(0.00)[217.72.192.74:from]; R_SPF_NA(0.00)[no SPF record]; RWL_MAILSPIKE_POSSIBLE(0.00)[217.72.192.74:from]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jul 2020 17:57:37 -0000 On Sun, 19 Jul 2020 19:14:44 +0200, Morten Bo Johansen via freebsd-questions wrote: > If I unset the $LANG variable, then all other LC_* category > locale variables will automatically be set to "C" except for > the $LC_ALL variable: > > ~/ % LANG= locale > LANG= > LC_CTYPE="C" > LC_COLLATE="C" > LC_TIME="C" > LC_NUMERIC="C" > LC_MONETARY="C" > LC_MESSAGES="C" > LC_ALL= > > Otherwise they are: > > ~/ % locale > LANG=da_DK.UTF-8 > LC_CTYPE="da_DK.UTF-8" > LC_COLLATE="da_DK.UTF-8" > LC_TIME="da_DK.UTF-8" > LC_NUMERIC="da_DK.UTF-8" > LC_MONETARY="da_DK.UTF-8" > LC_MESSAGES="da_DK.UTF-8" > LC_ALL= > > I don't understand this behaviour. Could someone explain the > logic of this to me? There is a certain "precedence" in the language variables: IF $LANG is set, all others are ignored; if $LC_ALL is set, all other $LC_*s will be ignored. You can find more information in "man 3 setlocale": Only three locales are defined by default, the empty string "" which denotes the native environment, and the "C" and "POSIX" locales, which denote the C language environment. [...] By default, C programs start in the "C" locale. The Handbook also has detailed information in section 22.2. https://www.freebsd.org/doc/handbook/using-localization.html So what you see is correct and expected: All $LC_* variables except $LC_ALL will default to "C", otherwise they will inherit what $LANG contains; $LC_ALL will not be set automatically to anything. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...