delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/04/15/05:18:18

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
In-Reply-To: <OF095BCD61.E9CDAC5C-ONC1257427.002AD48F-C1257427.002AE6F9@de.ibm.com>
Subject: Re: -11: Problem at 1st start when "cygwin.bat" is run by Nullsoft-Installer (SOLVED)
To: cygwin AT cygwin DOT com
X-Mailer: Lotus Notes Release 7.0 HF277 June 21, 2006
Message-ID: <OFEF88DD40.3F5905D4-ONC125742C.003197D6-C125742C.0031B85A@de.ibm.com>
From: Christoph Herdeg <CHERDEG AT de DOT ibm DOT com>
Date: Tue, 15 Apr 2008 11:03:06 +0200
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hello List,

thank you very much for the great efforts you took on to help me solve our
problem ( see the OP below). Finally we managed not to solve the problem
itself but at least to find a workaround. Still we are not able to
identifiy the one of the tree possible parties responsible for the problem:
Nullsoft, Microsoft or Cygwin?

However: If, which I am sure of, anybody else in this world uses the
Nullsoft-Installer to deploy an unattended Cygwin-Installation to
his/her/its client machines, the person will, at latest when it comes to
package-compatibility with VistaSP1 or Windows Server 2008, experience the
same problem as we did. So I would like to document my workaround here:

When Cygwin's "setup.exe" is finished, it has installed a script
"/etc/profile". Among others, one of the duties of this script is to find
and run all scripts residing in "/etc/profile.d". This definitley does not
work on VistaSP1 or Windows Server 2008...no matter who's to blame...bash
reports the error: "bash: cannot create temp file for here document: Bad
address" and none of the scripts in "/etc/profile" is run. The code in
"/etc/profile" responsible for this is:

      # Run all of the profile.d scripts
      # Note that these are supplied by separate packages
      # Ascending alphanumerical order enforced
      if [ -d "/etc/profile.d" ]; then
            while read f; do
                  if [ -f "${f}" ]; then
                        . "${f}"
                  fi
            done <<- EOF
            `/bin/find -L /etc/profile.d -type f -iname '*.sh' -or -iname
'*.zsh' | LC_ALL=C sort`
            EOF
      fi

Due to the fact that non of the solutions provided by this phantastic
community did work at least a little, we decided to workaround the problem
(we don't need to run _all_ scripts in "/etc/profile.d" - in our customized
configuration there never will be more than three...the code of "00bash.sh"
and "openssl.sh" was directly) by hardcoding them to a customized
"/etc/profile":

      # Code from "00bash.sh"
      /bin/test \! /bin/sh.exe -ot /bin/bash.exe
      if ( $status ) then
            /bin/bash.exe -c '. /etc/profile.d/00bash.sh'
      fi
      # Code from "openssl.sh"
      export MANPATH="${MANPATH}:/usr/ssl/man"
      # Run our script
      if [ -e /etc/profile.d/ibm_customize_cygwin.sh ]; then
            /etc/profile.d/./ibm_customize_cygwin.sh
      fi;

This may not be elegant but at least works as planned. When Cygwin's
"setup.exe" has finished, the Nullsoft-Installer copies and overwrites the
original "/etc/profile" with our customized version which is then run every
time Cygwin is started by "cygwin.bat".

Regards,

Christoph





                                                                           
             Christoph                                                     
             Herdeg/Germany/Co                                             
             ntr/IBM AT IBMDE                                              To 
             Sent by:                  cygwin AT cygwin DOT com                   
             cygwin-owner AT cygw                                          cc 
             in.com                                                        
                                                                   Subject 
                                       -11: Problem at 1st start when      
             10.04.2008 09:48          "cygwin.bat" is run by              
                                       Nullsoft-Installer                  
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           





Hello List,

We have made up an unattended installer package for cygwin using Nullsoft
Installer. This package works on all x32 and x64 versions of Windows 2000,
XP and Server 2003. Testing with Windows Server 2008 we discovered a
problem: At the end of the installation, cygwin.bat is executed by the
Nullsoft Installer. Normally bash should open and all shellscripts residing
in /etc/profile.d should be run automagically (the script /etc/profile
collects and runs them). In our case it doesn't - at least on 1st start -
instead the following error message is displayed:

"bash: cannot create temp file for here document: Bad address"

Then bash jumps to the standard prompt. If we now start cygwin a 2nd time
by executing cygwin.bat (directly or via the desktop icon), the scripts in
/etc/profile.d are run as they are proposed to. Also they are run normally,
if the Nullsoft Installer exits before starting cygwin.bat and we start the
batch manually (directly or via the desktop icon).

Upgrading the package "base-files-3.7-1.tar.bz2" to unpack a modified
/etc/profile resulted that the $TMP and $TEMP variables seem to be
correctly set to "/cygdrive/c/Users/ADMINI~1/AppData/Local/Temp". Setting
an FullAccess-ACL for the Windows user "everyone" on this directory didn't
change the behaviour. Using "set -x" in the modified /etc/profile did not
produce any other errors.

- Is it possible that Cygwin's mapping of
"c:\Users\ADMINI~1/AppData/Local/Temp" to
"/cygdrive/c/Users/ADMINI~1/AppData/Local/Temp" doesn't yet exist at the
time the error occurs?
- Are there any known changes between the previous Windows versions and
Windows Server 2008 being able to cause a different behaviour when "a
program is started manually" vs. "a program is started by another program";
eg. different User / security / environmental context?
- Would it be possible for the Cygwin developers to implement the usage of
a /tmp independet from it's windows pendant to cure this?
- Are there any other steps I could try or does anyone of you perhaps have
a solution?

We are using Cygwin on over 1200 machines. It maybe well a workaround to
let the Nullsoft Installer exit without executing cygwin.bat and doing this
manually, but that is -surely comprehensible- no way for us.

Thank you very much,

Regards,

Chris


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019