From a88c5a19df2c21319f6088ed50e45b0a307234aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Tue, 4 Feb 2025 17:26:58 +0100 Subject: [PATCH] Don't add Unix.putenv --- compiler/tests-check-prim/main.4.14.output | 1 - compiler/tests-check-prim/main.5.2.output | 1 - compiler/tests-check-prim/main.5.3.output | 1 - compiler/tests-check-prim/unix-Unix.4.14.output | 1 - compiler/tests-check-prim/unix-Unix.5.2.output | 1 - compiler/tests-check-prim/unix-Unix.5.3.output | 1 - runtime/js/unix.js | 16 ---------------- runtime/wasm/runtime.js | 1 - runtime/wasm/unix.wat | 7 ------- 9 files changed, 30 deletions(-) diff --git a/compiler/tests-check-prim/main.4.14.output b/compiler/tests-check-prim/main.4.14.output index 01272e65e7..94bb240abc 100644 --- a/compiler/tests-check-prim/main.4.14.output +++ b/compiler/tests-check-prim/main.4.14.output @@ -140,7 +140,6 @@ jsoo_toplevel_init_reloc From +unix.js: caml_strerror -caml_sys_putenv caml_unix_access caml_unix_chdir caml_unix_chmod diff --git a/compiler/tests-check-prim/main.5.2.output b/compiler/tests-check-prim/main.5.2.output index 9c0db80442..973ddcb677 100644 --- a/compiler/tests-check-prim/main.5.2.output +++ b/compiler/tests-check-prim/main.5.2.output @@ -136,7 +136,6 @@ jsoo_toplevel_init_reloc From +unix.js: caml_strerror -caml_sys_putenv caml_unix_access caml_unix_chdir caml_unix_chmod diff --git a/compiler/tests-check-prim/main.5.3.output b/compiler/tests-check-prim/main.5.3.output index 6167ae7545..af47aa226e 100644 --- a/compiler/tests-check-prim/main.5.3.output +++ b/compiler/tests-check-prim/main.5.3.output @@ -134,7 +134,6 @@ jsoo_toplevel_init_reloc From +unix.js: caml_strerror -caml_sys_putenv caml_unix_access caml_unix_chdir caml_unix_chmod diff --git a/compiler/tests-check-prim/unix-Unix.4.14.output b/compiler/tests-check-prim/unix-Unix.4.14.output index a6a6907210..d6634cabe7 100644 --- a/compiler/tests-check-prim/unix-Unix.4.14.output +++ b/compiler/tests-check-prim/unix-Unix.4.14.output @@ -215,7 +215,6 @@ jsoo_toplevel_init_compile jsoo_toplevel_init_reloc From +unix.js: -caml_sys_putenv caml_unix_access caml_unix_chdir caml_unix_chmod diff --git a/compiler/tests-check-prim/unix-Unix.5.2.output b/compiler/tests-check-prim/unix-Unix.5.2.output index 31998ff808..02ee9d3515 100644 --- a/compiler/tests-check-prim/unix-Unix.5.2.output +++ b/compiler/tests-check-prim/unix-Unix.5.2.output @@ -212,7 +212,6 @@ jsoo_toplevel_init_reloc From +unix.js: caml_strerror -caml_sys_putenv caml_unix_cleanup caml_unix_filedescr_of_fd caml_unix_findclose diff --git a/compiler/tests-check-prim/unix-Unix.5.3.output b/compiler/tests-check-prim/unix-Unix.5.3.output index 4a9f4a1f92..1c8c4155fd 100644 --- a/compiler/tests-check-prim/unix-Unix.5.3.output +++ b/compiler/tests-check-prim/unix-Unix.5.3.output @@ -210,7 +210,6 @@ jsoo_toplevel_init_reloc From +unix.js: caml_strerror -caml_sys_putenv caml_unix_cleanup caml_unix_filedescr_of_fd caml_unix_findclose diff --git a/runtime/js/unix.js b/runtime/js/unix.js index b05ae747b2..75bbff9b0f 100644 --- a/runtime/js/unix.js +++ b/runtime/js/unix.js @@ -91,22 +91,6 @@ function caml_unix_startup() {} //Alias: win_cleanup function caml_unix_cleanup() {} -//Provides: caml_sys_putenv (const, const) -//Requires: caml_jsstring_of_string, jsoo_static_env -function caml_sys_putenv(name, value) { - var name = caml_jsstring_of_string(name); - var value = caml_jsstring_of_string(value); - delete jsoo_static_env[name]; - //nodejs env - var process = globalThis.process; - if (process && process.env) { - process.env[name] = value; - return 0; - } - if (!globalThis.jsoo_env) globalThis.jsoo_env = {}; - globalThis.jsoo_env[name] = value; -} - //Provides: caml_unix_filedescr_of_fd const //Alias: win_handle_fd function caml_unix_filedescr_of_fd(x) { diff --git a/runtime/wasm/runtime.js b/runtime/wasm/runtime.js index 1f7c06a172..e88e837714 100644 --- a/runtime/wasm/runtime.js +++ b/runtime/wasm/runtime.js @@ -458,7 +458,6 @@ argv: () => (isNode ? process.argv.slice(1) : ["a.out"]), on_windows: () => on_windows, getenv: (n) => (isNode ? process.env[n] : null), - putenv: (n, v) => process.env[n] = v, system: (c) => { var res = require("node:child_process").spawnSync(c, { shell: true, diff --git a/runtime/wasm/unix.wat b/runtime/wasm/unix.wat index 6450525d28..6bc49d2811 100644 --- a/runtime/wasm/unix.wat +++ b/runtime/wasm/unix.wat @@ -26,7 +26,6 @@ (param i32) (param i32) (param i32) (param i32) (param i32) (param i32) (result f64))) (import "bindings" "utimes" (func $utimes (param anyref f64 f64))) - (import "bindings" "putenv" (func $putenv (param anyref anyref))) (import "bindings" "stat" (func $stat (param anyref i32) (result (ref eq)))) (import "bindings" "lstat" (func $lstat (param anyref i32) (result (ref eq)))) (import "bindings" "fstat" @@ -338,12 +337,6 @@ (call $caml_unix_error (pop externref) (ref.null eq)))) (ref.i31 (i32.const 0))) - (func (export "caml_sys_putenv") - (param $name (ref eq)) (param $value (ref eq)) - (call $putenv - (call $unwrap (call $caml_jsstring_of_string (local.get $name))) - (call $unwrap (call $caml_jsstring_of_string (local.get $value))))) - (func (export "caml_alloc_stat") (param $large i32) (param $dev i32) (param $ino i32) (param $kind i32) (param $perm i32)