Skip to content

[BUG] find . / ls -l in a symlinked directory see the link, not its contents (. and trailing / don't follow) #387

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

No bind needed; this is the in-memory filesystem.

strands-shell -c 'mkdir -p /tmp/d; echo k > /tmp/d/keep; ln -s d /tmp/ld
cd /tmp/ld; find . -name keep; echo "find: $?"; ls -l
ls -l /tmp/ld/; find /tmp/ld/ -name keep; test -L /tmp/ld/; echo "test -L: $?"'

Expected Behavior

As in bash, . inside a symlinked directory and link/ both name the directory, not the link:

./keep
find: 0
-rw-rw-r-- ... keep
-rw-rw-r-- ... keep
/tmp/ld/keep
test -L: 1

Actual Behavior

find: 0
lrwxrwxrwx        1 Nov 21 07:34 . -> d
lrwxrwxrwx        1 Nov 21 07:34 /tmp/ld/ -> d
test -L: 0

find . -name keep and find /tmp/ld/ -name keep print nothing and exit 0, so a search run from inside a symlinked directory silently finds no files. Plain ls (without -l) lists keep correctly.

Additional Context

vfs::absolute normalizes the path before VfsKernel::lstat (src/vfs_kernel.rs:536) resolves it, which drops the trailing / and the final .. lstat then resolves /tmp/ld without following and reports the link. POSIX path resolution follows a symlink when the name ends in / or the last component is ..

Found while reviewing #377: direct binds did not have this behaviour on main (their lstat followed everything), and get it once lstat stops following there.

Possible Solution

In VfsKernel::lstat, follow the last component when the caller's path ends in / or its last component is . or .., for both the in-memory and the host branch.

Related Issues

#377, #254

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