-
-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Labels
area: configConfiguration INI filesConfiguration INI filesprio: mediumHas the potential to affect progressHas the potential to affect progress
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Midnight Commander version and build configuration
GNU Midnight Commander 3e8800ead
Built with GLib 2.84.4 (using GLib 2.84.4)
Built with S-Lang 2.3.3 and terminfo database (using S-Lang 2.3.3)
Built with libssh2 1.11.1
With builtin editor
With subshell support as default
With support for background operations
With mouse support on xterm and Linux console
With support for X11 events
With internationalization support
With ext2fs attributes support
Virtual File Systems:
cpiofs, tarfs, sfs, extfs, ftpfs, sftpfs, shell
Data types:
char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64; uintmax_t: 64;Operating system
Linux 6.12.43+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.43-1 (2025-08-27) x86_64 GNU/LinuxIs this issue reproducible using the latest version of Midnight Commander?
- I confirm the issue is still reproducible with the latest version of Midnight Commander
How to reproduce
Run:
MC_DATADIR=DATA MC_PROFILE_ROOT=ROOT mc -F
Expected behavior
Home directory: homesweethome
Profile root directory: ROOT
[System data]
Config directory: DATA
Data directory: DATA
...etc...
Actual behavior
Home directory: homesweethome
Profile root directory: ROOT
[System data]
Config directory: DATA
Data directory: /usr/local/share/mc/
...etc...
But man mc says:
They are also affected by the MC_DATADIR environment variable. If it's set, its value is used instead of /usr/local/share/mc in the paths below
Reason: currently MC_DATADIR only overrides SYSCONFDIR; it should also override DATADIR.
Suggested fix (tested, works for me): modify OS_Setup() in src/main.c like this:
OS_Setup (void)
{
mc_shell_init ();
// The MC_DATADIR env variable allows overriding SYSCONFDIR and DATADIR
const char *datadir_env = g_getenv ("MC_DATADIR");
if (datadir_env != NULL)
{
mc_global.sysconfig_dir = g_strdup (datadir_env);
mc_global.share_data_dir = g_strdup (datadir_env);
}
else
{
mc_global.sysconfig_dir = g_strdup (SYSCONFDIR);
mc_global.share_data_dir = g_strdup (DATADIR);
}
}
I can submit a PR if you agree with the solution.
Additional context
No response
Metadata
Metadata
Assignees
Labels
area: configConfiguration INI filesConfiguration INI filesprio: mediumHas the potential to affect progressHas the potential to affect progress