OhmNomNom / thyme

A fork of mintty, for the modern world
GNU General Public License v3.0
0 stars 0 forks source link

mintty does not save config when launched from msysGit bin directory #201

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Install msysGit.
2. Copy mintty.exe (msys version) to Git\bin.
3. Create a shortcut to mintty.exe like this:

"D:\Program Files (x86)\Git\bin\mintty.exe" --title msysGit --icon "D:\Program 
Files (x86)\Git\etc\git.ico" --exec "D:\Program Files (x86)\Git\bin\sh.exe" 
--login -i 

4. Launch the shortcut.
5. Change some terminal settings.
6. Close mintty.
7. Launch mintty again via the shortcut.

What is the expected output? What do you see instead?

I'd expect terminal settings (like background color etc.) to be saved, but they 
are not.

What version of the product are you using? On what operating system?

mintty-msys 0.8 beta 1 on Vista x64.

Please provide any additional information below.

Some problem appears when using mintty-cygwin (and also copying cygwin1.dll to 
Git\bin). It seems mintty is relying on some Unix tools like "find" on startup. 
Maybe some of the tools in Git\bin behave differently than those in cygwin\bin, 
resulting in mintty not being able to determine the home directory (and thus 
the path to the default config file).

A work-around is to explicity specify the config file using the "-c" option.

Original issue reported on code.google.com by sschuberth on 14 Jul 2010 at 9:29

GoogleCodeExporter commented 9 years ago
By default, mintty stores its config at $HOME/.minttyrc if HOME is set, or at 
/home/<loginname>/.minttyrc otherwise. This works fine on MSYS proper. It won't 
create any directories though, hence if $HOME and /home/<loginname> don't 
exist, config changes are lost. Using -c is an appropriate workaround.

Original comment by andy.koppe on 14 Jul 2010 at 1:15

GoogleCodeExporter commented 9 years ago
I am also experiencing this issue.  I have confirmed that the $HOME environment 
variable is properly initialized in the msysgit shell, but I'm not sure what 
environment variables mintty receives.  If I launch mintty from within the 
msysgit shell, the new instance DOES read and write the settings.

Original comment by pareja.m...@gmail.com on 14 Jul 2010 at 2:49

GoogleCodeExporter commented 9 years ago
My guess is that $HOME is not set at the time when mintty is launched, but it 
gets set by msysgit. IMHO mintty should fall back to $HOMEDRIVE$HOMEPATH, and 
$USERPROFILE in that order if $HOME is not set (which is the common case on 
Windows).

I also just learned about the difference between $HOMEDRIVE$HOMEPATH and 
$USERPROFILE (which are identical on most systems):

http://markmail.org/message/wbzs4gmtvkbewgxi

Original comment by sschuberth on 14 Jul 2010 at 2:59

GoogleCodeExporter commented 9 years ago
Yes, setting HOME in /etc/profile is too late for mintty, since that only gets 
sourced by bash running inside mintty. Falling back to $HOMEDRIVE$HOMEPATH 
wouldn't work right for standard MSYS, which sets HOME to /home/$LOGNAME in 
/etc/profile. (Btw, Cygwin >=1.5 avoids any such problems by setting HOME at 
DLL startup.)

Original comment by andy.koppe on 14 Jul 2010 at 9:15

GoogleCodeExporter commented 9 years ago
I see that msysgit stores some dotfiles into its root directory, so how about 
invoking mintty with '-c /.minttyrc'? 

Original comment by andy.koppe on 14 Jul 2010 at 9:22

GoogleCodeExporter commented 9 years ago
My current work around has been to explicitly set the HOME environment variable 
on Windows.

Original comment by pareja.m...@gmail.com on 14 Jul 2010 at 10:09

GoogleCodeExporter commented 9 years ago
Only the msysGit development environment (the environment to work on msysGit 
itself, not *with* msysGit) has dotfiles in its root. The real msysGit 
installation has not, and it stores .gitconfig etc.

So I guess the best solution really is to use "-c 
%HOMEDRIVE%%HOMEPATH%\.minttyrc".

Original comment by sschuberth on 14 Jul 2010 at 10:44

GoogleCodeExporter commented 9 years ago
I see. Is it really a good idea though to write into the user's Windows home 
directory, particularly in the case of portable msysgit?

Original comment by andy.koppe on 15 Jul 2010 at 3:58

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I believe these settings should be written into the user's home directory (or a 
subdirectory).  Newer versions of Windows follow the Linux convention of 
separating modifiable configuration files from the program executables.  

Portable applications are a special case scenario which should be handled by 
writing the configuration file to the same directory as the program executable. 
 This should probably be defined at install time.

Original comment by pareja.m...@gmail.com on 15 Jul 2010 at 4:20

GoogleCodeExporter commented 9 years ago
Right. I'm happy to find that '-c %HOMEDRIVE%%HOMEPATH%' works fine even in the 
target field of a Windows shortcut. Issue resolved without a fix. :)

Original comment by andy.koppe on 15 Jul 2010 at 4:36

GoogleCodeExporter commented 9 years ago
FYI you need to put the `-c "%HOMEDRIVE%%HOMEPATH%\.minttyrc"` switch before 
the `-e bash` switch.

Original comment by matthew....@featurespace.co.uk on 20 Mar 2012 at 4:01

GoogleCodeExporter commented 9 years ago
Unfortunatly, it's not enough to set the path to .minttyrc. You also would need 
some local settings for openssh, vim, etc... I've just written a short 
vbscript, which will set HOME enviromental variable before mintty launch:

Set wshShell = CreateObject( "WScript.Shell" )
Set wshSystemEnv = wshShell.Environment( "USER" )
wshSystemEnv( "HOME" ) = wshShell.ExpandEnvironmentStrings( 
"%HOMEDRIVE%%HOMEPATH%" )
wshShell.Run """C:\Program Files (x86)\Git\bin\mintty.exe"" -e ""C:\Program 
Files (x86)\Git\bin\bash.exe"" --login -i"

I hope it will help.

Original comment by sunrize...@gmail.com on 19 Jul 2012 at 3:51

GoogleCodeExporter commented 9 years ago
Good point Sunrize. Maybe the issue should be reopened?

Original comment by matt.hickford on 23 Jul 2012 at 8:28