Re: UPDATE 2: Windows XP, Cygwin 1.3.22-1, PostgreSQL 7.3.2, - Mailing list pgsql-cygwin

From Jason Tishler
Subject Re: UPDATE 2: Windows XP, Cygwin 1.3.22-1, PostgreSQL 7.3.2,
Date
Msg-id 20030512163929.GE1708@tishler.net
Whole thread Raw
In response to Re: UPDATE 2: Windows XP, Cygwin 1.3.22-1, PostgreSQL 7.3.2,  (Frank Seesink <frank@mail.wvnet.edu>)
Responses Re: UPDATE 2: Windows XP, Cygwin 1.3.22-1, PostgreSQL 7.3.2,
List pgsql-cygwin
Frank,

On Fri, May 09, 2003 at 04:12:01PM -0400, Frank Seesink wrote:
> Jason Tishler wrote:
> >Cygwin can "see" any file that Windows can.  Just use /cygdrive/$X
> >(where $X is a drive letter such as a, c, d, etc.) to access files
> >which are not located under / (i.e., C:\Cygwin).
>
> Yep, my bad.  Never actually fully realized that, ya know?  As I
> didn't see 'cygdrive' at the root level in the BASH shell, didn't
> occur to me. Always noticed it in the PATH within BASH though.
> Thanks.  Learn something new every day.

I always create a /cygdrive (actually /mnt) on my Cygwin boxes so bash's
tab completion works on these kinds of paths too.  Just another stupid
Cygwin trick... :,)

> >>3. Add 'C:\cygwin\bin' to the system PATH environment variable.
> >>[snip]
> >>   * Carefully edit the 'Variable value:' field and add an entry
> >>     for C:\Cygwin\bin.  I recommend adding it after the Windows
> >>     system paths.
> >
> >
> >I recommend adding it before the Windows systems paths, but I'm a
> >Cygwin bigot. :,)  Nevertheless, PostgreSQL will have problems
> >finding sort, find, etc. if the Cygwin path is added after instead of
> >before.
>
> Is this actually true?

Yes, AFAICT.

> I notice that if I look at the environment table from a DOS shell,
> C:\cygwin\bin is listed after the Windows system paths (the way I set
> it).  However, if I run the BASH shell, I see that Cygwin
> automatically puts its own paths first, before tacking on the NT
> environment table version of PATH; e.g.,
>
> From within BASH:
> PATH='/usr/local/bin:/usr/bin:/bin:/cygdrive/c/WINDOWS/system32:...

IIRC, Cygwin's /etc/profile does the above.  Note that I use my own
/etc/profile that predates the Cygwin one so I'm not 100% sure.  But,
what else would set PATH as such?

> The big question, I guess is, when 'postmaster' runs as an NT service,
> does it run within the Cygwin 'shell' (giving it access to the 'sort'
> and 'find' it expects),

No.

> or does it run in the NT context, where it suddenly accesses the NT
> utilities 'sort' and 'find'?

Kinda.  It runs in the postgres context (or whatever user is assigned to
the postmaster service) which will use the PATH defined for that user.

However, you made me think of another option which may suit some users
better.  Add the Cygwin bin directories to the end of the Windows system
PATH. But, use cygrunsrv's --env option when installing postmaster and
set postmaster's PATH so that the Cygwin bin directories are searched
first.  In this way, one does not need to affect the Windows system PATH
or any user's PATH (including postgres) just to keep postmaster happy.

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6


pgsql-cygwin by date:

Previous
From: Jason Tishler
Date:
Subject: Re: vacuumdb and pg_dump are not running under cron
Next
From: Jason Tishler
Date:
Subject: Re: vacuumdb and pg_dump are not running under cron