From 246eeb2b6951103f919e8b5a6acb46f6ab7d47e5 Mon Sep 17 00:00:00 2001 From: Dominic Hofer <6570912+dominichofer@users.noreply.github.com> Date: Fri, 9 Aug 2024 22:27:07 +0200 Subject: [PATCH] Remove execution permission from setup-env.sh (#45641) `setup-env.sh` is meant to be sourced, not executed directly. By revoking execution permissions, users who accidentally execute the script will receive an error instead of seeing no effect. * Remove execution permission from `setup-env.sh` and friends * Don't make output file executable in `spack commands --update-completion` --------- Co-authored-by: Todd Gamblin Signed-off-by: Todd Gamblin --- lib/spack/spack/cmd/commands.py | 4 ---- share/spack/setup-env.csh | 0 share/spack/setup-env.fish | 0 share/spack/setup-env.sh | 0 share/spack/setup-tutorial-env.sh | 0 share/spack/spack-completion.bash | 0 share/spack/spack-completion.fish | 0 7 files changed, 4 deletions(-) mode change 100755 => 100644 share/spack/setup-env.csh mode change 100755 => 100644 share/spack/setup-env.fish mode change 100755 => 100644 share/spack/setup-env.sh mode change 100755 => 100644 share/spack/setup-tutorial-env.sh mode change 100755 => 100644 share/spack/spack-completion.bash mode change 100755 => 100644 share/spack/spack-completion.fish diff --git a/lib/spack/spack/cmd/commands.py b/lib/spack/spack/cmd/commands.py index f9979339ed..c6e775dd43 100644 --- a/lib/spack/spack/cmd/commands.py +++ b/lib/spack/spack/cmd/commands.py @@ -11,7 +11,6 @@ from argparse import ArgumentParser, Namespace from typing import IO, Any, Callable, Dict, Iterable, List, Optional, Sequence, Set, Tuple, Union -import llnl.util.filesystem as fs import llnl.util.tty as tty from llnl.util.argparsewriter import ArgparseRstWriter, ArgparseWriter, Command from llnl.util.tty.colify import colify @@ -867,9 +866,6 @@ def _commands(parser: ArgumentParser, args: Namespace) -> None: prepend_header(args, f) formatter(args, f) - if args.update_completion: - fs.set_executable(args.update) - else: prepend_header(args, sys.stdout) formatter(args, sys.stdout) diff --git a/share/spack/setup-env.csh b/share/spack/setup-env.csh old mode 100755 new mode 100644 diff --git a/share/spack/setup-env.fish b/share/spack/setup-env.fish old mode 100755 new mode 100644 diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh old mode 100755 new mode 100644 diff --git a/share/spack/setup-tutorial-env.sh b/share/spack/setup-tutorial-env.sh old mode 100755 new mode 100644 diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash old mode 100755 new mode 100644 diff --git a/share/spack/spack-completion.fish b/share/spack/spack-completion.fish old mode 100755 new mode 100644