Bug 56513 - cal doesn't honor first_weekday value from locale
Summary: cal doesn't honor first_weekday value from locale
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: util-linux
Version: 7.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Elliot Lee
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-11-20 13:16 UTC by Christian Rose
Modified: 2007-04-18 16:38 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-11-20 13:16:48 UTC
Embargoed:


Attachments (Terms of Use)

Description Christian Rose 2001-11-20 13:16:43 UTC
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 16:37:24 UTC
This is probably something that the util-linux maintainer should handle
directly. Please contact util-linux.no with this request, and then we
will pull the fixes from upstream.

Comment 2 Martin Norback 2001-11-20 17:19:01 UTC
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 12:13:44 UTC
Mail sent to util-linux.no.

Comment 4 Martin Norback 2001-11-23 15:01:31 UTC
Also see bug #56657


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