ssh_filter_btrbk.sh: further harden the shell execution environment

• In principle the special `IFS`-variable could be set to some unexpected non-
  standard value.
  Unsetting it causes its default to be used.
• Locales and in particular their characters sets are quite complex in POSIX and
  may have many subtle implications.
  For example, the pattern matching notation (used in `case`-compound-commands
  or some forms of parameter expansion) are in principle only defined for
  character strings. While some shells handle it gracefully, the behaviour is
  undefined if, for example, the character set is UTF-8 and a variable contains
  bytes that do not form valid caracters in that.
  Actually, there are quite some more implications.

  Also, pathnames, in POSIX, are strings of bytes excluding 0x0.

  For these reasons, the locale is set to the `C`/`POSIX`-locale.

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
pull/539/head
Christoph Anton Mitterer 2022-11-22 00:09:31 +01:00 committed by Axel Burri
parent 5b8c1f8f7a
commit 7adb32c7e9
1 changed files with 5 additions and 2 deletions

View File

@ -1,8 +1,11 @@
#!/bin/sh
set -e -u
# initialise and sanitise the shell execution environment
unset -v IFS
export LC_ALL=C
export PATH='/sbin:/bin:/usr/sbin:/usr/bin'
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
set -e -u
enable_log=
restrict_path_list=