Bug 371453

Summary: Deleted entries in config file are not correctly removed on save
Product: [Frameworks and Libraries] frameworks-kconfig Reporter: Alex Bikadorov <alex.bikadorov>
Component: generalAssignee: Matthew Dawson <matthew>
Status: RESOLVED WORKSFORME    
Severity: major CC: alex.bikadorov, kdelibs-bugs-null
Priority: NOR    
Version First Reported In: 5.27.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Alex Bikadorov 2016-10-21 18:16:50 UTC
My application is called "main_EXE", the config file is saved at "~/.config/main_EXErc" and this is the content:
>>>
[Startup]
MenuBar=Enabled

<<<

The (complete) application code:
>>>
#include <QApplication>

#include <KConfigCore/KConfigGroup>
#include <KConfigCore/KSharedConfig>
#include <KXmlGui/KXmlGuiWindow>

class MainWindow : public KXmlGuiWindow {
  Q_OBJECT

public:
  MainWindow() : KXmlGuiWindow(0) {

    KSharedConfig::openConfig()->deleteGroup("Startup");
  }
};

int main(int argc, char *argv[]) {
  QApplication app(argc, argv);

  MainWindow *window = new MainWindow();
  window->show();

  return app.exec();
}

#include "main.moc"
<<<

After running the code, this is the new content of the config file:
>>>
[Startup]
MenuBar[$d]

<<<

* removing the entry directly ( deleteEntry("ActiveTab") ) does not work too
* a sync() call writes the incorrect config to the file
* it works correctly if the config path is specified with a custom path
* it works correctly if the group was not in the config file when the application started (create+delete works)

And most important: When I search for "[$d]" in ~/.config/* , there are 10 config files with these invalid entries (ksmserverrc, oktetarc, khotkeyrc, plasmashellrc, ...). This bug is slowly messing up the config files for all KDE applications and can trigger further bugs.


Reproducible: Always
Comment 1 Alex Bikadorov 2016-10-22 13:27:18 UTC
Git commit 5582ed5d1ab521e4c5d8d609e04836338a39e201 by Alexander Bikadorov.
Committed on 21/10/2016 at 18:47.
Pushed by abikadorov into branch 'master'.

Workaround for closed tabs not correctly removed from config file

M  +5    -5    krusader/panelmanager.cpp

http://commits.kde.org/krusader/5582ed5d1ab521e4c5d8d609e04836338a39e201
Comment 2 Justin Zobel 2022-10-26 03:07:23 UTC
Thank you for reporting this bug in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 3 Bug Janitor Service 2022-11-10 05:12:36 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Bug Janitor Service 2022-11-25 05:22:49 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!