This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ITA] - base-files


On 9 December 2010 06:29, David Sastre wrote:
> On Wed, Dec 08, 2010 at 11:21:38PM +0000, Andy Koppe wrote:
>> On 8 December 2010 21:22, David Sastre wrote:
>> > I have decided to pull out of /etc/profile the case switch that tries
>> > to detect the shell and sets PS1 (and HOSTNAME) accordingly.
>> > The reason for this change is that all of bash, mksh, zsh and tcsh, provide
>> > their own files for doing that job. The result is a lighter /etc/profile
>> > that sets a minimun PS1='$ ' that will be used by posh and dash (the only
>> > two shells in the repo that lack specific startup files), allowing shells
>> > that do have that files to alter this setting(s).
>> > Notice that neither posh nor mksh, despite being ksh derivatives, read
>> > /etc/ksh.kshrc nor ~/.kshrc.
>> >
>> > (I=interactive,L=login,N=non-interactive,B=bash,M=mksh,Z=zsh,T=tcsh,O=posh,dash,!=not)
>> > BL=> /etc/profile -> ~/.bash_profile -> ~/.bashrc -> /etc/bash.bashrc
>>
>> That's not going to work for people whose .bash_profile and .bashrc
>> don't adhere to that pattern or who don't have those files for
>> whatever reason, i.e. they'll suddenly get the default "$ " prompt.
>>
>> > BI!L=> /etc/bash.bashrc -> ~/.bashrc
>>
>> Doesn't /etc/bash.bashrc end up being sourced twice here, due to
>> ~/.bashrc including it.
>
> As far as I tested, it doesn't. It happens like I described above.
> I'll repeat the tests, though.

Hang on, /etc/bash.bashrc isn't an official bash startup file, is it?
So it depends on ~/.bashrc sourcing it, i.e. that line should say:

 BI!L=> ~/.bashrc -> /etc/bash.bashrc

That explains why it isn't sourced twice.

> FYI, the way I did it was placing a line like this:
> TEST_RC=$TEST_RC:/name/of/the/file
> in every startup file, and echeoing the var after opening the shell,
> both interactive-login and interactive non-login.
> And in the case some peolple don't use this layout, well, AFAICT, if
> they don't use the default, they are supposed to know what they're
> doing, right?

Sure, but that doesn't mean that breaking existing setups that don't
follow the /etc/skel layout is a good idea. I'd expect lots of
questions about how to fix the prompt.

>> I think your startup file list should distinguish between files that
>> are automatically sourced by the shell and those that are sourced by
>> other startup files.
>
> All of those files are automatically sourced, depending on the shell
> being a login shel or an interactive shell. That's exactly what I'm
> trying to get advantage of. To be fair, in the case of a login shell,
> we force the course of things, but also does ~/.bash_profile in 3.9-3.

That's the point I was trying to make. A bash login shell only
automatically sources the *profile files, not the *bashrc files. Users
have every right to customise their ~/.bash_profile and ~/.bashrc to
death, or to just delete them. Or perhaps they didn't have them in the
first place because they nominated an existing directory as their home
without copying the skel files. So there's no guarantee that ~/.bashrc
and /etc/bash.bashrc are sourced by a bash login shell.

Andy


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]