Mailing-List: contact cygwin-apps-help AT cygwin DOT com; run by ezmlm Sender: cygwin-apps-owner AT cygwin DOT com List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps AT cygwin DOT com Delivered-To: mailing list cygwin-apps AT cygwin DOT com Date: Thu, 16 May 2002 01:32:07 -0400 From: Christopher Faylor To: cygwin-apps AT cygwin DOT com Subject: [PATCH] Fix for postinstall not running Message-ID: <20020516053207.GA29299@redhat.com> Reply-To: cygwin-apps AT cygwin DOT com Mail-Followup-To: cygwin-apps AT cygwin DOT com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.23.1i Here is a fix for the problem of postinstall not running. I'm not going to check this one into the trunk because it uses a static variable and "feels wrong" as a result. I think we probably need to change the find interface, either to just return the relative path or the full path as needed. I also changed find so that it uses the cwd if a "." is passed in. Hopefully that will ensure that a full path is given to find's coroutines. I've uploaded a new setup.exe to sourceware. AFAICT, my new version doesn't use cygwin1.dll and is properly stripped. cgf 2002-05-16 Christopher Faylor * find.cc (find_sub): Revert to using forward slash. It's prettier. * ini.cc (find_routine): Ditto. * fromcwd.cc (check_ini): Check for trailing "/setup.ini" component rather than just trailing "setup.ini". * postinstall.cc (run_script_in_etc_postinstal): Skip over leading pathname component since find returns full MS-DOS path, now. (do_postinstall): Save length of MS-DOS version of '/etc/postinstall' in static (sigh) for later use. Index: find.cc =================================================================== RCS file: /cvs/cygwin-apps/setup/find.cc,v retrieving revision 2.3.6.2 diff -u -p -r2.3.6.2 find.cc --- find.cc 14 May 2002 22:46:37 -0000 2.3.6.2 +++ find.cc 16 May 2002 05:17:55 -0000 @@ -40,7 +40,7 @@ find_sub (void (*for_each) (char *, unsi char *end = dir + strlen (dir); int rv = 0; - strcpy (end, "\\*"); + strcpy (end, "/*"); h = FindFirstFile (dir, &wfd); @@ -53,7 +53,7 @@ find_sub (void (*for_each) (char *, unsi || strcmp (wfd.cFileName, "..") == 0) continue; - *end = '\\'; + *end = '/'; strcpy (end + 1, wfd.cFileName); if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) Index: fromcwd.cc =================================================================== RCS file: /cvs/cygwin-apps/setup/fromcwd.cc,v retrieving revision 2.22.6.1 diff -u -p -r2.22.6.1 fromcwd.cc --- fromcwd.cc 14 May 2002 22:46:37 -0000 2.22.6.1 +++ fromcwd.cc 16 May 2002 05:17:55 -0000 @@ -141,7 +141,7 @@ static bool found_ini; static void check_ini (char *path, unsigned int fsize) { - if (fsize && trail (path, "setup.ini")) + if (fsize && trail (path, "/setup.ini")) found_ini = true; } Index: ini.cc =================================================================== RCS file: /cvs/cygwin-apps/setup/ini.cc,v retrieving revision 2.22.2.3 diff -u -p -r2.22.2.3 ini.cc --- ini.cc 15 May 2002 02:15:17 -0000 2.22.2.3 +++ ini.cc 16 May 2002 05:17:55 -0000 @@ -68,7 +68,7 @@ static const char *ini_filename; static void find_routine (char *path, unsigned int fsize) { - const char *setup_ini = trail (path, "\\setup.ini"); + const char *setup_ini = trail (path, "/setup.ini"); if (setup_ini == NULL) return; Index: postinstall.cc =================================================================== RCS file: /cvs/cygwin-apps/setup/postinstall.cc,v retrieving revision 2.8 diff -u -p -r2.8 postinstall.cc --- postinstall.cc 18 Feb 2002 13:53:06 -0000 2.8 +++ postinstall.cc 16 May 2002 05:17:55 -0000 @@ -31,10 +31,11 @@ static const char *cvsid = #include "mount.h" #include "script.h" +static int postinstall_len; static void run_script_in_etc_postinstall (char *fname, unsigned int size) { - run_script ("/etc/postinstall/", fname); + run_script ("/etc/postinstall", fname + postinstall_len); } void @@ -43,5 +44,7 @@ do_postinstall (HINSTANCE h, HWND owner) next_dialog = 0; init_run_script (); SetCurrentDirectory (get_root_dir ().cstr_oneuse()); - find (cygpath ("/etc/postinstall"), run_script_in_etc_postinstall); + String postinstall = cygpath ("/etc/postinstall"); + postinstall_len = postinstall.size (); + find (postinstall, run_script_in_etc_postinstall); }