jnavila/plotkicadsch

Distro-specific issue and possible patch

leungbk opened this issue · 1 comments

I am packaging this for the Nix package manager and found that i needed to do the following to get the plotgitsch executable to run:

diff --git a/plotkicadsch/src/sysAbst.ml b/plotkicadsch/src/sysAbst.ml
index c3c7b52..4300e8f 100644
--- a/plotkicadsch/src/sysAbst.ml
+++ b/plotkicadsch/src/sysAbst.ml
@@ -30,9 +30,9 @@ let detect_os () : os =
   if Sys.win32 then Windows
   else if Sys.cygwin then Cygwin
   else
-    let ((in_ch, _, _) as uname) = UnixLabels.open_process_full "uname" ~env:[| |] in
+    let ((in_ch, _) as uname) = UnixLabels.open_process "uname" in
     let os = input_line in_ch in
-    ignore (UnixLabels.close_process_full uname) ;
+    ignore (UnixLabels.close_process uname) ;
     match os with
     | "Darwin" ->
         MacOS
-- 
2.37.1

On NixOS, I am unable to get a cleanly built plotgitsch to run whether installing the package from opam or via my Nix expression; it is only after applying this patch that I am able to avoid triggering an end-of-file error upon trying the line

  let os = input_line in_ch in

The error is

Fatal error: exception End_of_file
Raised at Stdlib.input_line.scan in file "stdlib.ml", line 456, characters 14-31
Called from SysAbst.detect_os in file "plotkicadsch/src/sysAbst.ml", line 34, characters 13-29
Called from SysAbst.default_opener in file "plotkicadsch/src/sysAbst.ml", line 101, characters 8-20
Called from Plotgitsch.internal_diff in file "plotkicadsch/src/plotgitsch.ml", line 61, characters 26-53

I don't observe this problem when installing from opam on macOS.

Are there any possible issues with my patch? I assume you cleared the env for a reason.

Resolved downstream via an alternate patch.