REBOL3 tracker
  0.9.12 beta
Ticket #0001865 User: anonymous

Project:



rss
TypeBug Statusbuilt Date6-Mar-2011 07:20
Versionalpha 111 CategoryNative Submitted byGHigley
PlatformAll Severitycrash Priorityurgent

Summary RESOLVE/extend/only crash
Description When you extend a context with RESOLVE/extend/only from a source context with a certain number of fields, using an /only block with at least one word, R3 crashes. This crash happens on all tested platforms, but the number of fields required to cause the crash may vary between platforms. On Windows in a fresh console, 6 fields will work every time, but not more or less. If you run code before or afterwards, the number is different. The names of the fields don't matter, and it also doesn't matter whether or not the word in the /only block has the same name as any of those fields.

This crash happens consistently when you import a module that has enough words in its local context, and exports any of them.
Example code
; Minimal code to reproduce the crash on Windows in a fresh console:
resolve/extend/only context [] context [a1: a2: a3: a4: a5: a6: none] [a]

; Code originally reported by the submitter, as tested on OSX, Linux, Windows and Wine:
REBOL [
	name: crash
	type: module
	needs: [2.100.111]
	exports: [
		accum
		accum-each
		first-
		range
		dummy1
		dummy2
		dummy3
	]
]

dummy1: dummy2: dummy3: accum: accum-each: first-: range: 42

Assigned ton/a Fixed inr3 master Last Update20-Jan-2013 06:26


Comments
(0003140)
GHigley
6-Mar-2011 15:40

Actually, it's quite easy to crash the module system on OS X, once the number of exports goes above 3 or 4.
(0003141)
abolka
6-Mar-2011 23:24

The above also crashes Linux A111 (4.4) and Win32 A11 (run via Wine).

Can also be reproduced by:

import module [name: crash type: module needs: [2.100.111] exports: [accum accum-each first- range dummy1 dummy2 dummy3]] [dummy1: dummy2: dummy3: accum: accum-each: first-: range: 42]
(0003142)
abolka
6-Mar-2011 23:25

TRACE/function shows RESOLVE as the last function called before the crash, so this could be related to #1825.
(0003147)
GHigley
12-Mar-2011 08:18

I modified the ticket to reflect that it crashes on platforms other than OS X, thanks to abolka.
(0003161)
BrianH
9-Apr-2011 00:00

Determined the minimal code to cause the crash, getting rid of all mezzanine wrappers and extraneous stuff, and rewrote the ticket to match. This is probably the cause of #1825 as well as several OSX bugs.
(0003217)
BrianH
26-Oct-2011 22:40

As a temporary workaround in your code, you can replace code like this:

>> resolve/extend/only a b c

with code like this:

>> resolve/only a b bind/new/copy/only c a

More overhead, but it doesn't crash.
(0003242)
BrianH
11-Sep-2012 02:53

Patch implemented here: https://github.com/BrianHawley/rebol-patches

This only replaces all built-in calls to resolve/extend/only with variants of the above workaround; it doesn't fix any problems in user code. It does fix the module system exports though, and the export-words function.
(0003277)
abolka
18-Dec-2012 02:46

I think I have the underlying bug for this issue nailed down. Basically, it seems to be a typo, leading to inadvertently extending the source context, instead of the target context. This later leads to an invalid memory access which crashes R3.

Pull request for the fix:
https://github.com/rebol/r3/pull/41
(0003288)
abolka
23-Dec-2012 12:06

Merged mainline in 4810ad0d482291dff61b6955656a23427cdaa002.

Date User Field Action Change
20-Jan-2013 06:26 BrianH Status Modified pending => built
20-Jan-2013 06:26 BrianH Fixedin Modified => r3 master
24-Dec-2012 18:08 BrianH Status Modified reviewed => pending
23-Dec-2012 12:06 abolka Comment : 0003288 Added -
18-Dec-2012 02:46 abolka Comment : 0003277 Added -
11-Sep-2012 02:53 BrianH Comment : 0003242 Added -
26-Oct-2011 22:40 BrianH Comment : 0003217 Added -
9-Apr-2011 00:12 BrianH Code Modified -
9-Apr-2011 00:12 BrianH Description Modified -
9-Apr-2011 00:00 BrianH Comment : 0003161 Added -
8-Apr-2011 23:58 BrianH Description Modified -
8-Apr-2011 23:58 BrianH Priority Modified high => urgent
8-Apr-2011 23:58 BrianH Status Modified submitted => reviewed
8-Apr-2011 23:58 BrianH Category Modified Unspecified => Native
8-Apr-2011 23:58 BrianH Code Modified -
8-Apr-2011 23:58 BrianH Summary Modified SIGSEGV when importing modules => RESOLVE/extend/only crash
12-Mar-2011 08:18 GHigley Comment : 0003147 Added -
12-Mar-2011 08:17 GHigley Platform Modified Mac OSX => All
12-Mar-2011 08:17 GHigley Description Modified -
12-Mar-2011 08:17 GHigley Summary Modified SIGSEGV when importing modules on OS X => SIGSEGV when importing modules
6-Mar-2011 23:29 abolka Comment : 0003142 Modified -
6-Mar-2011 23:29 abolka Comment : 0003142 Modified -
6-Mar-2011 23:29 abolka Comment : 0003141 Modified -
6-Mar-2011 23:25 abolka Comment : 0003142 Added -
6-Mar-2011 23:25 abolka Comment : 0003141 Modified -
6-Mar-2011 23:24 abolka Comment : 0003141 Added -
6-Mar-2011 15:40 GHigley Comment : 0003140 Added -
6-Mar-2011 07:21 GHigley Code Modified -
6-Mar-2011 07:21 GHigley Description Modified -
6-Mar-2011 07:20 GHigley Ticket Added -