Web lists-archives.com

Re: [Mingw-msys] Re: Is there a MinGW winapi macro defined?




On 17/7/2010 15:28, Andy Koppe wrote:
> Mintty needs to know the user's home directory to be able to
> load/store its settings from/to ~/.minttyrc. HOME is set in
> /etc/profile,  but unfortunately that's too late for mintty, since of
> course the profile is only sourced by the shell invoked by mintty.
> Therefore, if HOME isn't set, mintty assumes that the user's home
> directory is at /home/<loginname>, whereby the login name is obtained
> through getlogin(). Is that reasonable?

I see the problem. Maybe parse the output of

/bin/sh -l -c "echo $HOME"?

Or maybe start mintty from bash with a shortcut like:

sh -l -c "/bin/mintty&"

> Futhermore, I noticed that it makes a difference how bash is told to
> act as a login shell. From the bash manual: "A login shell is one
> whose first character of argument zero is  a -, or one started with
> the --login option." If invoked with the --login option, things behave
> as expected and HOME ends up being set to /home/$LOGNAME by
> /etc/profile. Yet if it's invoked with argv[0] set to "-bash", HOME is
> set to / (i.e. the root directory) before /etc/profile is sourced.
> This can be seen by going to the MSYS bin directory in a cmd prompt
> and running 'rxvt -ls', or by copying bash to '-bash' and invoking
> that. Any idea why this happens?

I can reproduce it. No idea yet why this happens.

> Same thing would happen with mintty if invoked with 'mintty -' (which
> in the same way as rxvt's -ls option prepends a '-' to the user's
> default shell), except that I've added a hack that sets HOME to
> /home/<loginname> if it's not already set. But on second thoughts,
> mintty shouldn't really be doing that. So should I remove that hack?

I guess it could interfere with local customizations.

Regards,
Cesar



------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Mingw-msys mailing list
Mingw-msys@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/mingw-msys