Remove shell=True from scripts (#2257)

* Remove shell=True from scripts
pull/2259/head
bmaltais 2024-04-11 08:00:31 -04:00 committed by GitHub
parent 8633484a5a
commit 831af8babe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 22 additions and 18 deletions

View File

@ -411,9 +411,10 @@ ControlNet dataset is used to specify the mask. The mask images should be the RG
### 2024/04/10 (v23.1.5)
- Fix issue with Textual Inversion configuration file selection.
- Upgrade to gradio 4.19.2 to fix several high security risks associated to earlier versions. Hoping this will not introduce undorseen issues.
- Upgrade to gradio 4.19.2 to fix several high security risks associated to earlier versions. This is a major upgrade, moving from 3.x to 4.x. Hoping this will not introduce undorseen issues.
- Upgrade transformers to 4.38.0 to fix a low severity security issue.
- Add explicit --do_not_share parameter to kohya_gui.py to avoid sharing the GUI on platforms like Kaggle.
- Remove shell=True from subprocess calls to avoid security issues when using the GUI.
### 2024/04/08 (v23.1.4)

View File

@ -27,6 +27,7 @@ rik="rik"
koo="koo"
yos="yos"
wn="wn"
parm = "parm"
[files]

View File

@ -83,7 +83,7 @@ def caption_images(
)
# Run the command based on the operating system
subprocess.run(run_cmd, shell=True, env=env)
subprocess.run(run_cmd, env=env)
# Check if overwrite option is enabled
if overwrite:

View File

@ -79,7 +79,7 @@ def caption_images(
)
# Run the command in the sd-scripts folder context
subprocess.run(run_cmd, shell=True, env=env, cwd=f"{scriptdir}/sd-scripts")
subprocess.run(run_cmd, env=env, cwd=f"{scriptdir}/sd-scripts")
# Add prefix and postfix
add_pre_postfix(

View File

@ -28,7 +28,7 @@ class CommandExecutor:
if self.process and self.process.poll() is None:
log.info("The command is already running. Please wait for it to finish.")
else:
self.process = subprocess.Popen(run_cmd, shell=True, **kwargs)
self.process = subprocess.Popen(run_cmd, **kwargs)
def kill_command(self):
"""

View File

@ -59,7 +59,7 @@ def convert_lcm(name, model_path, lora_scale, model_type):
)
# Run the command
subprocess.run(run_cmd, shell=True, env=env)
subprocess.run(run_cmd, env=env)
# Return a success message
log.info("Done extracting...")

View File

@ -104,7 +104,7 @@ def convert_model(
)
# Run the command
subprocess.run(run_cmd, shell=True, env=env)
subprocess.run(run_cmd, env=env)
###

View File

@ -64,7 +64,7 @@ def extract_dylora(
)
# Run the command
subprocess.run(run_cmd, shell=True, env=env)
subprocess.run(run_cmd, env=env)
log.info("Done extracting DyLoRA...")

View File

@ -102,7 +102,7 @@ def extract_lora(
)
# Run the command
subprocess.run(run_cmd, shell=True, env=env)
subprocess.run(run_cmd, env=env)
###

View File

@ -110,7 +110,7 @@ def extract_lycoris_locon(
)
# Run the command
subprocess.run(run_cmd, shell=True, env=env)
subprocess.run(run_cmd, env=env)
log.info("Done extracting...")

View File

@ -517,10 +517,11 @@ def train_model(
env["PYTHONPATH"] = (
rf"{scriptdir}{os.pathsep}{scriptdir}/sd-scripts{os.pathsep}{env.get('PYTHONPATH', '')}"
)
env["TF_ENABLE_ONEDNN_OPTS"] = "0"
if not print_only:
# Run the command
subprocess.run(run_cmd, shell=True, env=env)
subprocess.run(run_cmd, env=env)
# create images buckets
if generate_image_buckets:
@ -550,10 +551,11 @@ def train_model(
env["PYTHONPATH"] = (
rf"{scriptdir}{os.pathsep}{scriptdir}/sd-scripts{os.pathsep}{env.get('PYTHONPATH', '')}"
)
env["TF_ENABLE_ONEDNN_OPTS"] = "0"
if not print_only:
# Run the command
subprocess.run(run_cmd, shell=True, env=env)
subprocess.run(run_cmd, env=env)
image_num = len(
[

View File

@ -51,7 +51,7 @@ def caption_images(
)
# Run the command
subprocess.run(run_cmd, shell=True, env=env)
subprocess.run(run_cmd, env=env)
# Add prefix and postfix
add_pre_postfix(

View File

@ -53,7 +53,7 @@ def group_images(
)
# Run the command
subprocess.run(run_cmd, shell=True, env=env)
subprocess.run(run_cmd, env=env)
log.info("...grouping done")

View File

@ -452,6 +452,6 @@ class GradioMergeLoRaTab:
)
# Run the command
subprocess.run(run_cmd, shell=True, env=env)
subprocess.run(run_cmd, env=env)
log.info("Done merging...")

View File

@ -56,7 +56,7 @@ def merge_lycoris(
)
# Run the command
subprocess.run(run_cmd, shell=True, env=env)
subprocess.run(run_cmd, env=env)
log.info("Done merging...")

View File

@ -83,7 +83,7 @@ def resize_lora(
)
# Run the command
subprocess.run(run_cmd, shell=True, env=env)
subprocess.run(run_cmd, env=env)
log.info("Done resizing...")

View File

@ -99,7 +99,7 @@ def svd_merge_lora(
)
# Run the command
subprocess.run(run_cmd, shell=True, env=env)
subprocess.run(run_cmd, env=env)
###

View File

@ -94,7 +94,7 @@ def caption_images(
env["TF_ENABLE_ONEDNN_OPTS"] = "0"
# Run the command
subprocess.run(run_cmd, shell=True, env=env)
subprocess.run(run_cmd, env=env)
# Add prefix and postfix
add_pre_postfix(