Bug 126539 - zprofile should source profile
zprofile should source profile
Status: CLOSED DUPLICATE of bug 225454
Product: Fedora
Classification: Fedora
Component: zsh (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Christopher Aillon
: Reopened
: 226344 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2004-06-22 18:14 EDT by C C Magnus Gustavsson
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-04-16 11:24:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Screenshot displaying the gnome-terminal window (82.89 KB, image/jpeg)
2004-06-25 10:05 EDT, C C Magnus Gustavsson
no flags Details
Attach 1 - language setup for user 'test' (42.49 KB, image/png)
2004-06-28 10:58 EDT, Piero Serini
no flags Details
Attach 2 - all chars are displyed correctly (277.26 KB, image/png)
2004-06-28 11:01 EDT, Piero Serini
no flags Details
A patch for /etc/zprofile which solves this bug. (296 bytes, patch)
2004-06-29 13:27 EDT, C C Magnus Gustavsson
no flags Details | Diff
A better version of the previous patch perhaps? (291 bytes, patch)
2004-06-29 13:51 EDT, C C Magnus Gustavsson
no flags Details | Diff

  None (edit)
Description C C Magnus Gustavsson 2004-06-22 18:14:53 EDT
Description of problem:
[I'm surprised this isn't reported yet (as far as I can see). I'm
including /etc/sysconfig/i18n and /root/anaconda-ks.cfg below in case
I've done something during installation to cause this.]

I've chosen Swedish as system language, and I get Swedish during boot
as well as in the login screen. Once logged in using GNOME I get an
English environment however. Apart from the English menus, I'm unable
to use other characters then ASCII in gnome-terminal because of this.
(I've tried German as well with the same result.)

LANG is not set. I havn't figured out why that is but it seems to be
the cause of the problems; starting an xterm, sourcing /etc/profile
(thereby setting LANG to sv_SE) and from that running gnome-terminal
solves all problems.

(I've installed and am using zsh by the way, if that makes any

How reproducible:
Always, most likely?

Steps to Reproduce:
1. Install Fedora Core 2 as below

Actual results:
English environment

Expected results:
Swedish environment

Additional info:

as8-4-4:~% cat /etc/sysconfig/i18n
as8-4-4:~% cat /root/anaconda-ks.cfg
# Kickstart file automatically generated by anaconda.
lang sv_SE.UTF-8
langsupport --default sv_SE.UTF-8 en_US.UTF-8 sv_SE.UTF-8
keyboard sv-latin1
xconfig --card "Matrox Millennium II" --videoram 4096 --hsync 30-69
--vsync 48-125 --resolution 1024x768 --depth 24 --startxonboot 
--defaultdesktop gnome
network --device eth0 --bootproto static --ip --netmask --gateway --nameserver, --hostname as8-4-4.lk.bonet.se
rootpw --iscrypted $1$0.ClqaRT$TSxJbxojzyPuZhBXPa1W0.
firewall --disabled
selinux --disabled
authconfig --enableshadow --enablemd5
timezone Europe/Stockholm
bootloader --location=mbr
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --linux
#part / --fstype ext3 --onpart hda1
#part swap --onpart hda2
@ office
@ gnome-desktop
@ dialup
@ editors
@ system-tools
@ authoring-and-publishing
@ base-x
@ sound-and-video
@ printing
@ graphics
@ swedish-support
@ development-tools
@ games
@ text-internet
@ graphical-internet
Comment 1 C C Magnus Gustavsson 2004-06-22 18:30:43 EDT
And by that I managed to send my encrypted root password to the entire
world, together with hostname and IP number... Well, I guess it was
time to change it anyway.
Comment 2 Piero Serini 2004-06-23 04:56:00 EDT
Definetely :)

Seriously, have you tried to select Swedish as your
language at the login screen and hit 'set as default'
when the system asks?

i.e. before loggin in, select Language->Swedish in the
'Language' menu on the left.

What happens?
Comment 3 C C Magnus Gustavsson 2004-06-23 07:32:28 EDT
Thanks. I didn't think of looking there.

That partially solves the problem. That is, I get Swedish menus and
can type non-ASCII characters now. However, file names are not
displayed or matched correctly, and if I type a non-ASCII character
and delete it again it's only partially gone. That is, it seems I get
sv_SE.UTF-8. I'd like to have sv_SE (ISO 8859-1).

And in either case, choosing system default as language setting
obviously doesn't work correctly.
Comment 4 Piero Serini 2004-06-25 08:50:55 EDT

Could you please create an attachment here with a screenshot
showing the 'file names not displayed correctly', so that we
all can have an idea?

Comment 5 C C Magnus Gustavsson 2004-06-25 10:05:10 EDT
Created attachment 101410 [details]
Screenshot displaying the gnome-terminal window
Comment 6 C C Magnus Gustavsson 2004-06-25 10:08:00 EDT
Certainly. Thank you for your effort.

I think it's pretty clear why it is this way: The filenames are in ISO
8859-1 and GNOME expects UTF-8. The problem is: How do I get it to be
sv_SE (system default) instead of sv_SE.UTF-8 or en_US? And why didn't
I get the system default to begin with?

(Damn it! I really hate these kinds of problems. After all the
troubles we had when moving from ISO 646-SE to ISO 8859-1 I thought it
was finally over. Now it seems we have to do it all over again. UTF-8
is a good idea for network protocols. I'm not sure it's such a good
idea internally in operating systems...)
Comment 7 Piero Serini 2004-06-28 10:58:34 EDT
Created attachment 101467 [details]
Attach 1 - language setup for user 'test'
Comment 8 Piero Serini 2004-06-28 10:59:54 EDT
Comment on attachment 101467 [details]
Attach 1 - language setup for user 'test'


It seems the opposite as you think: the problem seems to be
that you selected sv_SE instead of sv_SE.UTF-8.

I did the following: on a FC2 fresh installation, on
which the system language is en_US.UTF-9, I created a
test user selefting for it Swedish as the language.

Now, this user logs as in this screenshot (see attach).
Comment 9 Piero Serini 2004-06-28 11:01:55 EDT
Created attachment 101468 [details]
Attach 2 - all chars are displyed correctly

Now, taker a look at this attach.

You can see that all national chars are displayed correctly, and
I can create a file with local chars in its name, and then list
it correctly.
Comment 10 Piero Serini 2004-06-28 11:17:10 EDT
Please do the following:

- edit /etc/sysconfig/i18n and set:

- reboot your machine

This is to get rid of any localization at boot time. Your
computer should now boot in English, and use English as
the defualt language for users (BTW, setting system lang
to 'en_US.UTF-8' or even better to 'C' locale is something
I love. Users settings are different).

- as soon as you computer boots, log in as root (who should
have no particular setting) in a text console, and add an
user 'test'. Set its password.

- Immediately afterwards, log in into an X session, selecting
  'Swedish' as language. Make it default for user 'test'.
  (Language -> Swedish -> Make default? Yes)

- Go to preferences (yes I found them in swedish but don't ask
  me the name, it's something like Installningar :), keyboard,
  Layout, set the appropriate layout (this is just to make you
  input in swedish, in case your system keyboard is not properly

- You should be able to open a terminal, run rpm -qi kernel, and
  see the correct characters like in my screenshot above.

If not, please let me know.

If 'test' is correct, backup your data, remove your user, its home,
and add it again :)


P.S. There's a typo in comment 8 above: system LANG is
en_US.UTF-8 of course, not UTF-9 :)
Comment 11 C C Magnus Gustavsson 2004-06-28 11:36:36 EDT
That didn't help at all. Sorry.

Yes, of course I realize that I can set the system to use UTF-8, and
I'm perfectly well aware of how to do that. That's the default after
all. But the thing is: I don't want UTF-8. I want the system set to
ISO 8859-1 (sv_SE) as it is now, and I want to get GNOME to respect
that as well. Not ASCII. Not UTF-8.

The reason is not only that my hard drive is filled with names in ISO
8859-1, but I have a lot of CD:s which are as well. And mixing
character encodings would be a major pain in the aft region in this
case. Perhaps if I transfer it all to some new media in the future I
might consider going through all the work of moving to another
encoding, but that time is not now.

(If it is the intention of Red Hat and the Fedora crew to support only
UTF-8 in the future I guess it's time for me to look around for a new
Comment 12 C C Magnus Gustavsson 2004-06-28 11:47:14 EDT
And as you can see from anaconda-ks.cfg above, the system was set to
sv_SE.UTF-8 initially (choosing ISO 8859-1 at installation is not
possible). I explicitly changed it. So I don't just want the system
and GNOME to use the same settings. I want GNOME to use ISO 8859-1.
Perhaps I've not been clear about that. In that case I appologize.
Comment 13 C C Magnus Gustavsson 2004-06-28 11:48:49 EDT
(And in all my previous installations of Red Hat, GNOME has used the
system settings with no problems whatsoever.)
Comment 14 Havoc Pennington 2004-06-28 12:09:11 EDT
Does it work with bash (i.e. does this only happen with zsh), just as
a way to narrow it down?

ISO-8859-1 is supported if you set it explicitly, though the UI
encourages only UTF-8.

Comment 15 C C Magnus Gustavsson 2004-06-28 13:14:46 EDT
Ah. Yes, if I change the shell from zsh to bash everything works
Comment 16 Havoc Pennington 2004-06-29 04:14:02 EDT
So the question is why /etc/profile.d/lang.sh (sourced from
/etc/profile) doesn't get run or doesn't work with zsh...
Comment 17 C C Magnus Gustavsson 2004-06-29 07:58:54 EDT
Yeah. I spent a few hours reading documentation and looking around
(mainly in /etc/X11/) yesterday with no success. I'm certainly no
expert on what goes on when logging into GNOME though. Sourcing
lang.sh in Init or the *Session* directories under /etc/X11/gdm/
doesn't seem to do much good though. 

Well. As a very ugly, temporary fix changing the shell to bash and
using the following works at least:

as8-4-4:~% cat .bashrc
# .bashrc
if [ "$TERM" = "linux" -o "$TERM" = "xterm" ]; then
        exec zsh
Comment 18 C C Magnus Gustavsson 2004-06-29 11:11:25 EDT
Interestingly enough, everything works fine with tcsh as well.
Comment 19 C C Magnus Gustavsson 2004-06-29 13:27:32 EDT
Created attachment 101509 [details]
A patch for /etc/zprofile which solves this bug.
Comment 20 C C Magnus Gustavsson 2004-06-29 13:28:21 EDT
Well. I've solved the problem. The solution is more or less given
above, but I guess it was to simple since I didn't come to think of it
earlier: /etc/profile simply doesn't get sourced anywhere, and thus
not /etc/profile.d/lang.sh either. I sure didn't expect that to turn
out to be the problem when I opened this bug. :-)

I suggest the attached patch to be applied and an updated package of
zsh released. The added lines have been included in /etc/zprofile in
zsh packages distributed with previous versions of Red Hat. It would
be interesting to know why they were removed.

(I've changed the component from gnome-session to zsh now as well.)
Comment 21 C C Magnus Gustavsson 2004-06-29 13:51:00 EDT
Created attachment 101511 [details]
A better version of the previous patch perhaps?

Well. Or this one, which seems more in line with how things are done in the
/etc files nowadays. Or maybe add parts of /etc/profile to /etc/zprofile. As
long as /etc/profile.d/lang.sh gets included in some way...
Comment 22 C C Magnus Gustavsson 2004-06-29 15:06:14 EDT
And while I'm at it:

It might also be a good idea to include the end of /etc/bashrc in
/etc/zshrc, since some of the files in /etc/profile.d/ (such as
colorls.sh) should be sourced in shells which are not login shells.
Comment 23 Jens Petersen 2004-07-05 02:42:12 EDT
Hmmm, the current behaviour comes from bug 65509.
Btw this is a duplicate of bug 102187.

Looking back now, I start to think that indeed you're right
that /etc/zprofile is probably the right place to source profile.
Comment 24 Jens Petersen 2004-07-05 02:50:13 EDT
By comment 22, you mean this:

    if [ "x$SHLVL" != "x1" ]; then # We're not a login shell
        for i in /etc/profile.d/*.sh; do
	    if [ -r "$i" ]; then
	        . $i
	unset i

Comment 25 Jens Petersen 2004-07-05 03:12:47 EDT
Should get fixed in 4.2.0-3.
Comment 26 Jens Petersen 2004-07-05 03:44:43 EDT
Thank you for the report and for looking into this carefully.

*** This bug has been marked as a duplicate of 102187 ***
Comment 27 C C Magnus Gustavsson 2004-07-05 08:08:01 EDT
> Btw this is a duplicate of bug 102187.

Well. At the time, I didn't exactly think of searching for zsh related

Are you sure it's a good idea to change the summary for this one? If
another person encounters it as a GNOME-related language problem
he/she probably won't find it either.
Comment 28 C C Magnus Gustavsson 2004-07-05 08:09:44 EDT
> By comment 22, you mean this:
>     if [ "x$SHLVL" != "x1" ]; then # We're not a login shell
>         for i in /etc/profile.d/*.sh; do
> 	    if [ -r "$i" ]; then
> 	        . $i
> 	    fi
> 	done
> 	unset i
>     fi
> presumably?


I'm not sure it's such a good idea to mix things which should be run
in login shells with things which should be run in all interactive
shells in /etc/profile.d/. But that's the way it's done for bash, so I
guess it should be for zsh as well. Sourcing it in zprofile only is
not enough, which I guess was the reason it was put in zshenv.
Comment 29 C C Magnus Gustavsson 2004-07-05 08:21:07 EDT
But sourcing /etc/profile.d/lang.sh should most definately not be done
in ~/.zshrc, considering what it does. That should be done in a system

Putting the extra /etc/zshrc lines above in ~/.zshrc instead is an
option however, although I think it would be much better to have it in
the former (an option not availible in bash).
Comment 30 Piero Serini 2004-07-17 13:10:09 EDT
I've seen the bug is closed, sorry both for not being useful
(I didn't even think of zsh initialization being the problem)
and for leaving for a while w/out a warning, but it wasn't

Comment 31 Jens Petersen 2004-08-05 04:21:56 EDT
Magnus, the sourcing of /etc/profile.d/*.sh is in zshrc now. :)
Comment 32 Red Hat Bugzilla 2006-02-21 14:04:12 EST
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.
Comment 33 Daniel Qarras 2007-01-30 16:10:20 EST
> Magnus, the sourcing of /etc/profile.d/*.sh is in zshrc now. :)

This is wrong. This will override user settings in ~/.zprofile. Please see zsh
man pages or consult the zsh mailing lists if in doubt but don't do this.
Something related is at Bug 225454.

/etc/profile should be sourced in /etc/zprofile ONLY.

Comment 34 Jens Petersen 2007-01-30 19:37:11 EST
Feel free to reopen bug 102187 or this if you feel there is a problem.
Comment 35 Daniel Qarras 2007-01-31 00:09:00 EST
I would but I can't. Shall I file a new bug?
Comment 36 Jens Petersen 2007-01-31 18:56:04 EST
*** Bug 226344 has been marked as a duplicate of this bug. ***
Comment 37 Jens Petersen 2007-01-31 18:57:33 EST
Reopening for discussion based on comment 33.
Comment 38 Jens Petersen 2007-01-31 18:58:47 EST
Moving from fc2 to fc6 because of bug 226344.
Comment 39 Matěj Cepl 2007-02-01 04:23:24 EST
First, fix the Summary (this has nothing to do with language in Gnome anymore)
and then -- could we please consolidate all this madness into bug 225454?
Comment 40 Daniel Qarras 2007-04-14 12:21:36 EDT
So, what's the plan with this bug? I think Bug 225454#c6 pretty well summarizes
the current situation with zsh init scripts and this one could be closed.
Comment 41 Matěj Cepl 2007-04-16 11:24:27 EDT
you are right.

*** This bug has been marked as a duplicate of 225454 ***

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