Skip to content

library_loader.py corrupts PATH on Unix/Linux by using semicolons instead of colons #118

@YusDyr

Description

@YusDyr

Bug Description

library_loader.py unconditionally uses semicolons (;) as PATH separator when appending directories to os.environ["PATH"] (lines 104-105 and 120-121):

os.environ["PATH"] += ";" + ";".join((os.getcwd(), _here))
if paths: os.environ["PATH"] += ";" + ";".join(paths)

This is the Windows PATH separator. On Unix/Linux/macOS, the PATH separator is a colon (:). This corrupts the PATH for the entire process and all child processes spawned afterward.

Impact

Any application that imports PyOgg on a non-Windows platform will have its PATH silently corrupted. Commands located in directories after the first semicolon become unreachable. In my case, this caused /bin/date, /bin/ln, /bin/stat to become unavailable in child shell processes, while /usr/bin/ffmpeg (appearing before the corruption point) still worked — a very confusing failure mode.

Environment

  • Python 3.14
  • Linux (Docker, Alpine-based)
  • PyOgg installed as a dependency of another package

Expected Behavior

The separator should be os.pathsep (which is : on Unix, ; on Windows), or the PATH modification should be guarded to only run on Windows where it's actually needed.

Suggested Fix

os.environ["PATH"] += os.pathsep + os.pathsep.join((os.getcwd(), _here))
if paths: os.environ["PATH"] += os.pathsep + os.pathsep.join(paths)

I'll submit a PR with this fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions