Bug 56513 - cal doesn't honor first_weekday value from locale
cal doesn't honor first_weekday value from locale
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: util-linux (Show other bugs)
7.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Elliot Lee
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-11-20 08:16 EST by Christian Rose
Modified: 2007-04-18 12:38 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-11-20 08:16:48 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Christian Rose 2001-11-20 08:16:43 EST
When I use "cal" on Red Hat Linux 7.2 (with LC_ALL=sv_SE), I get:

      november 2001
  sv me ti on to fr lv 
               1  2  3
   4  5  6  7  8  9 10
  11 12 13 14 15 16 17
  18 19 20 21 22 23 24
  25 26 27 28 29 30
In other words, Sunday is shown as the first day of the week. This is wrong
for the Swedish locale, where the first day of week should be Monday.
If I use "cal -m" I get the correct behavior, but it is troublesome that
cal doesn't automatically adopt to the locale. The first day of week
information is easily fetchable on glibc 2.2 systems by querying the
_NL_TIME_FIRST_WEEKDAY variable with nl_langinfo(), or from the commandline
with "locale first_weekday".

It would be great if cal could be extended to use this information (if
present) by default.
Comment 1 Elliot Lee 2001-11-20 11:37:24 EST
This is probably something that the util-linux maintainer should handle
directly. Please contact util-linux@math.uio.no with this request, and then we
will pull the fixes from upstream.
Comment 2 Martin Norback 2001-11-20 12:19:01 EST
Looking at the latest version of util-linux, you find that the following trivial
patch will fix this. However, you can also clearly see why it's not fixed :)

--- util-linux-2.11m/misc-utils/cal.c	Mon Sep  3 01:45:24 2001
+++ util-linux-2.11m/misc-utils/cal.c.new	Tue Nov 20 14:14:11 2001
@@ -199,10 +199,8 @@
 	bindtextdomain(PACKAGE, LOCALEDIR);
 	textdomain(PACKAGE);
 
-#if 0				/* setting week1stday is against man page */
 #ifdef HAVE_langinfo_h
 	week1stday = (int)(nl_langinfo(_NL_TIME_FIRST_WEEKDAY))[0];
-#endif
 #endif
 	
 	yflag = 0;
Comment 3 Christian Rose 2001-11-21 07:13:44 EST
Mail sent to util-linux@math.uio.no.
Comment 4 Martin Norback 2001-11-23 10:01:31 EST
Also see bug #56657

Note You need to log in before you can comment on or make changes to this bug.