From 11ec057f380a49aa70ffc5b848e886e945ebf8a9 Mon Sep 17 00:00:00 2001 From: Alister Lewis-Bowen Date: Mon, 13 Apr 2026 12:47:26 -0400 Subject: [PATCH] Fix search.py: BSD grep requires trailing slash to recurse into symlinked directories macOS BSD grep does not recurse into a symlinked directory unless the path ends with a trailing slash. Add "/" to both grep calls so search returns results for collections whose indexed/ dir is a symlink. Co-Authored-By: Claude Sonnet 4.6 --- search.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/search.py b/search.py index cba7f3a..edf4e8a 100755 --- a/search.py +++ b/search.py @@ -37,7 +37,7 @@ def search_indexed(term: str, indexed_dir: Path, context: int) -> list[dict]: @param context: Lines of context around each match @return: List of dicts with keys: slug, line_num, content """ - cmd = ["grep", "-rin", f"--include=content.md", f"-C{context}", term, str(indexed_dir)] + cmd = ["grep", "-rin", f"--include=content.md", f"-C{context}", term, str(indexed_dir) + "/"] result = subprocess.run(cmd, capture_output=True, text=True) if result.returncode not in (0, 1): print(f" WARNING: grep error in {indexed_dir}: {result.stderr.strip()}", file=sys.stderr) @@ -73,7 +73,7 @@ def files_matching(term: str, indexed_dir: Path) -> list[str]: @param indexed_dir: Path to the collection's indexed directory @return: Sorted list of unique publication slugs """ - cmd = ["grep", "-ril", f"--include=content.md", term, str(indexed_dir)] + cmd = ["grep", "-ril", f"--include=content.md", term, str(indexed_dir) + "/"] result = subprocess.run(cmd, capture_output=True, text=True) slugs: set[str] = set() for path_str in result.stdout.splitlines():