Skip to content

Issue: Sync fails with Permission denied when lock files (~$...) are present in source folder #111

Description

@Joni1717

Type: Bug

Description

Syncing a network path aborts when the folder contains Office lock files:

Syncing: /mapped/path/to/source → <kb-id>
  Failed: [Errno 13] Permission denied: '...\\source\\subfolder\\~$document.xlsx'

~$... files are created by Office while a workbook is open and are exclusively locked, so they can't be read.

Root cause

Even with an include filter set, oikb walks the entire tree and reads metadata (hash) for every file before applying the filter:

sources:
- name: source
  source: "/mapped/path/to/source"
  kb-id: <kb-id>
  filter:
    include: ["target.xlsx"]

So the scanner hits a locked ~$... file that would never be uploaded anyway, and the whole sync fails.

Expected behavior

  1. Skip temp/lock files before reading metadata — at minimum ~$*, ~*, *.tmp, hidden files (.*).
  2. Apply filter.include/exclude before opening files, so non-matching files are never read.
  3. Treat PermissionError as a soft skip (warning: skip <file> (permission denied)) and continue — on network shares, locked files (Excel, Outlook, AV, concurrent users) are normal and should not be a hard failure.

Actual behavior

PermissionError is raised unhandled → the entire sync fails, nothing gets uploaded.

Repro

  1. Network path containing an office file, for example .xlsx currently open in Excel (creates ~$...).
  2. Config pointing at that path, with filter.include targeting a different file.
  3. Run sync → error above.

Workaround

Close all open documents in the source folder (removes ~$...), then re-run.

Environment

  • OS: Windows 11
  • python 3.11 installed with Venv
  • oikb version: v0.4.0

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions