Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 29665 - bash doesn't show stressed letters in 'cd' error message
Summary: bash doesn't show stressed letters in 'cd' error message
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-26 05:07 UTC by Julien Allanos (RETIRED)
Modified: 2004-07-29 08:25 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Allanos (RETIRED) gentoo-dev 2003-09-26 05:07:32 UTC
I'm using bash-2.0.5b-r5, LC_ALL=fr_FR@euro (yes I'm french :) and CONSOLEFONT="lat9w-16".
When I "cd some_dir_that_doesn't_exist", I get the following error message :
"-bash: cd: some_dir_that_doesn't_exist: Aucun fichier ou r?pertoire de ce type"

It seems that the stressed letter "
Comment 1 Julien Allanos (RETIRED) gentoo-dev 2003-09-26 05:07:32 UTC
I'm using bash-2.0.5b-r5, LC_ALL=fr_FR@euro (yes I'm french :) and CONSOLEFONT="lat9w-16".
When I "cd some_dir_that_doesn't_exist", I get the following error message :
"-bash: cd: some_dir_that_doesn't_exist: Aucun fichier ou r?pertoire de ce type"

It seems that the stressed letter "é" is shown as a "?", and this only happens in console mode (I don't see this behaviour under X and with various terms), OR when sshing under X on a remote host.

With others shell like sh or csh it won't happen. Neither with 'ls', 'du' or others. This make me think it is a bash bug.
Comment 2 SpanKY gentoo-dev 2003-09-26 06:49:41 UTC
it's probably your console font considering you say it only happens while
in console ... why not try using a different console font ?
Comment 3 Julien Allanos (RETIRED) gentoo-dev 2003-09-28 11:14:19 UTC
I don't think it comes from the font, because :
I'm in console, I do a "mkdir 
Comment 4 Julien Allanos (RETIRED) gentoo-dev 2003-09-28 11:14:19 UTC
I don't think it comes from the font, because :
I'm in console, I do a "mkdir ééé" followed by a "ls", and I really see "ééé"
and no "???". I mean the font I'm using (lat9w-16) *knows* how to display
stressed letters. I think bash isn't using the right encoding for errors
messages of the "cd" command.
Comment 5 Heinrich Wendel (RETIRED) gentoo-dev 2003-10-01 05:53:49 UTC
it's gone from the official mirror, i added it to distfiles-local
Comment 6 Julien Allanos (RETIRED) gentoo-dev 2003-10-01 14:17:07 UTC
i get the same behaviour with -r7.
Comment 7 Julien Allanos (RETIRED) gentoo-dev 2003-10-01 14:20:23 UTC
this error seems to happen the first time i log in on the console, but if
i run a new shell, i don't get the error, see :

~$ cd foo
-bash: cd: foo: Aucun fichier ou r?pertoire de ce type
~$ bash
~$ cd foo
bash: cd: foo: Aucun fichier ou r
Comment 8 Julien Allanos (RETIRED) gentoo-dev 2003-10-01 14:20:23 UTC
this error seems to happen the first time i log in on the console, but if
i run a new shell, i don't get the error, see :

~$ cd foo
-bash: cd: foo: Aucun fichier ou r?pertoire de ce type
~$ bash
~$ cd foo
bash: cd: foo: Aucun fichier ou répertoire de ce type
~$ exit
exit
~$ cd foo
-bash: cd: foo: Aucun fichier ou r?pertoire de ce type
~$
Comment 9 Ciaran McCreesh 2003-11-01 15:35:11 UTC
I can reproduce this bug. I also see this if I ssh in from another box. If
I ssh or login and run 'bash', I get the accent as expected.
Comment 10 Ciaran McCreesh 2003-11-02 20:10:52 UTC
Here's what I've determined so far:
* ksh does not have this problem
* It's not just fr_FR that has the bugs, pt_GB shows similar results

I hunted down the code that displays that error and added a few debug
strings to it. It's in builtins/cd.def, and it's the last call to
builtin_error() in function cd_builtin().

If I hard-code an accented character into the error string it will
display correctly. It seems to be the call to strerror() that's
causing problems.

The strerror() function comes from glibc, and it's defined in the
header <strings.h>. The implementation starts off in the file
string/strerror.c , and the message is handled by __strerror_r(). This
in turn is in sysdeps/mach/_strerror.c , which makes me never want to
look at another .c file in my life...

The key line is the final return in the function:

  return (char *) _(_sys_errlist_internal[errnum]);

Replacing this with:

  return "~~test>
Comment 11 Ciaran McCreesh 2003-11-02 20:10:52 UTC
Here's what I've determined so far:
* ksh does not have this problem
* It's not just fr_FR that has the bugs, pt_GB shows similar results

I hunted down the code that displays that error and added a few debug
strings to it. It's in builtins/cd.def, and it's the last call to
builtin_error() in function cd_builtin().

If I hard-code an accented character into the error string it will
display correctly. It seems to be the call to strerror() that's
causing problems.

The strerror() function comes from glibc, and it's defined in the
header <strings.h>. The implementation starts off in the file
string/strerror.c , and the message is handled by __strerror_r(). This
in turn is in sysdeps/mach/_strerror.c , which makes me never want to
look at another .c file in my life...

The key line is the final return in the function:

  return (char *) _(_sys_errlist_internal[errnum]);

Replacing this with:

  return "~~test>é<test~~";

Will display the accent correctly. So, I think something's wrong with
either _() or _sys_errlist_internal. _() is a gettext thing, and
_sys_errlist_internal appears to be just a list of messages to be
passed to gettext. I don't speak C, however, so I could be wrong...

BTW, running './asdf', where 'asdf' doesn't exist, will give the same
error message, complete with duff accent.

It's not just that message either. Running 'touch test && ./test'
will give the error: "Permission non accord?e". Again, entering
a subshell will temporarily fix the message.

At this point, I'm not sure if glibc or gettext is to blame...
Comment 12 Ciaran McCreesh 2003-11-02 20:12:43 UTC
Oops, minor correction. For "sysdeps/mach/_strerror.c", read
"sysdeps/generic/_strerror.c" (not sure where that mach came from...).
Comment 13 Seemant Kulleen (RETIRED) gentoo-dev 2003-11-02 20:33:04 UTC
Az, wacha think?
Comment 14 Ciaran McCreesh 2003-11-03 07:37:53 UTC
I have a fix!

Well, actually, I have a wierd ugly hack that prevents this behaviour. I
don't
understand it, but it works for me and I'd be interested in whether it fixes
things for others.

If LC_ALL is set in .bashrc, adding the following line immediately after
the
EXPORT will give correct accents:

cd /fixforbug29665 >/dev/null 2>&1

Where /fixforbug29665 is some directory that doesn't exist.

If LC_ALL is set in /etc/profile, adding the above line immediately after
the
EXPORT seems to work too.

Some further notes, which may help anyone who's looking for the actual cause
of the bug...

* The redirect isn't necessary, but not having it may break scp and the like
* If the redirect isn't there, the accent displays correctly
* Adding in an echo or eval echo instead of the cd doesn't fix it
* Adding in a different bash internal, such as ./fixtheaccentbug, will fix
it
* I can't find a french error message that doesn't contain an accent, so
I
  can't be sure whether or not the error is only fixed if the output contains
  a dodgy character. I can test if someone can give me the relevant message...
* Adding in 'cd ~' or anything else that produces no error doesn't fix it
Comment 15 Martin Schlemmer (RETIRED) gentoo-dev 2003-11-03 14:10:03 UTC
NLS issue with bash ?  There is a patch frm MDK here:

 
http://cvs.mandrakesoft.com/cgi-bin/cvsweb.cgi/~checkout~/SPECS/bash/bash-2.05-i18n-0.5.patch?rev=1.1&content-type=text/plain

but it does not apply, so I assume that some of the others are needed ...
Comment 16 Aron Griffis (RETIRED) gentoo-dev 2004-07-29 08:25:13 UTC
I've tested this in bash-3.0, it's fixed there