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 10 December 2010 00:05, David Sastre wrote:
> I fail to see how any customised setup would end up broken.
> The skeletal files are copied to the user's $HOME only if $HOME
> doesn't exist and they are never overwritten nor updated; the installation of
> a new base-files package places its defaults in /etc/default/etc and does not
> touch anything that may have been modified by the user in /etc/skel.

The current /etc/skel/.bash_profile sources /etc/bash.bashrc. If a
user's ~/.bash_profile doesn't do that, then the stuff that's moving
from /etc/profile to /etc/bash.bashrc no longer gets sourced. Result:
"Updating Cygwin broke the prompt (and anything that depends on
/etc/profile.d)!".

Speaking of /etc/profile.d, it seems wrong to do that from
/etc/bash.bashrc. The name of the directory suggests that its content
is for login shells only.

>> > 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.
>
> That's true. Unless sourced from /etc/profile. Would that be
> acceptable?

I think that would make sense, but it should only do so when the shell
is an interactive login shell. Here's how to find out:

http://www.gnu.org/software/bash/manual/html_node/Is-this-Shell-Interactive_003f.html

> Debian proposes this in its /etc/bash.bashrc.
> (now I wonder if that's a patch in Debian, a compile-time option for
> bash, or what...)

Zsh sources *profile files in login shells and the *zshrc files in
interactive shells, so an interactive login shell sources both. Hence
stuff that needs to be done once at login (e.g. setting up paths) goes
into *profile, and stuff to make an interactive shell comfortable
(e.g. prompt and aliases) goes into *zshrc. I think that makes plenty
of sense.

Bash isn't going to change in this respect though, so emulating it by
/etc/profile sourcing /etc/bash.bashrc and ~/.bash_profile sourcing
~/.bashrc is the next best thing.

> The whole thing would be:
>
> Â- /etc/profile is the login entry-point for everybody
> Â- There must be a switch for bash/mksh/* (again, but...)

Wasn't there a patch for doing that switch without forks?

> Â- The switch sources the corresponding /etc/${SHELL}rc
> Â- Afterwards, it will read ~/.*profile automatically, so we don't
> Â Âdepend on ~/.bash_profile to have /etc/bash.bashrc sourced.
> Â- Interactive non-login access uses ~/.${SHELL}rc
> Â- There we source /etc/${SHELL}rc. Here, if the line sourcing
> Â Â/etc/bash.bashrc is removed, you're on your own.
> Â Â(and we wouldn't depend on ~/.bashrc either if the actual order was
> Â Â/etc/bash.bashrc -> ~/.bashrc. It's starting to make sense that
> Â Âdebian stuff...)
>
> This requires minimal changes to the existing proposal, and still
> solves a pair of annoyances. Opinions?

Sounds good to me.

Andy


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