Merge pull request 'Fix #150: fresh-install genesis boot SIGSEGV in mem_save' (#95) from fix/genesis-boot-crash into hotfix/elc-source-typos
This commit was merged in pull request #95.
This commit is contained in:
+2
-2
@@ -120,8 +120,8 @@ el_val_t mem_consolidate(void) {
|
||||
}
|
||||
|
||||
el_val_t mem_save(el_val_t path) {
|
||||
el_val_t save_result = engram_save(path);
|
||||
if (str_eq(save_result, EL_STR(""))) {
|
||||
el_val_t saved = engram_save(path);
|
||||
if (saved == 0) {
|
||||
println(el_str_concat(el_str_concat(EL_STR("[memory] mem_save: engram_save failed for "), path), EL_STR(" \xe2\x80\x94 snapshot may be incomplete")));
|
||||
}
|
||||
return 0;
|
||||
|
||||
+2
-2
@@ -744,8 +744,8 @@ el_val_t handle_api_consolidate(el_val_t body) {
|
||||
el_val_t summary = json_get(body, EL_STR("summary"));
|
||||
el_val_t snap = state_get(EL_STR("soul_snapshot_path"));
|
||||
if (!str_eq(snap, EL_STR(""))) {
|
||||
el_val_t save_result = engram_save(snap);
|
||||
if (str_eq(save_result, EL_STR(""))) {
|
||||
el_val_t saved = engram_save(snap);
|
||||
if (saved == 0) {
|
||||
println(el_str_concat(el_str_concat(EL_STR("[api] consolidate: engram_save failed for "), snap), EL_STR(" \xe2\x80\x94 snapshot may be out of sync")));
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -25383,8 +25383,8 @@ el_val_t mem_consolidate(void) {
|
||||
}
|
||||
|
||||
el_val_t mem_save(el_val_t path) {
|
||||
el_val_t save_result = engram_save(path);
|
||||
if (str_eq(save_result, EL_STR(""))) {
|
||||
el_val_t saved = engram_save(path);
|
||||
if (saved == 0) {
|
||||
println(el_str_concat(el_str_concat(EL_STR("[memory] mem_save: engram_save failed for "), path), EL_STR(" \xe2\x80\x94 snapshot may be incomplete")));
|
||||
}
|
||||
return 0;
|
||||
@@ -29336,8 +29336,8 @@ el_val_t handle_api_consolidate(el_val_t body) {
|
||||
el_val_t summary = json_get(body, EL_STR("summary"));
|
||||
el_val_t snap = state_get(EL_STR("soul_snapshot_path"));
|
||||
if (!str_eq(snap, EL_STR(""))) {
|
||||
el_val_t save_result = engram_save(snap);
|
||||
if (str_eq(save_result, EL_STR(""))) {
|
||||
el_val_t saved = engram_save(snap);
|
||||
if (saved == 0) {
|
||||
println(el_str_concat(el_str_concat(EL_STR("[api] consolidate: engram_save failed for "), snap), EL_STR(" \xe2\x80\x94 snapshot may be out of sync")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,8 +133,12 @@ fn mem_consolidate() -> String {
|
||||
}
|
||||
|
||||
fn mem_save(path: String) -> Void {
|
||||
let save_result: String = engram_save(path)
|
||||
if str_eq(save_result, "") {
|
||||
// engram_save returns an Int (1 = ok, 0 = failure), NOT a String. Calling
|
||||
// str_eq on it casts EL_CSTR(1) -> (char*)0x1 and SIGSEGVs on a SUCCESSFUL
|
||||
// save — which is exactly what a fresh-install genesis boot does first
|
||||
// (seeds the brain, saves, crashes). This is issue #150. Check the Int.
|
||||
let saved: Int = engram_save(path)
|
||||
if saved == 0 {
|
||||
println("[memory] mem_save: engram_save failed for " + path + " — snapshot may be incomplete")
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -725,8 +725,10 @@ fn handle_api_consolidate(body: String) -> String {
|
||||
let summary: String = json_get(body, "summary")
|
||||
let snap: String = state_get("soul_snapshot_path")
|
||||
if !str_eq(snap, "") {
|
||||
let save_result: String = engram_save(snap)
|
||||
if str_eq(save_result, "") {
|
||||
// engram_save returns an Int (1 = ok, 0 = failure); str_eq on it derefs
|
||||
// EL_CSTR(1)=0x1 and SIGSEGVs on success (issue #150). Check the Int.
|
||||
let saved: Int = engram_save(snap)
|
||||
if saved == 0 {
|
||||
println("[api] consolidate: engram_save failed for " + snap + " — snapshot may be out of sync")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user