delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/09/23/15:45:33

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Message-ID: <3D8F6F4E.2FDD0AD8@gams.com>
Date: Mon, 23 Sep 2002 15:45:18 -0400
From: Steven Dirkse <sdirkse AT gams DOT com>
Organization: GAMS Development Corp.
X-Accept-Language: en
MIME-Version: 1.0
To: bug-make AT gnu DOT org
CC: cygwin AT cygwin DOT com
Subject: 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 AT gams DOT 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/

- Raw text -


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