On Sep 17 18:47, David Sastre wrote: > On Fri, Sep 17, 2010 at 04:50:40PM +0200, Corinna Vinschen wrote: > > What's wrong with the proposed patch? The only problem I have with it > > is the fact that it uses tr and sed to find out what shell it's running > > in. There is probably a way to do this without starting more processes. > > Like this: > > > > read x < /proc/self/exename > > case "$x" in > > */bash) > > ... > > */dash|*/ash|*/sh) > > ... > > */ksh) > > ... > > */zsh) > > ... > > * > > ... > > Absolutely nothing is wrong with the patch.
Well, except that it calls tr and sed for a simple job which could be handled entirely in the shell itself, but we had that already... > I'm only thinking about > an unified method for supplying skeletal files, regardless the > shell. I mean, currently /etc/profile includes logic to deal with all kinds > of shells; being mksh an example, a /etc/skel/.mkshrc could be supplied, > to source a system-wide /etc/mkshrc provided by the mksh package, > this is a simplified example taken from Debian: > > case $KSH_VERSION in > *MIRBSD\ KSH*) ;; > *) return 0 ;; > esac > [[ -s /etc/mkshrc ]] && . /etc/mkshrc > > This would be my solution to nº2 and nº3 above, i.e. PS1 is correctly > set and inherited, because every shell that needs it, provides a > system-wide *rc file to set PS1 and HOSTNAME, distributed with that > shell's package. > I think this is positive because it frees /etc/profile from a work > that can be done by the shells on-demand. Base-files would only > provide /etc/defaults/etc/skel/.${SHELL}rc files to source > /etc/${SHELL}rc, installed by the packages, unneeded otherwise. That sounds fine, but it requires that all other shell maintainers play along. I think it makes sense to provide a short term solution which does not involve changing all shell packages. The aforementioned solution should be carefully discussed with all (bourne-like) shell maintainers and released in a collective effort. Who's affected? bash Eric Blake dash Eric Blake mksh Chris Sutcliffe posh Jari Aalto zsh Peter A. Castro pdksh orphaned (I guess we should remove it from the distro) > BTW, mksh is the only *ksh shell in the distro, being pdksh orphaned > and unmaintained upstream. Don't forget posh. Oh, and, btw., whatever ksh derivative you use, it's a ksh. So, IMHO, the startup file for all of them should be /etc/kshrc or /etc/ksh.kshrc. This in turn speaks for keeping the startup files centralized in base-files. But that's just me. I'm not affected anyway, being a long-time tcsh user... > Also, I am curious to know if there is a reason why > /etc/defaults/etc/profile.d/lang.csh is not included in tcsh. The tcsh package only contains files which are part of the upstream tcsh package and we don't have a "default-lang" package, so it seemed quite natural at the time. There are other packages as well, like openssl, which provide *.sh and *.csh profiles. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat