#ifndef YYERRCODE #define YYERRCODE 256 #endif #define _BANG 257 #define _BANG_EQUALS 258 #define _AMPERAMPER 259 #define _LPAREN 260 #define _RPAREN 261 #define _PLUS_EQUALS 262 #define _COLON 263 #define _SEMIC 264 #define _LANGLE 265 #define _LANGLE_EQUALS 266 #define _EQUALS 267 #define _RANGLE 268 #define _RANGLE_EQUALS 269 #define _QUESTION_EQUALS 270 #define _LBRACKET 271 #define _RBRACKET 272 #define ACTIONS 273 #define BIND 274 #define CASE 275 #define DEFAULT 276 #define ELSE 277 #define EXISTING 278 #define FOR 279 #define IF 280 #define IGNORE 281 #define IN 282 #define INCLUDE 283 #define LOCAL 284 #define ON 285 #define PIECEMEAL 286 #define QUIETLY 287 #define RETURN 288 #define RULE 289 #define SWITCH 290 #define TOGETHER 291 #define UPDATED 292 #define _LBRACE 293 #define _BARBAR 294 #define _RBRACE 295 #define ARG 296 #define STRING 297
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 1270 | Matt Armstrong | In prep for publishing all my patches to jam. | ||
#3 | 1088 | Matt Armstrong | Merge in changes from upstream. | ||
#2 | 293 | Matt Armstrong |
Fix a crash bug in jam by adding reference counting to the PARSE struct. The bug occurs when a rule re-defines itself. This can only happen by using the include statement, as follows. JamfileA: ---------------------------------------------------- rule DoInclude { ECHO JamfileA DoInclude $(<) start ; include $(<) ; ECHO JamfileA DoInclude $(<) end ; } DoInclude JambileB ; ---------------------------------------------------- JamfileB: ---------------------------------------------------- rule DoInclude { ECHO JamfileB DoInclude ; } DoInclude JambileC ; ---------------------------------------------------- With these two jamfiles you can reproduce the crash bug by running "jam -fJamfileA". If that doesn't work, change parse_free() such that it memsets PARSE struct being freed to something bogus like 0x03 and try again (or use Purify and watch the free memory read warnings). The problem is that compile_setcomp() just frees the PARSE without regard for the possibility that it might be executing. In the case above, JamfileA's DoInclude is re-defined by JamfileB while it is still being executed. The simple fix is to just have compile_setcomp() not free the PARSE. This would introduce a memory leak for every re-defined rule. My fix introduces reference counting of the PARSE struct. A PARSE is allocated with a reference count of 1 and when it goes to 0 it is freed. Every place that was a parse_free() is now a parse_decref(). In addition, compile_rules() increments the reference count of its PARSE around the calls to its left and right functions. Perhaps there a better fix! |
||
#1 | 289 | Matt Armstrong | Initial branch. | ||
//guest/perforce_software/jam/src/jamgram.h | |||||
#1 | 2 | laura | Add Jam/MR 2.2 source |