Skip to content

Broken symlinks not removed during mulle-sde fetch #11

@mulle-nat

Description

@mulle-nat

Problem

When a dependency directory is a broken symlink (e.g., pointing to a path from a different machine), mulle-sde fetch does not remove and recreate it, leaving the project
in a broken state.

Reproduction

bash
cd /path/to/project
rm -rf dependency
ln -s /nonexistent/path dependency
mulle-sde fetch
ls -la dependency # Still a broken symlink

Root Cause

  1. mulle-sourcetree status --is-uptodate correctly detects the broken symlink and returns exit code 2 (DIRTY)
  2. However, mulle-sourcetree dbstatus only checks timestamps and returns 0 (OK)
  3. mulle-sde fetch prioritizes dbstatus result and decides "Nothing to do"
  4. The sync operation (which contains the fix for broken symlinks) is never triggered

Current Fix Status

The code in mulle-sourcetree-action.sh at line ~1647 correctly detects and removes broken symlinks:

bash
if [ -L "${previousfilename}" ]
then
if [ ! -e "${previousfilename}" ]
then
log_verbose "Removing broken symlink "${previousfilename}""
exekutor rm -f "${previousfilename}" || exit 1
fi
fi

This works when running mulle-sourcetree sync directly, but not via mulle-sde fetch.

Workaround

mulle-sde clean --tidy

Run mulle-sourcetree sync directly instead of mulle-sde fetch.

Possible Solutions

  1. Make mulle-sde fetch respect status --is-uptodate result when it indicates broken symlinks
  2. Add a fast broken symlink check to dbstatus (but this may impact performance)
  3. Change the decision logic in mulle-sde fetch to trigger sync when status returns 2
  4. Do nothing (just clean --tidy)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions