Saturday, December 23, 2023

Re: Bugfix: lang/deno

Index: patch-cli_build_rs
===================================================================
RCS file: /cvs/ports/lang/deno/patches/patch-cli_build_rs,v
retrieving revision 1.2
diff -u -p -r1.2 patch-cli_build_rs
--- patch-cli_build_rs 15 Jul 2023 20:30:41 -0000 1.2
+++ patch-cli_build_rs 23 Dec 2023 18:52:16 -0000
@@ -1,7 +1,7 @@
Index: cli/build.rs
--- cli/build.rs.orig
+++ cli/build.rs
-@@ -435,6 +435,13 @@ fn main() {
+@@ -424,6 +424,13 @@ fn main() {
symbols_path.display()
);

@@ -14,4 +14,4 @@ Index: cli/build.rs
+
#[cfg(target_os = "linux")]
{
- let ver = glibc_version::get_version().unwrap();
+ // If a custom compiler is set, the glibc version is not reliable.
Index: patch-cli_main_rs
===================================================================
RCS file: /cvs/ports/lang/deno/patches/patch-cli_main_rs,v
retrieving revision 1.2
diff -u -p -r1.2 patch-cli_main_rs
--- patch-cli_main_rs 7 Sep 2023 05:45:25 -0000 1.2
+++ patch-cli_main_rs 23 Dec 2023 18:52:16 -0000
@@ -7,7 +7,7 @@ Index: cli/main.rs
let future = async move {
- let current_exe_path = current_exe()?;
+ let current_exe_path = current_exe()
-+ .unwrap_or(PathBuf::from("${LOCALBASE}/bin/deno"));
++ .unwrap_or(PathBuf::from("${PREFIX}/bin/deno"));
let standalone_res =
match standalone::extract_standalone(&current_exe_path, args.clone())
.await
Index: patch-cli_standalone_binary_rs
===================================================================
RCS file: /cvs/ports/lang/deno/patches/patch-cli_standalone_binary_rs,v
retrieving revision 1.2
diff -u -p -r1.2 patch-cli_standalone_binary_rs
--- patch-cli_standalone_binary_rs 7 Sep 2023 05:45:25 -0000 1.2
+++ patch-cli_standalone_binary_rs 23 Dec 2023 18:52:16 -0000
@@ -7,7 +7,7 @@ Index: cli/standalone/binary.rs
pub fn load_npm_vfs(root_dir_path: PathBuf) -> Result<FileBackedVfs, AnyError> {
- let file_path = current_exe().unwrap();
+ let file_path =
-+ current_exe().unwrap_or(PathBuf::from("${LOCALBASE}/bin/deno"));
++ current_exe().unwrap_or(PathBuf::from("${PREFIX}/bin/deno"));
let mut file = std::fs::File::open(file_path)?;
file.seek(SeekFrom::End(-(TRAILER_SIZE as i64)))?;
let mut trailer = [0; TRAILER_SIZE];
@@ -16,7 +16,7 @@ Index: cli/standalone/binary.rs
) -> Result<Vec<u8>, AnyError> {
if compile_flags.target.is_none() {
- let path = std::env::current_exe()?;
-+ let path = PathBuf::from("${LOCALBASE}/bin/deno");
++ let path = PathBuf::from("${PREFIX}/bin/deno");
return Ok(std::fs::read(path)?);
}

Index: patch-cli_standalone_mod_rs
===================================================================
RCS file: /cvs/ports/lang/deno/patches/patch-cli_standalone_mod_rs,v
retrieving revision 1.2
diff -u -p -r1.2 patch-cli_standalone_mod_rs
--- patch-cli_standalone_mod_rs 7 Sep 2023 05:45:25 -0000 1.2
+++ patch-cli_standalone_mod_rs 23 Dec 2023 18:52:16 -0000
@@ -15,7 +15,7 @@ Index: cli/standalone/mod.rs
let main_module = &metadata.entrypoint;
- let current_exe_path = std::env::current_exe().unwrap();
+ let current_exe_path =
-+ std::env::current_exe().unwrap_or(PathBuf::from("${LOCALBASE}/bin/deno"));
++ std::env::current_exe().unwrap_or(PathBuf::from("${PREFIX}/bin/deno"));
let current_exe_name =
current_exe_path.file_name().unwrap().to_string_lossy();
let deno_dir_provider = Arc::new(DenoDirProvider::new(None));
Index: patch-modcargo-crates_deno_task_shell-0_11_0_src_shell_commands_executable_rs
===================================================================
RCS file: /cvs/ports/lang/deno/patches/patch-modcargo-crates_deno_task_shell-0_11_0_src_shell_commands_executable_rs,v
retrieving revision 1.3
diff -u -p -r1.3 patch-modcargo-crates_deno_task_shell-0_11_0_src_shell_commands_executable_rs
--- patch-modcargo-crates_deno_task_shell-0_11_0_src_shell_commands_executable_rs 7 Sep 2023 05:45:25 -0000 1.3
+++ patch-modcargo-crates_deno_task_shell-0_11_0_src_shell_commands_executable_rs 23 Dec 2023 18:52:16 -0000
@@ -15,7 +15,7 @@ Index: modcargo-crates/deno_task_shell-0
- return ExecuteResult::Continue(1, Vec::new(), Vec::new());
- }
- };
-+ let command_path = "${LOCALBASE}/bin/deno";
++ let command_path = "${PREFIX}/bin/deno";

let mut sub_command = tokio::process::Command::new(&command_path);
let child = sub_command
@@ -24,7 +24,7 @@ Index: modcargo-crates/deno_task_shell-0
let file_stem = exe_path.file_stem().map(|s| s.to_string_lossy());
if file_stem.map(|s| s.to_string()) == Some("deno".to_string()) {
- return Ok(exe_path);
-+ return Ok(PathBuf::from("${LOCALBASE}/bin/deno"));
++ return Ok(PathBuf::from("${PREFIX}/bin/deno"));
}
}
}
@@ -33,10 +33,10 @@ Index: modcargo-crates/deno_task_shell-0
);
let path =
- resolve_command_path("deno", &state, || Ok(PathBuf::from("/bin/deno")))
-+ resolve_command_path("deno", &state, || Ok(PathBuf::from("${LOCALBASE}/bin/deno")))
++ resolve_command_path("deno", &state, || Ok(PathBuf::from("${PREFIX}/bin/deno")))
.unwrap();
- assert_eq!(path, PathBuf::from("/bin/deno"));
-+ assert_eq!(path, PathBuf::from("${LOCALBASE}/bin/deno"));
++ assert_eq!(path, PathBuf::from("${PREFIX}/bin/deno"));

