Changes between Initial Version and Version 1 of Ticket #22626, comment 375


Ignore:
Timestamp:
12/13/18 13:17:35 (3 years ago)
Author:
embray
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #22626, comment 375

    initial v1  
    1818It so happened, in this case, that it ''almost'' worked--the old array that `sysenviron` was pointing to still contained the old environment variables, but its last (`NULL`) entry was already allocated to some other use and would contain some arbitrary value (in my testing it was typically either `0x300` or `0x310`--who knows) hence the segfault.
    1919
     20I believe this is not a problem for GAP normally, as the pointer that's passed to `main()` is already to a copy and not to the actual `environ` array.  But in Sage we were passing the global `environ` to GAP and that's where the problems arise, so we have to make a copy :|
     21
    2022This was a heisenbug, because I had an example case that reliably reproduced the problem when run by itself, but that ''worked'' when run under gdb.  The reason for this was tricky: There's actually only one place during GAP's initialization that modifies the environment (and even then it only happens if `HAVE_LIBREADLINE` is defined): In the `rl_initialize()` call that initializes readline.  It sets the `COLUMNS` and `LINES` variables if they are not already defined.
    2123