Fw: X and startx

Dave Cook duck@caveduck.com
Wed May 23 21:55:00 GMT 2001


[discussion re the proper place to put /usr/X11R6/bin onto $PATH]

Andrew Markebo wrote...
> Is /etc/profile _always_ read?? If you just run bash from a
> command-prompt (not login), isn't it supposed to inherit the
> environment from where it started.

That is true.  But anytime you launch a Cygwin bash or sh from the Windows world, you
really need to use --login to activate the profile machinery.  The purpose of /etc/profile
etc. is precisely to provide a place for fundamental setup (like the X11 bin path) that
child processes can inherit.  /etc/profile is the only reliable place to put such
"universal" settings.

You could think about putting the X11 path in .bashrc, but if bash is invoked as 'sh', the
*only* startup files that are read are /etc/profile and ./profile, and then only
with -login.  You can't convince 'sh' to read ~/.bashrc at startup, even with --rcfile
(see bash man page for gory details).

Cygwin's own cygwin.bat uses "bash --login -i" to launch the shell from Windows.  Likewise
I have a shortcut on my desktop with the following command line to properly start X:

bash --login -c 'startx'

Although it is possible to start a non-login bash from Windows, such a shell will have
many limitations in consequence of not running /etc/profile.  I don't think we should warp
the XFree86/Cygwin installation to accommodate that.  Better IMHO to

Robert Collins suggested that we should lobby to get /usr/X11R6/bin added to the
/etc/profile generated by the Cygwin core installer.  I think this will be an excellent
idea at the point when XF86 is included with the standard Cygwin distro.

Regards,

Dave Cook



More information about the Cygwin-xfree mailing list