let path = resolve_command_path("deno", &state, || {
Ok(PathBuf::from("/bin/deno.exe"))
Index: patch-runtime_ops_os_mod_rs
===================================================================
RCS file: patch-runtime_ops_os_mod_rs
diff -N patch-runtime_ops_os_mod_rs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patch-runtime_ops_os_mod_rs 23 Dec 2023 18:52:16 -0000
@@ -0,0 +1,20 @@
+Index: runtime/ops/os/mod.rs
+--- runtime/ops/os/mod.rs.orig
++++ runtime/ops/os/mod.rs
+@@ -14,6 +14,7 @@ use deno_node::NODE_ENV_VAR_ALLOWLIST;
+ use serde::Serialize;
+ use std::collections::HashMap;
+ use std::env;
++use std::path::PathBuf;
+
+ mod sys_info;
+
+@@ -64,6 +65,8 @@ deno_core::extension!(
+ #[op]
+ fn op_exec_path(state: &mut OpState) -> Result<String, AnyError> {
+ let current_exe = env::current_exe().unwrap();
++ let current_exe =
++ std::env::current_exe().unwrap_or(PathBuf::from("${PREFIX}/bin/deno"));
+ state
+ .borrow_mut::<PermissionsContainer>()
+ .check_read_blind(&current_exe, "exec_path", "Deno.execPath()")?;
On 2023-12-23 17:21, Antoine Jacoutot wrote:
>I would prefer to clean it up right away.

If that's what it takes ... new diff attached.

No comments:

Post a Comment