This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bug in make-3.79.1


Hello,

I believe there is a bug in 3.79.1.  It occurs late in function
try_variable_definition, where the code

  v->append = append;

is executed.  For a build with WINDOWS32 defined the struct v was not
initialized in some cases (specifically, when processing a line of the
form SHELL = /bin/bash), and the program crashed intermittently,
presumably when accessing the code above.  Who knows what damage
occurred when it ran but didn't crash.

My fix is simple: I initialize

  struct variable *v = NULL;

I add an else clause to the code that sets v for Windows32, and I check
v != NULL before setting v->append.  The code below is near the end of
the function in question and the 4 lines I added there are marked with
"new" below.

#ifdef WINDOWS32
  if ((origin == o_file || origin == o_override)
      && strcmp (expanded_name, "SHELL") == 0) {
    extern char* default_shell;

    /*
     * Call shell locator function. If it returns TRUE, then
	 * set no_default_sh_exe to indicate sh was found and
     * set new value for SHELL variable.
	 */
    if (find_and_set_default_shell(value)) {
       v = define_variable_loc (expanded_name, strlen (expanded_name),
                                default_shell, origin, flavor ==
f_recursive,
                                flocp);
       no_default_sh_exe = 0;
    }
new    else
new      v = lookup_variable (expanded_name, strlen (expanded_name));
  }
  else
#endif

  v = define_variable_loc (expanded_name, strlen (expanded_name), value,
                           origin, flavor == f_recursive, flocp);

new  if (v != NULL)
new    v->append = append;


I noticed the bug is also present in the cygwin modifications to make,
so I CCed them.

-- 
Steven Dirkse, Ph.D.    GAMS Development Corporation
1217 Potomac St. NW             Washington DC  20007
Voice: (202)342-0180              Fax: (202)342-0181
mailto:sdirkse@gams.com          http://www.gams.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]