Skip to content

[BUG] lstat follows symlinks on direct binds, so test -L / [ -h ] return false #254

Done

Description

@strandly-the-agent

Checks

  • I have updated to the latest minor and patch version of Strands Shell (built from main d4c57a7)
  • 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 @ d4c57a7 (Cargo version 0.0.0)

Language Runtime Version

Rust 1.100.0

Operating System

Amazon Linux 2023 (aarch64)

Installation Method

built from source

Steps to Reproduce

mkdir -p /tmp/bx/d && cd /tmp/bx && ln -s d ld
printf '[[bind]]\nmode = "direct"\nsource = "/tmp/bx"\ndestination = "/tmp/bx"\n' > /tmp/bx.toml
strands-shell --config /tmp/bx.toml -c 'cd /tmp/bx; test -L ld; echo $?; [ -h ld ]; echo $?'

Expected Behavior

0 and 0, matching bash on the host (test -L ld → 0).

Actual Behavior

1 and 1. Inside the in-memory VFS the same script prints 0.

Additional Context

VfsKernel::lstat (src/vfs_kernel.rs:527-537) maps the path with resolve_host() and then calls host_stat() on the host path, which follows the link, so FileStat::is_symlink is never true on a direct bind. #194 fixed read_link the same way with resolve_host_nofollow but left lstat alone. Found while reviewing #220, where readlink -f/-e/-m relies on lstat().is_symlink and so doesn't follow any links under a bind.

Possible Solution

For host paths, use resolve_host_nofollow plus std::fs::symlink_metadata (and the wasm equivalent) in lstat, the same way read_link does since #194.

Related Issues

#194, #220

Activity

  1. added
    bug
    on Nov 12, 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

    No type

    Fields

    Language

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions