Skip to content

Regression in v0.42.0: portable mode erroneously searches executable directory as a config dir via config_dirs (PR #18442) #18822

Open

Description

@escapezn

mpv Information

mpv v0.42.0 Copyright © 2000-2026 mpv/MPlayer/mplayer2 projects
 built on Nov 11 2026 15:53:43
libplacebo version: v7.391.0 (v7.387.0-57-gd9ab3a4-dirty)
FFmpeg version: N-128799-g67d2f0820
FFmpeg library versions:
   libavcodec      63.28.100
   libavdevice     63.6.100
   libavfilter     12.12.100
   libavformat     63.18.100
   libavutil       61.20.100
   libswresample   7.7.100
   libswscale      10.6.100

Other Information

- Windows version:
Windows 10

In portable mode (portable_config directory exists next to mpv.exe), mpv v0.42.0 unexpectedly searches the directory containing mpv.exe (~~exe_dir) as a fallback configuration directory.

As a result, mpv's automatic script loader (mp_find_all_config_files(..., "scripts")) attempts to load files from <exe_dir>/scripts/ in addition to <exe_dir>/portable_config/scripts/.

On Windows environments where embedded Python or other toolchains exist alongside mpv.exe (e.g. a Python Scripts/ directory containing pip.exe, etc.), mpv case-insensitively treats this folder as an mpv script directory, trying to execute every .exe/.py file and failing with dozens of errors:

[cplayer] Can't load unknown script: <exe_dir>/scripts/pip.exe
[cplayer] Can't load unknown script: <exe_dir>/scripts/...

This did not happen in v0.41.0.

Cause of the regression

The issue was introduced by commit 7e4cb53 (PR #18442: osdep/path-win: expand '~~exe_dir/' on portable mode).

In options/path.c, the array of configuration directory candidates includes "exe_dir":

static const char *const config_dirs[] = {
"home",
"old_home",
"osxbundle",
"exe_dir",
"global",
};

Prior to commit 7e4cb53, mp_get_platform_path_win(..., "exe_dir") returned NULL when portable_path != NULL.

Commit 7e4cb53 moved the resolution of "exe_dir" outside of the if (!portable_path) branch so that users could expand ~~exe_dir/ in portable mode. However, because "exe_dir" is also listed in config_dirs[], mp_find_all_config_files now treats ~~exe_dir as an active configuration directory even in portable mode:

[global] config path: 'scripts' -> '<exe_dir>/portable_config/scripts'
[global] config path: 'scripts' -> '<exe_dir>/scripts'

Reproduction Steps

  1. On Windows, place mpv.exe in a clean folder (e.g. C:\mpv\).
  2. Create a portable_config/ folder next to mpv.exe.
  3. Create a Scripts/ (or scripts/) folder next to mpv.exe containing arbitrary binaries/files (e.g. dummy.exe).
  4. Run mpv.exe --idle=once -v.

Expected Behavior

Only <exe_dir>/portable_config/ is used as the configuration root; <exe_dir>/scripts/ is ignored.

Actual Behavior

Both <exe_dir>/portable_config/scripts/ and <exe_dir>/scripts/ are scanned and loaded.

Log File

output.txt

Sample Files

No response

I carefully read all instruction and confirm that I did the following:

  • I tested and confirmed that the issue exists with the latest release version or newer.
  • I provided all required information including system and mpv version.
  • I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of --log-file=output.txt.
  • I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
  • I attached the full, untruncated log file.
  • I attached the backtrace in the case of a crash.

Activity

  1. added theissue type on Nov 12, 2026
  2. Keith94 commented on Nov 13, 2026

    @Keith94

    The issue was introduced by commit 7e4cb53

    I personally like this change. Before this, config files needed to be nested in portable_config, which new users may not expect.

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

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions