Re: UPDATE 2: Windows XP, Cygwin 1.3.22-1, PostgreSQL 7.3.2,

From: Frank Seesink <frank(at)mail(dot)wvnet(dot)edu>
To: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: UPDATE 2: Windows XP, Cygwin 1.3.22-1, PostgreSQL 7.3.2,
Date: 2003-05-09 20:12:01
Message-ID: b9h20d$grp$1@main.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin

Jason Tishler wrote:
> Frank,
>
> Thanks for the write-up -- it's great. I have just a few minor,
> nitpicky comments below...
>
> On Wed, May 07, 2003 at 12:35:19PM -0400, Frank Seesink wrote:
>
>> A. WARNING!!!! If you are running Windows XP, DO NOT USE the
>> 'Switch User' feature to jump between accounts. This is KEY! ***
>> Instead, completely log off as one user before logging on as
>> another.
>
>
> A more convenient workaround is to set up sshd and use ssh to simulate
> Unix's su:
>
> $ ssh postgres(at)localhost # equivalent to "su postgres" on Unix
>
> Note that the above will *not* trigger the XP Fast User Switching
> problem.

Good point. I just wasn't sure how comfortable readers might be with
setting up more services like sshd, so I took the 'lazy' approach if you
will. :-) I would prefer an 'su' type setup myself though.

>> B. Cygwin does not 'hook' itself into Windows in any serious ways.
>> It basically does 3 things:
>>
>> * creates a folder on your HD (typically C:\cygwin)
>> * Creates shortcuts on your desktop and/or Start menu
>> (see [Start] | All Programs | Cygwin)
>> * Adds a few keys to the Windows Registry
>> * HKCU\Software\Cygnus Solutions
>> * HKLM\Software\Cygnus Solutions
>>
>> This means that at any time, if you are truly unhappy with the
>> Cygwin install, to "start fresh", simply shut down any Cygwin
>> related processes (e.g., the BASH shell and anything like PostgreSQL
>> or CygIPC) so that no files are locked, and then delete the items
>> above. Voila! Your system is like new.
>
>
> One also needs to delete the program group and registry entries to
> completely remove all traces of Cygwin.

Sorry. That's what I meant when I wrote "delete the items above", but
guess I could have worded it better. :-/

>> C. In its default configuration, you can think of Cygwin as Unix
>> running in a 'sandbox' as it were on your Windows PC. That is,
>> Cygwin stays within it's C:\cygwin directory tree and does not
>> stray. Any time you are asked to download a .tar/.gz/.bz file
>> and install it somehow in Cygwin, use whatever you normally would
>> use to download the file(s) in question, and just be sure to drop
>> them somewhere within C:\cygwin so that Cygwin can "see" the
>> file(s).
>
>
> 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.

>> 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? I wondered about this. 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:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:...
{-----Cygwin bin paths-----} {Windows XP PATH...

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), or does it run in the NT context, where it
suddenly accesses the NT utilities 'sort' and 'find'? [I honestly don't
know.]

Regardless, however, readers should note that whether they place
'C:\cygwin\bin' BEFORE or AFTER the Windows system paths, it will have
an effect either way. Specifically, I found these files in common
between 'C:\cygwin\bin' and 'C:\Windows\System32' (in WinXP Pro):

expand.exe
find.exe
ftp.exe
hostname.exe
lpr.exe
rcp.exe
rsh.exe
shutdown.exe
sort.exe
telnet.exe
tftp.exe

So for the moment, let's assume that 'postmaster' DOES rely on the
Windows PATH environment variable and does NOT run in the Cygwin
'shell'. Basically, for PostgreSQL users, the need to put C:\cygwin\bin
BEFORE the Windows system paths has consequences in that, while
necessary for 'sort' and 'find', this means that if you ever use any of
the above from a DOS shell, you'll end up using the Cygwin versions.

On the other hand, if you place 'C:\cygwin\bin' AFTER the Windows
system paths, you may have issues as noted by Jason; namely,
'postmaster' will find the WRONG 'sort' and 'find' (and the differences
between their functionality can be/is huge), with unknown consequences
(at least to me).

>> 7. Install CygIPC as per its instructions.
>> [snip]
>>
>> Now run the Cygwin BASH Shell and type the following commands:
>>
>> $ cd /
>> $ bunzip2 -c /tmp/cygipc-1.13-2.tar.bz2 | tar xvf -
>
>
> I recommend the following instead:
>
> $ tar -C / -xjf /tmp/cygipc-1.13-2.tar.bz2
>
> Jason
>

In response to

Responses

Browse pgsql-cygwin by date

  From Date Subject
Next Message Jeff Lu 2003-05-12 15:42:42 vacuumdb and pg_dump are not running under cron
Previous Message Thom Hixenbaugh 2003-05-09 18:40:22 PostgreSQL shutting down