Merge pull request #469 from wpferguson/win_sanitize

Sanitize windows command interactions
This commit is contained in:
wpferguson
2024-06-06 13:01:55 -04:00
committed by GitHub
16 changed files with 99 additions and 33 deletions

View File

@@ -31,6 +31,7 @@
local dt = require "darktable"
local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local dtsys = require "lib/dtutils.system"
du.check_min_api_version("7.0.0", "executable_manager")
@@ -75,7 +76,7 @@ local function grep(file, pattern)
if dt.configuration.running_os == "windows" then
-- use find to get the matches
local command = "\\windows\\system32\\find.exe " .. "\"" .. pattern .. "\"" .. " " .. file
local f = io.popen(command)
local f = dtsys.io_popen(command)
local output = f:read("all")
f:close()
-- strip out the first line
@@ -84,7 +85,7 @@ local function grep(file, pattern)
else
-- use grep and just return the answers
local command = "grep " .. pattern .. " " .. file
local f = io.popen(command)
local f = dtsys.io_popen(command)
local output = f:read("all")
f:close()
result = du.split(output, "\n")

View File

@@ -7,6 +7,7 @@
local dt = require "darktable"
local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local dtsys = require "lib/dtutils.system"
local log = require "lib/dtutils.log"
local libname = nil
@@ -45,7 +46,7 @@ local function output_man(d)
mf:close()
if df.check_if_bin_exists("groff") then
if df.check_if_bin_exists("ps2pdf") then
os.execute("groff -man " .. fname .. " | ps2pdf - " .. fname .. ".pdf")
dtsys.os_execute("groff -man " .. fname .. " | ps2pdf - " .. fname .. ".pdf")
else
log.msg(log.error, "Missing ps2pdf. Can't generate pdf man pages.")
end
@@ -59,7 +60,7 @@ end
-- find the libraries
local output = io.popen("cd "..dt.configuration.config_dir.."/lua/lib ;find . -name \\*.lua -print | sort")
local output = dtsys.io_popen("cd "..dt.configuration.config_dir.."/lua/lib ;find . -name \\*.lua -print | sort")
-- loop through the libraries

View File

@@ -6,6 +6,7 @@
local dt = require "darktable"
local du = require "lib/dtutils"
local dtsys = require "lib/dtutils.system"
du.check_min_api_version("3.0.0", "get_libdoc")
@@ -36,7 +37,7 @@ end
-- find the libraries
local output = io.popen("cd "..dt.configuration.config_dir.."/lua/lib ;find . -name \\*.lua -print | sort")
local output = dtsys.io_popen("cd "..dt.configuration.config_dir.."/lua/lib ;find . -name \\*.lua -print | sort")
-- loop through the libraries