firejail/contrib/gdb-firejail.sh
Kelvin M. Klann 6648a1e968 *.sh: use consistent indentation
Almost all of the shell scripts in the repository use tabs for
indentation (or have no indentation at all):

    $ git grep -Il '^\t' -- '*.sh' | wc -l
    19
    $ git grep -Il '^ ' -- '*.sh' | wc -l
    5
    $ git grep -IL '^[ \t]' -- '*.sh' | wc -l
    25

So do the same in the few shell scripts that currently use spaces for
indentation.

Except for the following file:

* platform/rpm/mkrpm.sh

Not sure if it's following a packaging-specific scheme, so just fix the
one indentation inconsistency in it and otherwise leave it as is for
now.

Command used to search for shell scripts using spaces for indentation:

    $ git grep -In '^ ' -- '*.sh'
2023-02-20 17:39:31 -03:00

24 lines
870 B
Bash
Executable file

#!/bin/bash
# This file is part of Firejail project
# Copyright (C) 2014-2023 Firejail Authors
# License GPL v2
set -x
# gdb setuid helper script.
# This script forks a background process as the current user which will
# immediately send itself a `STOP` signal. Then gdb running as root will
# attach to that process, which will send it the `CONT` signal to continue
# execution. Then the backgrounded process will exec the program with the
# given arguments. This will allow the root gdb to trace the unprivileged
# setuid firejail process from the absolute beginning.
if [ -z "${1##*/firejail}" ]; then
FIREJAIL=$1
else
# First argument is not named firejail, then add default unless environment
# variable already set.
set -- ${FIREJAIL:=$(command -v firejail)} "$@"
fi
bash -c "kill -STOP \$\$; exec \"\$0\" \"\$@\"" "$@" &
sudo gdb -e "$FIREJAIL" -p "$!"