diff --git a/scratchbox2/execs/sb_exec.c b/scratchbox2/execs/sb_exec.c index c38ba92c..3c00f1bd 100644 --- a/scratchbox2/execs/sb_exec.c +++ b/scratchbox2/execs/sb_exec.c @@ -1535,7 +1535,7 @@ static int prepare_exec(const char *exec_fn_name, exec_policy_name, &mapped_file, &my_file, binaryname, (const char **)my_argv, &my_new_argv, - (const char **)*new_envp, &my_new_envp, + (const char **)my_envp, &my_new_envp, "target"); } else { postprocess_result = exec_postprocess_native_executable( @@ -1543,7 +1543,7 @@ static int prepare_exec(const char *exec_fn_name, &mapped_file, &my_file, binaryname, &info, (const char **)my_argv, &my_new_argv, - (const char **)*new_envp, &my_new_envp); + (const char **)my_envp, &my_new_envp); } my_envp = (char**)my_new_envp; /* FIXME */ my_argv = (char**)my_new_argv; /* FIXME */ @@ -1570,7 +1570,7 @@ static int prepare_exec(const char *exec_fn_name, exec_policy_name, &mapped_file, &my_file, binaryname, (const char **)my_argv, &my_new_argv, - (const char **)*new_envp, &my_new_envp, + (const char **)my_envp, &my_new_envp, "native"); my_envp = (char**)my_new_envp; /* FIXME */ my_argv = (char**)my_new_argv; /* FIXME */ @@ -1609,7 +1609,7 @@ static int prepare_exec(const char *exec_fn_name, exec_policy_name, &mapped_file, &my_file, binaryname, (const char **)my_argv, &my_new_argv, - (const char **)*new_envp, &my_new_envp); + (const char **)my_envp, &my_new_envp); my_envp = (char**)my_new_envp; /* FIXME */ my_argv = (char**)my_new_argv; /* FIXME */ } @@ -1639,7 +1639,7 @@ static int prepare_exec(const char *exec_fn_name, postprocess_result = exec_postprocess_cpu_transparency_executable( exec_policy_name, &mapped_file, &my_file, binaryname, - (const char **)my_argv, &my_new_argv, (const char **)*new_envp, &my_new_envp, + (const char **)my_argv, &my_new_argv, (const char **)my_envp, &my_new_envp, "target"); my_envp = (char**)my_new_envp; /* FIXME */ my_argv = (char**)my_new_argv; /* FIXME */ diff --git a/scratchbox2/lua_scripts/argvenvp_gcc.lua b/scratchbox2/lua_scripts/argvenvp_gcc.lua index 8fda8e08..2e95e349 100644 --- a/scratchbox2/lua_scripts/argvenvp_gcc.lua +++ b/scratchbox2/lua_scripts/argvenvp_gcc.lua @@ -73,17 +73,15 @@ function register_gcc_component_path(tmp, gccrule) table.insert(gcc_tools_path_prefixes, x) end - if gccrule == nil then - return - end - - if gccrule.cross_gcc_dir ~= nil then - table.insert(gcc_tools_path_prefixes, gccrule.cross_gcc_dir) - end + if gccrule ~= nil then + if gccrule.cross_gcc_dir ~= nil then + table.insert(gcc_tools_path_prefixes, gccrule.cross_gcc_dir) + end - if gccrule.cross_gcc_progs_path ~= nil then - for path in string.gmatch(gccrule.cross_gcc_progs_path,"[^:]+") do - table.insert(gcc_tools_path_prefixes, path) + if gccrule.cross_gcc_progs_path ~= nil then + for path in string.gmatch(gccrule.cross_gcc_progs_path,"[^:]+") do + table.insert(gcc_tools_path_prefixes, path) + end end end diff --git a/scratchbox2/lua_scripts/create_argvmods_usr_bin_rules.lua b/scratchbox2/lua_scripts/create_argvmods_usr_bin_rules.lua deleted file mode 100644 index ad545b5f..00000000 --- a/scratchbox2/lua_scripts/create_argvmods_usr_bin_rules.lua +++ /dev/null @@ -1,131 +0,0 @@ --- Copyright (c) 2009 Nokia Corporation. --- Author: Lauri T. Aarnio --- --- Licensed under MIT license - --- This script is executed after a new SB2 session has been created, --- to create mapping rules for toolchain components: --- For example, /usr/bin/gcc will be mapped to the toolchain. These rules --- are used for other filesystem operations than exec* --- (for example, when the shell is looking for a program, it must be --- possible to stat() the destination) --- - -gcc_rule_file_path = session_dir .. "/gcc-conf.lua" - -default_rule = os.getenv("SBOX_ARGVMODS_USR_BIN_DEFAULT_RULE") - -function argvmods_to_mapping_rules(prefix) - local n - for n in pairs(argvmods) do - local rule = argvmods[n] - -- print("-- rule ", n, " new_filename=", rule.new_filename) - local process_now = true - if prefix ~= nil then - if not sb.isprefix(prefix, n) then - process_now = false - end - end - - if process_now and not rule.argvmods_processed then - rule.argvmods_processed = true - local k - for k=1,table.maxn(rule.path_prefixes) do - if rule.path_prefixes[k] == "/usr/bin/" and - rule.new_filename ~= nil then - -- this rule maps "n" from /usr/bin to - -- another file - if sb.path_exists(rule.new_filename) then - print(" {path=\"/usr/bin/"..n.."\",") - print(" replace_by=\"" .. - rule.new_filename.."\"},") - else - print(" -- WARNING: " .. - rule.new_filename .. - " does not exist") - end - end - end - end - end -end - -print("-- Argvmods-to-mapping-rules converter:") -print("-- Automatically generated mapping rules. Do not edit:") - --- Mode-specific fixed config settings to ruledb: --- --- "enable_cross_gcc_toolchain" (default=true): All special processing --- for the gcc-related tools (gcc,as,ld,..) will be disabled if set --- to false. --- -ruletree.attach_ruletree() - -local modename_in_ruletree = sb.get_forced_mapmode() -if modename_in_ruletree == nil then - print("-- ERROR: modename_in_ruletree = nil") - os.exit(14) -end - -enable_cross_gcc_toolchain = true - -tools = tools_root -if (not tools) then - tools = "/" -end - -if (tools == "/") then - tools_prefix = "" -else - tools_prefix = tools -end - -do_file(session_dir .. "/share/scratchbox2/modes/"..modename_in_ruletree.."/config.lua") - -ruletree.catalog_set("Conf."..modename_in_ruletree, "enable_cross_gcc_toolchain", - ruletree.new_boolean(enable_cross_gcc_toolchain)) - -if exec_engine_loaded then - print("-- Warning: exec engine was already loaded, will load again") -end --- load the right argvmods_* file -do_file(session_dir .. "/lua_scripts/argvmods_loader.lua") -load_argvmods_file(nil) - --- Next, the argvmods stuff. - -print("argvmods_rules_for_usr_bin_"..sbox_cpu.." = {") -argvmods_to_mapping_rules(sbox_cpu) -if (default_rule ~= nil) then - print(" -- default:") - print(" ", default_rule) -end -print("}") -local prefixrule1 = " {prefix=\"/usr/bin/"..sbox_cpu.. - "\",rules=argvmods_rules_for_usr_bin_"..sbox_cpu.."}," -local prefixrule2 = "" - -if sbox_cpu ~= sbox_uname_machine then - print("argvmods_rules_for_usr_bin_"..sbox_uname_machine.." = {") - argvmods_to_mapping_rules(sbox_uname_machine) - if (default_rule ~= nil) then - print(" -- default:") - print(" ", default_rule) - end - print("}") - prefixrule2 = " {prefix=\"/usr/bin/"..sbox_uname_machine.. - "\",rules=argvmods_rules_for_usr_bin_"..sbox_uname_machine.."}," -end - -print("argvmods_rules_for_usr_bin = {") -print(prefixrule1) -print(prefixrule2) -argvmods_to_mapping_rules(nil) -if (default_rule ~= nil) then - print(" -- default:") - print(" ", default_rule) -end -print("}") - -print("-- End of rules created by argvmods-to-mapping-rules converter.") -