Bug 126539 - zprofile should source profile
Summary: zprofile should source profile
Keywords:
Status: CLOSED DUPLICATE of bug 225454
Alias: None
Product: Fedora
Classification: Fedora
Component: zsh
Version: 6
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Christopher Aillon
QA Contact:
URL:
Whiteboard:
: 226344 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-06-22 22:14 UTC by C C Magnus Gustavsson
Modified: 2018-04-11 11:54 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2007-04-16 15:24:27 UTC
Type: ---
Embargoed:


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

Description C C Magnus Gustavsson 2004-06-22 22:14:53 UTC
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
difference.)


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
LANG="sv_SE"
SUPPORTED="en_US.UTF-8:en_US:en:sv_SE.UTF-8:sv_SE:sv"
SYSFONT="latarcyrheb-sun16"
as8-4-4:~% cat /root/anaconda-ks.cfg
# Kickstart file automatically generated by anaconda.
 
install
cdrom
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 217.215.31.97 --netmask
255.255.255.0 --gateway 217.215.31.1 --nameserver
212.181.54.2,212.181.54.3 --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
 
%packages
@ 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
-chromium
-dvd+rw-tools
-openldap-clients
-cdlabelgen
-system-config-packages
-rhgb
-ckermit
-system-config-services
-up2date-gnome
-hwbrowser
-system-config-users
lynx
-dvdrecord
-ttfprint
-system-config-printer-gui
-Maelstrom
xpdf
ncftp
-file-roller
-system-logviewer
fsh
abiword
-tuxracer
-joystick
grub
tetex-xdvi
-system-config-network
-usermode-gtk
xboard
-rhn-applet
ddd
kernel
-authconfig-gtk
-system-config-soundcard
-system-config-date
-vnc-server
-firstboot
e2fsprogs
-system-config-display
 
%post
as8-4-4:~%

Comment 1 C C Magnus Gustavsson 2004-06-22 22:30:43 UTC
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 08:56:00 UTC
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 11:32:28 UTC
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 12:50:55 UTC
Hmmm.

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?

Thanks.

Comment 5 C C Magnus Gustavsson 2004-06-25 14:05:10 UTC
Created attachment 101410 [details]
Screenshot displaying the gnome-terminal window

Comment 6 C C Magnus Gustavsson 2004-06-25 14:08:00 UTC
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 14:58:34 UTC
Created attachment 101467 [details]
Attach 1 - language setup for user 'test'

Comment 8 Piero Serini 2004-06-28 14:59:54 UTC
Comment on attachment 101467 [details]
Attach 1 - language setup for user 'test'

Hello.

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 15:01:55 UTC
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 15:17:10 UTC
Please do the following:

- edit /etc/sysconfig/i18n and set:
LANG="en_US.UTF-8"

- 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
  set).

- 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 :)

Piero


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 15:36:36 UTC
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
distribution.)


Comment 12 C C Magnus Gustavsson 2004-06-28 15:47:14 UTC
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 15:48:49 UTC
(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 16:09:11 UTC
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 17:14:46 UTC
Ah. Yes, if I change the shell from zsh to bash everything works
perfectly.


Comment 16 Havoc Pennington 2004-06-29 08:14:02 UTC
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 11:58:54 UTC
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
fi
as8-4-4:~%


Comment 18 C C Magnus Gustavsson 2004-06-29 15:11:25 UTC
Interestingly enough, everything works fine with tcsh as well.


Comment 19 C C Magnus Gustavsson 2004-06-29 17:27:32 UTC
Created attachment 101509 [details]
A patch for /etc/zprofile which solves this bug.

Comment 20 C C Magnus Gustavsson 2004-06-29 17:28:21 UTC
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 17:51:00 UTC
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 19:06:14 UTC
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 06:42:12 UTC
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 06:50:13 UTC
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?

Comment 25 Jens Petersen 2004-07-05 07:12:47 UTC
Should get fixed in 4.2.0-3.

Comment 26 Jens Petersen 2004-07-05 07:44:43 UTC
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 12:08:01 UTC
> Btw this is a duplicate of bug 102187.

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

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 12:09:44 UTC
> 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?

Yes.

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 12:21:07 UTC
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
file.

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 17:10:09 UTC
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
expected.

Piero

Comment 31 Jens Petersen 2004-08-05 08:21:56 UTC
Magnus, the sourcing of /etc/profile.d/*.sh is in zshrc now. :)

Comment 32 Red Hat Bugzilla 2006-02-21 19:04:12 UTC
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.

Comment 33 Daniel Qarras 2007-01-30 21:10:20 UTC
> 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.

Thanks.

Comment 34 Jens Petersen 2007-01-31 00:37:11 UTC
Feel free to reopen bug 102187 or this if you feel there is a problem.

Comment 35 Daniel Qarras 2007-01-31 05:09:00 UTC
I would but I can't. Shall I file a new bug?

Comment 36 Jens Petersen 2007-01-31 23:56:04 UTC
*** Bug 226344 has been marked as a duplicate of this bug. ***

Comment 37 Jens Petersen 2007-01-31 23:57:33 UTC
Reopening for discussion based on comment 33.

Comment 38 Jens Petersen 2007-01-31 23:58:47 UTC
Moving from fc2 to fc6 because of bug 226344.

Comment 39 Matěj Cepl 2007-02-01 09:23:24 UTC
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 16:21:36 UTC
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 15:24:27 UTC
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.