File tree Expand file tree Collapse file tree 3 files changed +13
-22
lines changed Expand file tree Collapse file tree 3 files changed +13
-22
lines changed Original file line number Diff line number Diff line change @@ -96,15 +96,15 @@ pub fn run_fastga_alignment(
9696 // Convert to raw pointers for C
9797 let c_args: Vec < * const c_char > = args. iter ( ) . map ( |s| s. as_ptr ( ) ) . collect ( ) ;
9898
99- // Set PATH to include our binary directory so FastGA can find FAtoGDB, GIXmake, etc.
99+ // Set ISOLATED PATH so FastGA can ONLY find its own utilities (FAtoGDB, GIXmake, etc.)
100+ // This prevents FastGA from accidentally using system binaries
100101 let bin_dir = find_fastga_bin_dir ( ) ;
101102
102- // Save original PATH
103+ // Save original PATH for restoration
103104 let original_path = std:: env:: var ( "PATH" ) . unwrap_or_default ( ) ;
104105
105- // Add our binary directory to PATH
106- let new_path = format ! ( "{bin_dir}:{original_path}" ) ;
107- std:: env:: set_var ( "PATH" , & new_path) ;
106+ // Set PATH to ONLY our binary directory (isolated)
107+ std:: env:: set_var ( "PATH" , & bin_dir) ;
108108
109109 // Create a pipe to capture stdout
110110 use std:: io:: Read ;
Original file line number Diff line number Diff line change @@ -38,17 +38,10 @@ impl Orchestrator {
3838 // Find FastGA binary
3939 let fastga = find_fastga_binary ( ) ?;
4040
41- // Get binary directory and set up PATH so FastGA can find its helper utilities
41+ // Get binary directory and set up ISOLATED PATH so FastGA can ONLY find its own utilities
42+ // This prevents FastGA from accidentally using system binaries
4243 let binary_dir = crate :: binary_finder:: get_binary_dir ( ) ?;
43- let new_path = if let Some ( old_path) = std:: env:: var_os ( "PATH" ) {
44- let mut paths = std:: env:: split_paths ( & old_path) . collect :: < Vec < _ > > ( ) ;
45- // Prepend binary_dir to ensure it's found first
46- paths. insert ( 0 , binary_dir. clone ( ) ) ;
47- std:: env:: join_paths ( paths) . unwrap ( )
48- } else {
49- // No existing PATH, just use binary_dir
50- std:: ffi:: OsString :: from ( binary_dir. as_os_str ( ) )
51- } ;
44+ let new_path = std:: ffi:: OsString :: from ( binary_dir. as_os_str ( ) ) ;
5245
5346 // FIX 1: Create unique temp directory for FastGA's internal files (GDB, indexes, etc.)
5447 // This prevents race conditions when multiple FastGA instances run in parallel
Original file line number Diff line number Diff line change @@ -139,10 +139,9 @@ pub fn run_fastga_simple(
139139 cmd. arg ( query_path) ;
140140 cmd. arg ( target_path) ;
141141
142- // Set PATH to include binary directory
143- let current_path = std:: env:: var ( "PATH" ) . unwrap_or_default ( ) ;
144- let new_path = format ! ( "{}:{}" , bin_dir. display( ) , current_path) ;
145- cmd. env ( "PATH" , new_path) ;
142+ // Set ISOLATED PATH so FastGA can ONLY find its own utilities
143+ // This prevents FastGA from accidentally using system binaries
144+ cmd. env ( "PATH" , bin_dir) ;
146145
147146 eprintln ! ( "[FastGA] Running command: {cmd:?}" ) ;
148147
@@ -192,9 +191,8 @@ where
192191 cmd. arg ( query_path) ;
193192 cmd. arg ( target_path) ;
194193
195- let current_path = std:: env:: var ( "PATH" ) . unwrap_or_default ( ) ;
196- let new_path = format ! ( "{}:{}" , bin_dir. display( ) , current_path) ;
197- cmd. env ( "PATH" , new_path) ;
194+ // Set ISOLATED PATH so FastGA can ONLY find its own utilities
195+ cmd. env ( "PATH" , bin_dir) ;
198196
199197 let mut child = cmd
200198 . stdout ( Stdio :: piped ( ) )
You can’t perform that action at this time.
0 commit comments