crash.log written into repo root on Linux (breaks Syncthing casing sync)

Open Beginner friendly
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
desktop

Research direction

Start in plotruler/main.py at _crash_log_path() and inspect how the fallback behaves when LOCALAPPDATA and TEMP are unset on Linux. Choose and implement a platform-appropriate location that cannot create a capitalized PlotRuler directory in the repository, then verify that crash.log is written outside the working tree; consider the related .gitignore suggestion.

Written by the indexing model from the issue text.

Description

Summary

When run on Linux with LOCALAPPDATA/TEMP unset, _crash_log_path() falls back to ".", so the crash log is written to ./PlotRuler/crash.log inside the repository working tree.

Code

plotruler/__main__.py:

def _crash_log_path():
    base = os.environ.get("LOCALAPPDATA") or os.environ.get("TEMP") or "."
    return os.path.join(base, "PlotRuler", "crash.log")
  • Windows: LOCALAPPDATA is set → %LOCALAPPDATA%\PlotRuler\crash.log (fine).
  • Linux/macOS: neither var is set → logs to ./PlotRuler/crash.log.

Problem

The repo root already contains the lowercase package plotruler/. On case-insensitive filesystems (Windows/macOS) the two collide, and tools that sync the tree — e.g. Syncthing — report a casing conflict:

remote "Programming\GraphRuler\PlotRuler" uses different upper or lowercase characters than local "Programming\GraphRuler\plotruler"

so the items never sync until the stray PlotRuler/ dir is deleted manually.

Suggestion

Use a platform-appropriate XDG path on non-Windows, e.g.:

base = os.environ.get("LOCALAPPDATA") or os.environ.get("XDG_STATE_HOME", os.path.expanduser("~/.local/state"))

and/or log with the app name directly rather than a capital-cased dir that can shadow the lowercase package. Also consider ignoring the runtime dir in .gitignore as a belt-and-suspenders measure.

Dominant language
Python
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from endolith/plotruler

All issues in endolith/plotruler

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.