cygpath hangs from postinstall scripts when called like $(cygpath -S) but not otherwise

Harold L Hunt II huntharo@msu.edu
Fri Oct 3 18:32:00 GMT 2003


I should emphasize that the reason this is important is because the 
XFree86-bin-icons package calls cygpath in this manner and it freezes 
setup.exe when the postinstall or preremove script gets run.  So, there 
is current breakage with this.  It is not a hypothetical situation.

Harold

Harold L Hunt II wrote:
> This looks like a cygpath problem, but it has something to do with the 
> environment in which cygpath gets run from a postinstall script. 
> Whomever is interested, please look into it.  Whomever is not 
> interested, please keep your grumpy flames to yourself.
> 
> 
> To demonstrate this problem, please do the following
> ====================================================
> 
> 1) Save the attached file as /etc/postinstall/cygpath-hangs.sh.
> 
> 2) Run setup.exe, select any mirror.
> 
> 3) Choose 'keep' on the package selection page.  Then, select a null 
> package (e.g. XFree86-base) and choose 'reinstall'.  This will cause 
> postinstall scripts to be run, but it won't change your installed 
> package or force you to have to download a large package just to get 
> this behavior.
> 
> 4) setup.exe will run cygpath-hangs.sh and, lo!, it will sit there (i.e. 
> hang) waiting for cygpath-hangs.sh to return.
> 
> 5) Go look in /var/log/ for the most recent file following the pattern 
> setup.log.postinstall*.  Open it.
> 
> 6) You should see the following in the log file:
> 
> + which which
> /usr/bin/which
> + cygpath -S
> /cygdrive/c/WINDOWS/system32
> ++ which which
> + FOO=/usr/bin/which
> ++ cygpath -S
> 
> 7) Run /etc/postinstall/cygpath-hangs.sh from a bash shell and observe 
> that it does not hang.
> 
> 
> Summary
> =======
> 
> 1) You can run 'which which' from a postinstall script without saving 
> its output to a variable.
> 
> 2) You can run 'cygpath -S' (or any other flag combo) from a postinstall 
> script without saving its output to a variable.
> 
> 3) You can run 'which which' from a postinstall script and save its 
> output to a variable (e.g. FOO=$(which which))
> 
> 4) If you run 'cygpath -S' from a postinstall script and save its output 
> to a variable (e.g. BAR=$(cygpath -S)), then cygpath will fail to return 
> for eternity.
> 
> 5) cygpath's failure to return causes bash to fail to return, which 
> causes setup.exe to wait forever for cygpath-hangs.sh to complete.
> 
> 
> There, I have proven beyond a doubt that this has absolutely nothing to 
> do with Cygwin/XFree86 :)
> 
> I would appreciate any help in fixing this.
> 
> Thanks in advance,
> 
> Harold
> 
> 
> ------------------------------------------------------------------------
> 
> #!/bin/bash -x
> 
> which which
> cygpath -S
> 
> FOO=$(which which)
> BAR=$(cygpath -S)



More information about the Cygwin-apps mailing list