Re: stat(1) isn't honouring locale
- Reply: Jamie Landeg-Jones : "Re: stat(1) isn't honouring locale"
- In reply to: Jamie Landeg-Jones : "stat(1) isn't honouring locale"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 30 Oct 2021 07:15:19 UTC
Am 29.10.21 um 20:15 schrieb Jamie Landeg-Jones: > stat(1) isn't honouring locale. > > The manual page says: > > -t timefmt > Display timestamps using the specified format. This format is passed directly to strftime(3). > > strftime(3) says: > > %+ is replaced by national representation of the date and time (the format is similar to that produced by date(1)). > > However: > > ----------------------------- > % date > Fri Oct 29 00:14:12 BST 2021 > > % date +%+ > Fri Oct 29 00:14:19 BST 2021 > > % stat -t%+ -f '%Sm' . > Fri Oct 29 00:13:38 BST 2021 > ----------------------------- > > % setenv LANG en_GB.UTF-8 > > % date > Fri 29 Oct 2021 00:14:57 BST > > % date +%+ > Fri 29 Oct 2021 00:15:05 BST > > % stat -t%+ -f '%Sm' . > Fri Oct 29 00:13:38 BST 2021 > ----------------------------- > > Including <locale.h> and adding: > > (void) setlocale(LC_TIME, ""); > > before the call to strftime() in usr.bin/stat/stat.c fixes this > > Is there any reason this isn't in place? Hi Jamie, thank you for reporting this issue and suggesting a fix. I have committed your proposed fix to -CURRENT as Git commit 20f8331aca892ff8 and plan to MFC it to 13-STABLE in a few days. I'm CCing to the release engineer, since this might be a change that we want to include in the upcoming 12.3 release (currently in beta). Regards, STefan