Skip to content

import file fails if there are any broken symlinks #603

Description

@edschofield

How to reproduce

Suppose we have two text files and a dangling symlink:

mkdir walktest && cd walktest
echo hello > a.txt
echo hello > z.txt
ln -s nonexistent b.txt

hister import file .

What I want here is for a.txt and z.txt to be imported and b.txt skipped.

Instead, Hister gives this error:

Error! walk input directory <dir>: stat <dir>/b.txt: no such file or directory

and nothing is imported (not even a.txt).

Version

I built Hister built from master (2114e9) with Go 1.27.0 on macOS 26.6.2.

Workaround

find ignores broken links, so this works:

find DIR -type f -print0 | xargs -0 hister import file

Suggested fix

I think the indexer already handles this: walkDirectoryFilesForUser() in
server/indexer/files.go:221-227 logs a warning and returns nil to keep
walking. The import walk could do the same if there's a walkErr or if os.Stat fails.

Would you like me to contribute a patch?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions