Le jeudi 4 juillet 2013 13:29:39, Osamu Aoki a écrit : > Hi, > > On Wed, Jul 03, 2013 at 11:59:15PM +0200, Thomas Preud'homme wrote: > > Le dimanche 23 juin 2013 21:34:59, Thomas Preud'homme a écrit : > > > Sorry for the spam but I just found it. It was just in front of me. > > > /etc/kde4/kdm/Xsession contains the following excerpt: > > > > > > case $SHELL in > > > [SNIP bash case] > > > > > > */zsh) > > > > > > [ -z "$ZSH_NAME" ] && exec $SHELL $0 "$@" > > > emulate -R zsh > > > > > > I've seen several occurences in kdm's code to set the SHELL environment > > > variable. So later Xsession is executed, $SHELL is detected to be zsh > > > so it exec zsh /etc/kde4/kdm/Xsession $otherargs which set zsh to zsh > > > emulation mode and then source /etc/X11/Xsession. I suppose the bug > > > could be fixed by setting zsh to sh emulate mode. > > > > So I'm running with emulate -R sh instead of emulate -R zsh since I wrote > > this message and it seems to work fine. I get working ibus in both GTK > > and Qt while it wasn't the case before and the session is started > > without any visible glitch. So I intend to reassign the bug with a > > little explanation to kdm package in the next days. > > Yes please. I also found zsh behavior odd.
Ok, reassigning after this mail. It's not a bug, it's a feature™. Zsh has lots of "odd" behavior like this. See for instance: # With zsh % foo="bar baz" % for name in $foo ; do echo "name: $name" ; done name: bar baz # With bash % foo="bar baz" $for name in $foo ; do echo "name: $name" ; done name: bar name: baz Although it's disturbing when compared to bash, I find it a better default. > > === DASH === > > $ EEE=$(ls /usr/lib/*/gtk-2.0/*/immodules/im-ibus.so > /usr/lib/gtk-2.0/*/immodules/im-ibus.so) ls: cannot access > /usr/lib/gtk-2.0/*/immodules/im-ibus.so: No such file or directory $ echo > $EEE > /usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-ibus.so > $ ls /usr/lib/*/gtk-2.0/*/immodules/im-ibus.so > /usr/lib/gtk-2.0/*/immodules/im-ibus.so 2>/dev/null > /usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-ibus.so > $ ls /usr/lib/*/gtk-2.0/*/immodules/im-ibus.so > /usr/lib/gtk-2.0/*/immodules/im-ibus.so 1>/dev/null ls: cannot access > /usr/lib/gtk-2.0/*/immodules/im-ibus.so: No such file or directory > > === ZSH === > osamu@goofy ~ % EEE=$(ls /usr/lib/*/gtk-2.0/*/immodules/im-ibus.so > /usr/lib/gtk-2.0/*/immodules/im-ibus.so) zsh: no matches found: > /usr/lib/gtk-2.0/*/immodules/im-ibus.so > osamu@goofy ~ % echo $EEE > > osamu@goofy ~ % ls /usr/lib/*/gtk-2.0/*/immodules/im-ibus.so > /usr/lib/gtk-2.0/*/immodules/im-ibus.so 2>/dev/null zsh: no matches found: > /usr/lib/gtk-2.0/*/immodules/im-ibus.so > osamu@goofy ~ % ls /usr/lib/*/gtk-2.0/*/immodules/im-ibus.so > /usr/lib/gtk-2.0/*/immodules/im-ibus.so 1>/dev/null zsh: no matches found: > /usr/lib/gtk-2.0/*/immodules/im-ibus.so > > The second path is not expected to match anything. That is the same in > dash or bash. But, zsh spits some error message to non-stderr and quits. > EEE is not set either. > > This is strange for me. The thing is zsh's behavior is safer by default. In bash, if a * doesn't match any file it will be left as is. Thus, if you do touch * and there is no file in the current directory, it will create a file named '*'. In zsh, the default is to just returns an error. Bash's behavior can be obtained by setting NOMATCH. Alternatively, you can set NULL_GLOB to replace '*' by nothing. This is explained in the zshexpn man page, in the FILENAME GENERATION section: "The word is replaced with a list of sorted filenames that match the pattern. If no matching pattern is found, the shell gives an error message, unless the NULL_GLOB option is set, in which case the word is deleted; or unless the NOMATCH option is unset, in which case the word is left unchanged." > > Osamu > > PS: The second path is there to support backport etc. This is intentional > and works fine with dash/bash. Yes I know, I figured it out :) Best regards, Thomas
signature.asc
Description: This is a digitally signed message part.