This is the mail archive of the cygwin-developers 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]

envcache: huh?



    Ok, am I not seeing something here?  I'd like a second pair of eyes to
sanity check this for me and either confirm or deny that it's a real bug.

  We have this variable in environ.cc:

------------------------<snip>------------------------
static bool envcache = true;
------------------------<snip>------------------------

and we have a parse_thing that refers to it:

------------------------<snip>------------------------
  {"envcache", {&envcache}, justset, NULL, {{true}, {false}}},
------------------------<snip>------------------------

so, if %CYGWIN% contains a token matching 'envcache', we're going to execute
the justset case of the switch in parse_options, yes?

------------------------<snip>------------------------
	      case justset:
		if (!istrue || !eq)
		  *k->setting.x = k->values[istrue].i;
		else
		  *k->setting.x = strtol (eq, NULL, 0);
		debug_printf ("%s %d", k->name, *k->setting.x);
------------------------<snip>------------------------

  Um.  But union parse_setting is

------------------------<snip>------------------------
    union parse_setting
      {
	bool *b;
	DWORD *x;
	int *i;
	void (*func)(const char *);
      } setting;
------------------------<snip>------------------------

  Yes?

  And we're storing through the 'x' member, which is a DWORD pointer, yes?

  And the thing we're storing into is a bool, yes?

  Which is one byte in size, yes?

------------------------<snip>------------------------
	.data
_envcache:
	.byte	1
	.text
------------------------<snip>------------------------


  Oops?

  There's at least one other bool referred to in this table,
strip_title_path; I haven't checked the rest yet.

  If someone confirms they also think this is wrong, I'll whip up a patch
that a) adds member initialiser specifiers to the entries that don't
currently have them, b) identifies all the booleans and c) adds a 'boolset'
method the same as 'justset' but using the 'b' rather than 'x' member of
parse_setting.

    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


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