Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 277954

Summary: rox-extra/memo starts week on tuesday
Product: Gentoo Linux Reporter: DEMAINE Benoît-Pierre, aka DoubleHP <dhp_gentoo>
Component: Current packagesAssignee: Rox Herd (OBSOLETE) <rox+disabled>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: /tmp/emerge--info
/usr/share/i18n/locales/fr_FR
/usr/share/i18n/locales/en_GB

Description DEMAINE Benoît-Pierre, aka DoubleHP 2009-07-15 16:02:40 UTC
when i add a memo, the left column is now tuesday. It had been sunday by the past, monday for a time, and now tuesday. This is really confusing.

There are some countries where culture can explain why the week can start on saturday (jews), sunday (catholics), or monday (most other ones), so, I could udnerstand that changing the locale could affect the starting day. But, for tuesday, I really can't see why. I just think it's a bug.

I did not find any place where to configure that.

   * rox-extra/memo-2.1
   Install date: Tue Jun  2 11:43:46 2009
   USE="libnotify"
   CFLAGS="-O2 -march=athlon-mp -pipe"
Comment 1 DEMAINE Benoît-Pierre, aka DoubleHP 2009-07-15 16:02:56 UTC
Created attachment 198075 [details]
/tmp/emerge--info
Comment 2 Jim Ramsay (lack) (RETIRED) gentoo-dev 2009-07-15 17:59:13 UTC
Well, according to the GTK manual the starting weekday in the calendar widget is only controlled by the user's locale.  There was previously an option that could be twiddled to force a Monday start day, but the manual says this:

  Since GTK+ 2.4, this option is deprecated and ignored by GTK+. The
  information on which day the calendar week starts is derived from
  the locale.

So this is probably a locale issue.  I can see that your locale is, according to your 'emerge --info' output: en_GB

Which I believe *should* be starting on a Monday unless something else is going quite wrong with your locales and glibc.

What version of glibc have you installed?

Perhaps stale locale data could be your problem?  Try running 'sudo locale-gen' and then restart Memo to see if that fixes things.

If not, we'll have to dig deeper into locale-gen(8) and locale(5) to solve this issue, I think.
Comment 3 DEMAINE Benoît-Pierre, aka DoubleHP 2009-07-15 18:29:19 UTC
My locales are a mess ... so, let's take an Eterm:

dhp@moon-gen-3:~$ locale
LANG=en_GB.ISO-8859-15
LC_CTYPE="en_GB.ISO-8859-15"
LC_NUMERIC="en_GB.ISO-8859-15"
LC_TIME="en_GB.ISO-8859-15"
LC_COLLATE="en_GB.ISO-8859-15"
LC_MONETARY="en_GB.ISO-8859-15"
LC_MESSAGES="en_GB.ISO-8859-15"
LC_PAPER="en_GB.ISO-8859-15"
LC_NAME="en_GB.ISO-8859-15"
LC_ADDRESS="en_GB.ISO-8859-15"
LC_TELEPHONE="en_GB.ISO-8859-15"
LC_MEASUREMENT="en_GB.ISO-8859-15"
LC_IDENTIFICATION="en_GB.ISO-8859-15"
LC_ALL=en_GB.ISO-8859-15
dhp@moon-gen-3:~$

run Memo from there, and ... week start on tuesday.

   * sys-libs/glibc-2.9_p20081201-r2
   Install date: Sat Jun 27 17:58:27 2009
   USE="gd nls -debug -glibc-omitfp -hardened -multilib -selinux -profile -vanilla -crosscompile_opts_headers-only -${LT_VER:+glibc-compat20 -nptl -nptlonly}"
   CFLAGS="-march=i686 -pipe -O2 -fno-strict-aliasing"

my glibc could be misconfigured.

locale-gen did not help

moon-gen-3 ~ # locale-gen
 * Generating 10 locales (this might take a while) with 1 jobs
 *  ( 1/10) Generating en_GB.ISO-8859-1 ... [ ok ]
 *  ( 2/10) Generating en_GB.ISO-8859-9 ...   [ ok ]
 *  ( 3/10) Generating en_GB.ISO-8859-15 ...    [ ok ]
 *  ( 4/10) Generating en_GB.ISO-8859-15 ...   [ ok ]
 *  ( 5/10) Generating en_GB.UTF-8 ...         [ ok ]
 *  ( 6/10) Generating en_GB.UTF-8 ...      [ ok ]
 *  ( 7/10) Generating fr_FR.ISO-8859-1 ...           [ ok ]
 *  ( 8/10) Generating fr_FR.ISO-8859-15@euro ...      [ ok ]
 *  ( 9/10) Generating fr_FR.UTF-8 ...        [ ok ]
 *  (10/10) Generating fr_FR.UTF-8 ...      [ ok ]
 * Generation complete
moon-gen-3 ~ #

some locales are computed twice ?

/etc/locale.gen:
en_GB ISO-8859-1
en_GB ISO-8859-9
en_GB ISO-8859-15
en_GB.ISO-8859-15 ISO-8859-15
en_GB UTF-8
en_GB.UTF-8 UTF-8

