Skip to content

[BUG] mv of a symlink on a direct bind renames the link's target #386

Open

Description

@strandly-the-agent

Checks

  • I have updated to the latest minor and patch version of Strands Shell (built from main dbb6189)
  • I have checked the documentation and this is not expected behavior
  • I have searched issues and there are no duplicates of my issue

Binding

Rust

Strands Shell Version

main @ dbb6189 (Cargo version 0.0.0)

Language Runtime Version

Rust 1.100.0

Operating System

Debian GNU/Linux 12 (aarch64)

Installation Method

built from source

Steps to Reproduce

mkdir /tmp/im && echo f > /tmp/im/f && ln -s f /tmp/im/lf
printf '[[bind]]\nmode = "direct"\nsource = "/tmp/im"\ndestination = "/b"\n' > /tmp/im.toml
strands-shell --config /tmp/im.toml -c 'mv /b/lf /b/moved; echo $?'
ls -l /tmp/im

Expected Behavior

As in bash: the link is renamed and the file is untouched.

-rw-rw-r-- f
lrwxrwxrwx moved -> f

Actual Behavior

mv exits 0, but it renamed the link's target and left the link dangling:

lrwxrwxrwx lf -> f
-rw-rw-r-- moved

Additional Context

VfsKernel::rename (src/vfs_kernel.rs:727-728) maps both paths with resolve_host, which canonicalizes and so follows a final symlink; std::fs::rename then runs on the target. Same class as #254. Unchanged by #377, which covers lstat, remove_file and remove_dir only. Found while reviewing #377.

A dangling link fails differently: mv /b/dangling x reports "cannot rename between host and virtual filesystem", because resolve_host returns None for it.

Possible Solution

Resolve the source with resolve_host_nofollow (as read_link does since #194) so std::fs::rename gets the link's own path; the destination needs the same treatment when it is an existing link.

Related Issues

#254, #377, #194

Activity

  1. added
    bug
    on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    Fields

    Language

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions