You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Append Termux-specific path to `zig_examined_elf_files` to workaround different path for `env` binary. See also ziglang#14146
* Use same buffer for searching shebang line to search ELF magic
constant, if any, and remove corresponding (now duplicate) check from
`abiAndDynamicLinkerFromFile`
* Fix not finding interpret path when it it separater from shebang by
one or more blank spaces
* Fix too big minimal limit of bytes from file (minimal shebang length instead of `buffer.len`)
Signed-off-by: Eric Joldasov <[email protected]>
/// Therefore, this function works the same regardless of whether the compiler binary is
249
-
/// dynamically or statically linked. It inspects `/usr/bin/env` as an ELF file to find the
249
+
/// dynamically or statically linked. It inspects files from default list of paths (`/usr/bin/env` and equivalent on Termux) as an ELF file to find the
250
250
/// answer to these questions, or if there is a shebang line, then it chases the referenced
251
251
/// file recursively. If that does not provide the answer, then the function falls back to
constinterpreter_and_arguments=mem.trim(u8, first_line[2..], std.ascii.whitespace[0..]); // Skip "#!" and trim whitespace at both ends of line (it is possible to have blank space right after "#!")
357
+
constinterpreter_end=mem.indexOfScalar(u8, interpreter_and_arguments, ' ') orelseinterpreter_and_arguments.len; // blank space possibly used for separation of interpreter and arguments
358
+
constinterpreter_path=interpreter_and_arguments[0..interpreter_end]; // another file which **might** be ELF file or shell script with "shebang line"
359
+
examined_file_path=interpreter_path; // move to examining this interpreter instead of starting point
360
+
} elsecontinue :iterate; // This path was not suitable as a starting point, move to the next path
361
+
break :iteratechased_elf_file; // TODO should it be only first suitable ELF file or a list of suitable files?
0 commit comments