From a18ca0a19689ad003fdd437e962b055b89d8c31a Mon Sep 17 00:00:00 2001 From: Vasiliy Stelmachenok Date: Wed, 6 Nov 2024 19:59:54 +0300 Subject: [PATCH] cachyos-bugreport: Bring back write permission check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Initially I thought it wasn't a concern since the script runs under root, but in some “edge cases” like being inside /proc it's still needed. Signed-off-by: Vasiliy Stelmachenok --- usr/bin/cachyos-bugreport.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/usr/bin/cachyos-bugreport.sh b/usr/bin/cachyos-bugreport.sh index aff1918..3837c9b 100755 --- a/usr/bin/cachyos-bugreport.sh +++ b/usr/bin/cachyos-bugreport.sh @@ -34,6 +34,19 @@ check_oldlog() { } +check_wpermission() { + if ! touch "$LOG_FILENAME" 2>/dev/null; then + cat << EOF >&2 + +ERROR: Working directory is not writable; please cd to a directory + where you have write permission so that the $LOG_FILENAME + file can be written. + +EOF + exit 1 + fi +} + bugreport() { echo "Starting with bugreport" @@ -77,5 +90,6 @@ upload() { check_root check_oldlog +check_wpermission bugreport upload