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 Message-ID: <3CE1C928.1090100@ece.gatech.edu> Date: Tue, 14 May 2002 22:34:16 -0400 From: Charles Wilson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2 X-Accept-Language: en-us MIME-Version: 1.0 To: cygwin-apps AT cygwin DOT com Subject: Setup 2.218.2.8 [Was: Re: Setup 2.218.2.6...] References: <3CDF01AE DOT 6040800 AT ece DOT gatech DOT edu> <3CE121D3 DOT 8000003 AT ece DOT gatech DOT edu> <20020514162144 DOT GF25899 AT redhat DOT com> <3CE144ED DOT 1030509 AT ece DOT gatech DOT edu> <20020514172746 DOT GC18100 AT redhat DOT com> <20020514225513 DOT GA9501 AT redhat DOT com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit This one works for me. W2K, "install from local dir", local dir == remote SMB share. Cool beans! --Chuck Christopher Faylor wrote: > On Tue, May 14, 2002 at 01:27:46PM -0400, Christopher Faylor wrote: > >>On Tue, May 14, 2002 at 01:10:05PM -0400, Charles Wilson wrote: >> >>>Christopher Faylor wrote: >>> >>> >>>>On Tue, May 14, 2002 at 10:40:19AM -0400, Charles Wilson wrote: >>>> >>>> >>>>>Still doesn't work when installing from a "local" directory (although it >>>>>works fine when installing from internet) >>>>> >>>>>Once it begins parsing setup.ini, it dies almost immediately. But, >>>>>there is no warning or error popup. >>>>> >>>>> >>>>If I send you a debuggable setup.exe, would you mind running it and >>>>getting a back trace? >>>> >>>Yeah, I could do that. >>> >>Actually, I think I duplicated the problem. >> >>Stay tuned. >> > > The attached patch seems to fix this and some other problems. > > I've uploaded a new version to sourceware. > > At least some of the below should be useful on the trunk, too. > > cgf > > 2002-05-14 Christopher Faylor > > * filemanip.h (trail): Declare. > * filemanip.cc (trail): New function. > (find_tar_ext): Use trail() instead of strstr(). > * fromcwd.cc (check_ini): Ditto. > * ini.cc (find_routine): Ditto. Don't tack local_dir to path since it > should now be fully qualified. Set ini_filename. Reset error_buf and > error_count for any subsequent ini file parsing. > (ini_filename): New static variable for parse error reporting. > (yyerror): Use full path of setup.ini in error message. Subtract one > from line number if at bol. > * find.cc (found_part): Eliminate. > (find_sub): Call for_each with full path found rather than just file > component. > (find): Don't calculate found_part. > * inilex.l (ini_init): Flush input buffer and reset line number. > (yybol): New function. Exports YY_AT_BOL. > * iniparse.y: Increase stack depth to allow more tokens to be processed. > (yyparse): Remove newline from error condition to allow subsequent > per-line error processing to proceed normally. > > Index: ChangeLog > =================================================================== > RCS file: /cvs/cygwin-apps/setup/ChangeLog,v > retrieving revision 2.218.2.6 > diff -u -p -r2.218.2.6 ChangeLog > --- ChangeLog 14 May 2002 04:32:44 -0000 2.218.2.6 > +++ ChangeLog 14 May 2002 22:45:15 -0000 > @@ -1,5 +1,27 @@ > 2002-05-14 Christopher Faylor > > + * filemanip.h (trail): Declare. > + * filemanip.cc (trail): New function. > + (find_tar_ext): Use trail() instead of strstr(). > + * fromcwd.cc (check_ini): Ditto. > + * ini.cc (find_routine): Ditto. Don't tack local_dir to path since it > + should now be fully qualified. Set ini_filename. Reset error_buf and > + error_count for any subsequent ini file parsing. > + (ini_filename): New static variable for parse error reporting. > + (yyerror): Use full path of setup.ini in error message. Subtract one > + from line number if at bol. > + * find.cc (found_part): Eliminate. > + (find_sub): Call for_each with full path found rather than just file > + component. > + (find): Don't calculate found_part. > + * inilex.l (ini_init): Flush input buffer and reset line number. > + (yybol): New function. Exports YY_AT_BOL. > + * iniparse.y: Increase stack depth to allow more tokens to be processed. > + (yyparse): Remove newline from error condition to allow subsequent > + per-line error processing to proceed normally. > + > +2002-05-14 Christopher Faylor > + > * find.cc (find_sub): Be more defensive in preserving trailing parts of > components when doing recursive directory searches or calling user > supplied for_each(). > Index: filemanip.cc > =================================================================== > RCS file: /cvs/cygwin-apps/setup/filemanip.cc,v > retrieving revision 2.6 > diff -u -p -r2.6 filemanip.cc > --- filemanip.cc 19 Feb 2002 04:33:28 -0000 2.6 > +++ filemanip.cc 14 May 2002 22:45:16 -0000 > @@ -72,12 +72,12 @@ find_tar_ext (const char *path) > { > char *end = strchr (path, '\0'); > /* check in longest first order */ > - char *ext; > - if ((ext = strstr (path, ".tar.bz2")) && (end - ext) == 8) > + const char *ext; > + if ((ext = trail (path, ".tar.bz2")) && (end - ext) == 8) > return ext - path; > - if ((ext = strstr (path, ".tar.gz")) && (end - ext) == 7) > + if ((ext = trail (path, ".tar.gz")) && (end - ext) == 7) > return ext - path; > - if ((ext = strstr (path, ".tar")) && (end - ext) == 4) > + if ((ext = trail (path, ".tar")) && (end - ext) == 4) > return ext - path; > return 0; > } > @@ -140,6 +140,19 @@ parse_filename (String const &in_fn, fil > f.ver = *ver ? ver : "0.0"; > delete[] p; > return 1; > +} > + > +const char * > +trail (const char *haystack, const char *needle) > +{ > + /* See if the path ends in a trailing setup.ini component. > + Just return if it doesn't. */ > + unsigned len = strlen (haystack); > + int prefix_len = len - strlen (needle); > + if (prefix_len < 0 > + || strcasecmp (haystack += prefix_len, needle) != 0) > + return NULL; > + return haystack; > } > > String > Index: filemanip.h > =================================================================== > RCS file: /cvs/cygwin-apps/setup/filemanip.h,v > retrieving revision 1.7 > diff -u -p -r1.7 filemanip.h > --- filemanip.h 19 Feb 2002 04:33:28 -0000 1.7 > +++ filemanip.h 14 May 2002 22:45:16 -0000 > @@ -30,3 +30,4 @@ int parse_filename (String const & in_fn > String base (String const &); > unsigned int get_file_size (String const &); > String backslash (String const &); > +const char * trail (const char *, const char *); > Index: find.cc > =================================================================== > RCS file: /cvs/cygwin-apps/setup/find.cc,v > retrieving revision 2.3.6.1 > diff -u -p -r2.3.6.1 find.cc > --- find.cc 14 May 2002 04:32:44 -0000 2.3.6.1 > +++ find.cc 14 May 2002 22:45:16 -0000 > @@ -30,7 +30,7 @@ static const char *cvsid = > #include "String++.h" > #include "find.h" > > -static char dir[_MAX_PATH], *found_part; > +static char dir[_MAX_PATH]; > > static int > find_sub (void (*for_each) (char *, unsigned int)) > @@ -60,7 +60,7 @@ find_sub (void (*for_each) (char *, unsi > find_sub (for_each); > else > { > - for_each (found_part, wfd.nFileSizeLow); > + for_each (dir, wfd.nFileSizeLow); > rv++; > } > > @@ -75,7 +75,6 @@ int > find (String const &starting_dir, void (*_for_each) (char *, unsigned int)) > { > strcpy (dir, starting_dir.cstr_oneuse()); > - found_part = dir + strlen (dir) + 1; > > return find_sub (_for_each); > } > Index: fromcwd.cc > =================================================================== > RCS file: /cvs/cygwin-apps/setup/fromcwd.cc,v > retrieving revision 2.22 > diff -u -p -r2.22 fromcwd.cc > --- fromcwd.cc 18 Feb 2002 13:53:06 -0000 2.22 > +++ fromcwd.cc 14 May 2002 22:45:18 -0000 > @@ -141,7 +141,7 @@ static bool found_ini; > static void > check_ini (char *path, unsigned int fsize) > { > - if (fsize && strstr (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.1 > diff -u -p -r2.22.2.1 ini.cc > --- ini.cc 14 May 2002 04:32:45 -0000 2.22.2.1 > +++ ini.cc 14 May 2002 22:45:19 -0000 > @@ -43,6 +43,7 @@ static const char *cvsid = > #include "site.h" > #include "rfc1738.h" > #include "find.h" > +#include "filemanip.h" > > #include "io_stream.h" > > @@ -62,27 +63,28 @@ static int error_count = 0; > > static int local_ini; > > +static const char *ini_filename; > + > static void > find_routine (char *path, unsigned int fsize) > { > - /* See if the path ends in a trailing setup.ini component. > - Just return if it doesn't. */ > - unsigned pathlen = strlen (path); > - unsigned pathprefix_len = pathlen - 10; > - if (pathlen < strlen ("setup.ini") > - || strcasecmp (path + pathprefix_len, "\\setup.ini") != 0) > + const char *setup_ini = trail (path, "\\setup.ini"); > + > + if (setup_ini == NULL) > return; > > - io_stream *ini_file = io_stream::open (String ("file://") + local_dir + "/" + > + unsigned pathprefix_len = setup_ini - path; > + > + io_stream *ini_file = io_stream::open (String ("file://") + > path, "rb"); > if (!ini_file) > { > - note (NULL, IDS_SETUPINI_MISSING, (String ("file://") + local_dir + "/" + > + note (NULL, IDS_SETUPINI_MISSING, (String ("file://") + > path).cstr_oneuse()); > return; > } > else > - log (LOG_BABBLE, String ("Found ini file - file://") + local_dir + "/" + path); > + log (LOG_BABBLE, String ("Found ini file - file://") + path); > > /* FIXME: only use most recent copy */ > setup_timestamp = 0; > @@ -96,12 +98,15 @@ find_routine (char *path, unsigned int f > String mirror = rfc1738_unescape_part (path_prefix); > ini_init (ini_file, mirror); > > - /*yydebug = 1; */ > + /*yydebug = 1;*/ > > + ini_filename = path; > if (yyparse () || error_count > 0) > MessageBox (0, error_buf, error_count == 1 ? "Parse Error" : "Parse Errors", 0); > else > local_ini++; > + *error_buf = '\0'; > + error_count = 0; > } > > static int > @@ -251,15 +256,15 @@ do_ini (HINSTANCE h, HWND owner) > CreateThread (NULL, 0, do_ini_thread_reflector, context, 0, &threadID); > } > > - > extern int yylineno; > +extern int yybol (); > > extern "C" int > yyerror (char *s, ...) > { > - char buf[1000]; > + char buf[MAX_PATH + 1000]; > int len; > - sprintf (buf, "setup.ini line %d: ", yylineno); > + sprintf (buf, "%s line %d: ", ini_filename, yylineno - yybol ()); > va_list args; > va_start (args, s); > vsprintf (buf + strlen (buf), s, args); > Index: iniparse.y > =================================================================== > RCS file: /cvs/cygwin-apps/setup/iniparse.y,v > retrieving revision 2.27.2.1 > diff -u -p -r2.27.2.1 iniparse.y > --- iniparse.y 10 May 2002 10:59:05 -0000 2.27.2.1 > +++ iniparse.y 14 May 2002 22:45:20 -0000 > @@ -37,6 +37,7 @@ int yylex (); > #include "cygpackage.h" > > #define YYERROR_VERBOSE 1 > +#define YYINITDEPTH 1000 > /*#define YYDEBUG 1*/ > > static packagemeta *cp = 0; > @@ -108,9 +109,8 @@ simple_line > | T_TEST { trust = TRUST_TEST; cpv = new cygpackage (cp->name); } > | T_UNKNOWN { trust = TRUST_UNKNOWN; } > | /* empty */ > - | error '\n' { yylineno --; > - yyerror ("unrecognized line in package %s (do you have the latest setup?)", cp->name.cstr_oneuse()); > - yylineno ++; > + | error { yyerror ("unrecognized line in package %s (do you have the latest setup?)", cp->name.cstr_oneuse()); > + yyerrok; > } > ; > > Index: inilex.l > =================================================================== > RCS file: /cvs/cygwin-apps/setup/inilex.l,v > retrieving revision 2.14.2.1 > retrieving revision 2.14.2.3 > diff -u -p -r2.14.2.1 -r2.14.2.3 > --- inilex.l 4 May 2002 01:21:59 -0000 2.14.2.1 > +++ inilex.l 14 May 2002 22:49:19 -0000 2.14.2.3 > @@ -113,6 +113,8 @@ ini_init(io_stream *stream, String const > if (parse_mirror) > delete[] parse_mirror; > parse_mirror = mirror.cstr(); > + YY_FLUSH_BUFFER; > + yylineno = 1; > } > > static int > @@ -142,4 +144,10 @@ ignore_line () > if (c == '\n') > return; > } > +} > + > +int > +yybol () > +{ > + return !!YY_AT_BOL (); > } >