fr_FR ISO-8859-1
fr_FR@euro ISO-8859-15
fr_FR UTF-8
fr_FR.UTF-8 UTF-8

I was not sure which syntax to use ...

After
dhp@moon-gen-3:~$ export LANG=C
dhp@moon-gen-3:~$ export LC_ALL=C
week starts on sunday

en_GB.ISO-8859-1 = tuesday
en_GB.UTF-8 = tuesday
fr_FR.ISO-8859-15@euro = Lundi (monday in french) (oh, it's translated)
fr_FR.UTF-8 = lundi/monday (I prefer EN GUI anyway)
en_GB.ISO-8859-9 = tuesday

souds strange to me that in the second part, the minus goes away :
(I had heavily modified my locale.gen in the mean time)
moon-gen-3 ~ # locale -a
C
en_GB
en_GB.iso88591
en_GB.iso885915
en_GB.iso88599
en_GB.utf8
français
french
fr_FR
fr_FR@euro
fr_FR.iso88591
fr_FR.iso885915
fr_FR.iso885915@euro
fr_FR.utf8
fr_FR.utf8@euro
POSIX
moon-gen-3 ~ #
Maybe it's not important at all.
Comment 4 Jim Ramsay (lack) (RETIRED) gentoo-dev 2009-07-15 20:23:41 UTC
I just did a quick test on my system (glibc-2.10.1) and both en_GB and fr_FR do the right thing, both start on Monday/Lundi.

Can you attach here the contents of these 2 files:

/usr/share/i18n/locales/fr_FR
/usr/share/i18n/locales/en_GB

Let's see what we have there...
Comment 5 DEMAINE Benoît-Pierre, aka DoubleHP 2009-07-15 21:03:51 UTC
Created attachment 198102 [details]
/usr/share/i18n/locales/fr_FR
Comment 6 DEMAINE Benoît-Pierre, aka DoubleHP 2009-07-15 21:04:09 UTC
Created attachment 198103 [details]
/usr/share/i18n/locales/en_GB
Comment 7 DEMAINE Benoît-Pierre, aka DoubleHP 2009-07-15 21:09:03 UTC
IMHO, nothing usefull.

Here is a funny one:

dhp@moon-gen-3:~$ LC_ALL=fr_FR cal
    juillet 2009
di lu ma me je ve sa
          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 31

dhp@moon-gen-3:~$ cal
      July 2009
Su Mo Tu We Th Fr Sa
          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 31

dhp@moon-gen-3:~$

=> cal is lang dependant, and ... both start at sunday. Remember, i said a few messages earlier that Rox starts the french week at Monday ... so <<there are at least two possible ways to make a week depend on locales>>. Cal's one, where everything works fine, and Rox's where everything is "different".
Comment 8 Jim Ramsay (lack) (RETIRED) gentoo-dev 2009-07-16 14:01:13 UTC
(In reply to comment #7)
> => cal is lang dependant, and ... both start at sunday. Remember, i said a few
> messages earlier that Rox starts the french week at Monday ... so <<there are
> at least two possible ways to make a week depend on locales>>. Cal's one, where
> everything works fine, and Rox's where everything is "different".

Actually, I think there's something wrong with either your cal or your locales if fr_FR starts on a Sunday.  Here's what I get:

altair lack # LANG=C cal
      July 2009     
Su Mo Tu We Th Fr Sa
          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 31

altair lack # LANG=en_US cal
      July 2009     
Su Mo Tu We Th Fr Sa
          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 31

altair lack # LANG=en_GB cal
      July 2009     
Mo Tu We Th Fr Sa Su
       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 31

altair lack # LANG=fr_FR cal
    juillet 2009    
lu ma me je ve sa di
       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 31

As you can see, both C and en_US start on Sunday, as expected, and both en_GB and fr_FR also start on Monday, as expected.

This is with:
glibc-2.10.1 (/usr/share/i18n/locales/en_GB)
sys-apps/util-linux-2.15.1 (/usr/bin/cal)
Comment 9 Jim Ramsay (lack) (RETIRED) gentoo-dev 2009-07-16 14:15:21 UTC
(In reply to comment #6)
> Created an attachment (id=198103) [edit]
> /usr/share/i18n/locales/en_GB

Ah, and now I am 100% sure that the problem is in your en_GB locale you just posted.  I just downloaded it (called 'en_BD' so as not to collide with any other locales), ran locale-gen, and look what I got:

altair locales # LANG=en_BD cal
      July 2009     
Tu We Th Fr Sa Su Mo
    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 31

In fact, I just did a quick search and found the same problem reported in bug 275956 -> Marking this one as a duplicate.

*** This bug has been marked as a duplicate of bug 275956 ***
Comment 10 DEMAINE Benoît-Pierre, aka DoubleHP 2009-07-17 00:58:54 UTC
So, playing with /usr/share/i18n/locales/en_GB could fix the problem temporarly ?

this does not explain why cal behaves a different way than Memo.

My locale is actually en_GB.ISO-8859-15 :

dhp@moon-gen-3:~$ LANG=en_GB cal
      July 2009
Su Mo Tu We Th Fr Sa
          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 31

dhp@moon-gen-3:~$ LANG=fr_FR cal
      July 2009
Su Mo Tu We Th Fr Sa
          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 31

dhp@moon-gen-3:~$ LANG=fr_FR LC_ALL=fr_FR cal
    juillet 2009
di lu ma me je ve sa
          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 31

dhp@moon-gen-3:~$

in cal, week always starts on sunday, but i get french translation only when passing LC_ALL, you get translation with just LANG ... why ?

bug 275956 only talks about "the day that starts a week"; and i think there is way more than just that.
Comment 11 Jim Ramsay (lack) (RETIRED) gentoo-dev 2009-07-17 14:06:57 UTC
(In reply to comment #10)
> in cal, week always starts on sunday, but i get french translation only when
> passing LC_ALL, you get translation with just LANG ... why ?

I'm not sure.  My /usr/bin/cal is from sys-apps/util-linux-2.15.1 and I am running a different glibc than you, and I'm pretty sure both of these probably have part of the responsibility of using the locale data correctly.
 
> bug 275956 only talks about "the day that starts a week"; and i think there is
> way more than just that.

I'm really not sure why you are getting weird results with /usr/bin/cal -> If you tell me what package version you are running that provides this program, I could look into it and compare with what I have working perfectly here.

Have you tried the patch I mention in bug 275956?  Does it fix Memo?  Does it fix cal?
Comment 12 DEMAINE Benoît-Pierre, aka DoubleHP 2009-07-17 14:58:32 UTC
   * sys-apps/util-linux-2.14.2
   Install date: Sun May 24 19:27:32 2009
   USE="crypt nls unicode -loop-aes -old-linux -selinux -slang -uclibc"
   CFLAGS="-O2 -march=athlon-mp -pipe"

It's not a patch; there is no attachement; there is just a diff showing the difference between the old, and actual libc.

week first_weekday and first_workday do not alter cal immediately; should I run locale-gen after altering /usr/share/i18n/locales/en_GB ?

does not matter; first_weekday and first_workday can be either 1 or 2, after locale-gen , cal always starts week on sunday (LANG=en_GB LC_ALL=en_GB) while you say it should be monday.

Same with
week    7;19971201;4
or 
week    7;19971130;4

Maybe I should do more than locale-gen ? ie, reload bash ?
Comment 13 DEMAINE Benoît-Pierre, aka DoubleHP 2009-07-17 15:04:43 UTC
(need to run locale-gen after each modification of /usr/share/i18n/locales/en_GB )

week    7;19971201;4
first_weekday 2
first_workday 2

=> Memo = tuesday

week    7;19971201;4
first_weekday 1
first_workday 1

=> monday

week    7;19971130;4
first_weekday 1
first_workday 1
=> sunday

week    7;19971130;4
first_weekday 2
first_workday 2
=> monday
Comment 14 Jim Ramsay (lack) (RETIRED) gentoo-dev 2009-07-17 15:45:17 UTC
(In reply to comment #12)
>    * sys-apps/util-linux-2.14.2

Well, that accounts for the differences you're seeing in cal.  You are running 2.14.2 and I am running 2.15.1

I just installed sys-apps/util-linux-2.14.2 and cal does NOT adhere to locale settings, it always starts the week on a Sunday.  When I install sys-apps/util-linux-2.15.1, cal respects the locale, starting the week on the appropriate day according to the current locale.  So on your system with util-linux-2.14.2, running 'cal' is not a good test case for this issue.  With util-linux-2.15.1 installed 'cal' is a good test case.

> It's not a patch; there is no attachement; there is just a diff showing the
> difference between the old, and actual libc.

Technically, by "patch" I meant "Change the file either by using the 'patch' utility or by manually editing the file".  Also you can just cut&paste the diff into a text file and run the 'patch' utility with that; patch accepts any diff output as input.
 
> week first_weekday and first_workday do not alter cal immediately; should I run
> locale-gen after altering /usr/share/i18n/locales/en_GB ?

Yes, you must run locale-gen after editing your en_GB file for any app to see the change.
Comment 15 Jim Ramsay (lack) (RETIRED) gentoo-dev 2009-07-17 15:52:51 UTC
(In reply to comment #13)
> week    7;19971201;4
> first_weekday 2
> first_workday 2
> 
> => Memo = tuesday
> 
> week    7;19971201;4
> first_weekday 1
> first_workday 1
> 
> => monday
> 
> week    7;19971130;4
> first_weekday 1
> first_workday 1
> => sunday
> 
> week    7;19971130;4
> first_weekday 2
> first_workday 2
> => monday

Good.  Adjusting either the 'week' or 'first_weekday' value adjusts the Memo calendar start day appropriately, and adjusting both of course adjusts the day all the way back to Sunday.  This confirms my conclusion in bug 275956.