From nobody Sat Oct 30 07:09:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DA41E18186B7; Sat, 30 Oct 2021 07:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hh9R05qqqz4flv; Sat, 30 Oct 2021 07:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A951E262E0; Sat, 30 Oct 2021 07:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19U79mll078040; Sat, 30 Oct 2021 07:09:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19U79mDS078039; Sat, 30 Oct 2021 07:09:48 GMT (envelope-from git) Date: Sat, 30 Oct 2021 07:09:48 GMT Message-Id: <202110300709.19U79mDS078039@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: 20f8331aca89 - main - usr.bin/stat: honour locale for "-t %+" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 20f8331aca892ff812510609b3bc4e747b201197 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=20f8331aca892ff812510609b3bc4e747b201197 commit 20f8331aca892ff812510609b3bc4e747b201197 Author: Stefan Eßer AuthorDate: 2021-10-30 07:00:34 +0000 Commit: Stefan Eßer CommitDate: 2021-10-30 07:00:34 +0000 usr.bin/stat: honour locale for "-t %+" The man page states that "-t %+" prints time information in the same format as date with no format specifier. This was not the case, the format used was always that of date for the POSIX locale. The fix suggested by the reporter leads to output that matches the documentation. Reported by: Jamie Landeg-Jones MFC after: 3 days --- usr.bin/stat/stat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.bin/stat/stat.c b/usr.bin/stat/stat.c index e504333c3329..9d94399a6333 100644 --- a/usr.bin/stat/stat.c +++ b/usr.bin/stat/stat.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -763,6 +764,7 @@ format1(const struct stat *st, ts.tv_sec = 0; tm = localtime(&ts.tv_sec); } + (void)setlocale(LC_TIME, ""); (void)strftime(path, sizeof(path), timefmt, tm); sdata = path; formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX |