Repository navigation
Fix clipboard settings being overwritten with empty values on exit - #5146
Merged
mc-worker merged 1 commit intoAug 30, 2026
Merged
Conversation
…en with empty values on exit. When multiple mc instances are running, clipboard_store and clipboard_paste settings in the ini file get reset to empty strings. Steps to reproduce: 1. Set clipboard_store and clipboard_paste in ~/.config/mc/ini 2. Open multiple mc instances in different terminals 3. Close one mc instance — it saves the config with the correct values 4. Close another mc instance that was started before the config was edited — it reads the OLD ini (before edits were made), loads empty strings for clipboard_store/clipboard_paste, and overwrites the config, erasing the user's settings The root cause is that save_setup() unconditionally writes clipboard_store_path and clipboard_paste_path to the ini file, even when they are empty strings (which is the default when no clipboard utility is configured through mc's UI). This means any mc instance that started before the user edited the ini will overwrite the settings with empty values when it exits. Fix: only write clipboard_store and clipboard_paste to the ini when the values are non-empty, preserving user-configured values. Signed-off-by: ChelpanovIlya <ChelpanovIlya@users.noreply.github.com>
aborodin
force-pushed
the
pr/fix-clipboard-overwrite
branch
from
August 30, 2026 13:56
63aa981 to
9942dbe
Compare
Contributor
|
huh? i would have expected this to be an obvious reject: it's just the way mc's config works. adding exceptions for particular options is confusing, and just bad practice. a proper generic solution would do a 3-way merge. that would require saving the originally read values (or at least tagging modified ones), and re-reading the file prior to writing it (at least if its timestamp changed). that's what proper frameworks like kde's kconfig do. glib has gsettings, but that's in gio, so i suppose mc isn't going to use it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
When multiple mc instances are running, clipboard_store and clipboard_paste settings in the ini file get reset to empty strings.
Steps to reproduce:
The root cause is that save_setup() unconditionally writes clipboard_store_path and clipboard_paste_path to the ini file, even when they are empty strings (which is the default when no clipboard utility is configured through mc's UI). This means any mc instance that started before the user edited the ini will overwrite the settings with empty values when it exits.
Fix: only write clipboard_store and clipboard_paste to the ini when the values are non-empty, preserving user-configured values.
Checklist
git commit --amend -smake indent && make check)