From 0d7c6e48bc00f701f0c89a3c112eec6d52dc652f Mon Sep 17 00:00:00 2001 From: VolandSZ <{E-MAIL}> Date: Wed, 17 Jun 2026 15:27:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20helper=20-=20get=5Fdir=5Fdiagnostics=20=D1=82=D1=83?= =?UTF-8?q?=D0=B4=D0=B0=20=D0=B2=D1=8B=D0=BD=D0=B5=D1=81=D0=B5=D0=BD=D1=8B?= =?UTF-8?q?=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=20=D0=B4=D0=BE=D1=81=D1=82=D1=83=D0=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- torrent_sort.sh | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/torrent_sort.sh b/torrent_sort.sh index 9a39455..5684d0e 100644 --- a/torrent_sort.sh +++ b/torrent_sort.sh @@ -32,6 +32,22 @@ log_collision() { echo "[$(timestamp)] [SKIP] Collision: $1" >> "$LOG_FILE" } +get_dir_diagnostics() { + local DIR="$1" + + local DIR_STAT + DIR_STAT=$(stat -c 'inode=%i uid=%u gid=%g perms=%a owner=%U group=%G' "$DIR" 2>/dev/null) + + cat </dev/null) - log_error "Target directory is not writable Source='$FILE_PATH' Target='$TARGET_FILE' -target_dir_stat='$DST_DIR_STAT' - -current_user='$(id -un)' -current_group='$(id -gn)' -current_uid='$(id -u)' -current_gid='$(id -g)'" +$(get_dir_diagnostics "$TARGET_DIR")" continue fi @@ -247,7 +253,6 @@ current_gid='$(id -g)'" LN_ERROR=$(cat "$TMP_ERR" 2>/dev/null) SRC_STAT=$(stat -c 'inode=%i uid=%u gid=%g perms=%a owner=%U group=%G' "$FILE_PATH" 2>/dev/null) - DST_DIR_STAT=$(stat -c 'inode=%i uid=%u gid=%g perms=%a owner=%U group=%G' "$TARGET_DIR" 2>/dev/null) log_error "Link failed for '$FINAL_FILENAME' @@ -257,12 +262,8 @@ Target='$TARGET_FILE' ln_error='$LN_ERROR' source_stat='$SRC_STAT' -target_dir_stat='$DST_DIR_STAT' -current_user='$(id -un)' -current_group='$(id -gn)' -current_uid='$(id -u)' -current_gid='$(id -g)'" +$(get_dir_diagnostics "$TARGET_DIR")" fi