Fixed infinite path mapping loop between dsnas1 and dsnas2

- Added path detection to prevent recursive analysis of paths already in destination format
- Added special handling for same logical path on different mounts
- Added early exit in process_copy for identical source and destination paths

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-03-04 18:03:53 +01:00
parent 4f7cb91bc5
commit bf41b9ad71
3 changed files with 27 additions and 0 deletions
@@ -215,6 +215,13 @@ process_copy() {
local id="$1" hash="$2" src="$3" dst="$4"
local operation_result=0
# Check if source and destination are the same or if we've already processed this
if [[ "${src}" == "${dst}" ]]; then
log_info "Source and destination are the same - skipping: ${src}"
mark_processed "${hash}"
return 0
fi
if [[ ! -d "${src}" ]]; then
log_error "Source directory missing: ${src}"
return 1
@@ -11,11 +11,20 @@ get_destination() {
return "${DEFAULT_DST}"
fi
# Check if path is already in the cache
if [[ -n "${PATH_CACHE["${source_path}"]+x}" ]]; then
echo "${PATH_CACHE["${source_path}"]}"
return
fi
# Skip recursive path analysis - only log once
if [[ "${source_path}" =~ ^/mnt/dsnas1/ ]]; then
# Already in destination format, return as is
PATH_CACHE["${source_path}"]="${source_path}"
echo "${source_path}"
return
fi
log_info "Analyzing path: ${source_path}"
local destination="${DEFAULT_DST}"