Author Topic: Upgrading CB 13.12 to 16.01 failed saving config files.  (Read 291 times)

Offline dmarques

  • Single posting newcomer
  • *
  • Posts: 2
Upgrading CB 13.12 to 16.01 failed saving config files.
« on: June 22, 2017, 09:58:59 pm »
After upgrading from CB 13.12 to 16.01, on Ubuntu 14.04, I have found a problem.

During the first CB 16 run, it says the config files (at "~/.codeblocks" on CB 13.12) must be moved to "~/.local/share/codeblock".

However, CB 16.01 never gets to save config files to that new dir.

At first, CB 16 wasn't saving anything so, checking the messages on a terminal, (while quitting) it said it could not save the config file (default.conf I guess).

The ownership of the new config dir ("~/.local/share/codeblock") was just fine, properly set to non root users.

So... Running CB 16 as root, it managed to properly save the config files, but... where?

Those files were actually saved to "~/.config/codeblocks"

After chowning "~/.config/codeblocks" to non-root users, everything is fine.

But, this is a sort of a bug, isn't it?

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10054
Re: Upgrading CB 13.12 to 16.01 failed saving config files.
« Reply #1 on: June 22, 2017, 11:58:12 pm »
If you can reproduce it multiple times then it is probably a bug.
We need exact steps to reproduce the problem.
We need the state of your ~/.codeblocks folder before upgrading and the state of ~/.config/codeblocks after the upgrade.

note: When running as root ~ is /root not /home/yourusername or something similar.
<debugger plugin maintainer>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline dmarques

  • Single posting newcomer
  • *
  • Posts: 2
Re: Upgrading CB 13.12 to 16.01 failed saving config files.
« Reply #2 on: June 23, 2017, 01:04:37 am »
Ok, here are the steps I took and what precisely happened.

1) I've downloaded downloaded CB 16 from Sourceforge, at:

https://sourceforge.net/projects/codeblocks/files/Binaries/16.01/Linux/Ubuntu%20Trusty/

as it was intended to be installed on a Ubuntu 14.04 (64 bit).

2) I've removed all the packages from CB 13.12 that were previously installed and installed all the 16.01 .deb packages that came in the zipped file:

  1827912 Jan 29  2016 codeblocks_16.01_amd64.deb
  3321832 Jan 29  2016 codeblocks-common_16.01_all.deb
  2748132 Jan 29  2016 codeblocks-contrib_16.01_amd64.deb
   620626 Jan 29  2016 codeblocks-contrib-common_16.01_all.deb
 32935998 Jan 29  2016 codeblocks-contrib-dbg_16.01_amd64.deb
 27567312 Jan 29  2016 codeblocks-dbg_16.01_amd64.deb
   408184 Jan 29  2016 codeblocks-dev_16.01_amd64.deb
   721512 Jan 29  2016 codeblocks-headers_16.01_all.deb
   702690 Jan 29  2016 codeblocks-libwxcontrib0_16.01_amd64.deb
   408890 Jan 29  2016 codeblocks-wxcontrib-dev_16.01_amd64.deb
   459098 Jan 29  2016 codeblocks-wxcontrib-headers_16.01_all.deb
  2303746 Jan 29  2016 libcodeblocks0_16.01_amd64.deb
  1096972 Jan 29  2016 libwxsmithlib0_16.01_amd64.deb
   407462 Jan 29  2016 libwxsmithlib0-dev_16.01_amd64.deb
   408160 Jan 29  2016 wxsmith-dev_16.01_amd64.deb
   470924 Jan 29  2016 wxsmith-headers_16.01_all.deb

I had to "dpkg -i --force-all *.deb" as some modules have cross dependencies.

3) Running CB 16 for the first time:

Before the splash screen came up it popped up a dialog saying the config files at "~/.codeblocks" (on CB 13.12) had to be moved to "~/.local/share/codeblock" for better compatibility (I can remember the exact text displayed, sorry). Then everything seemed normal, it asked for a default compiler (as expected) and so on.

Later I noticed that it hadn't saved the default compiler (gcc) because it kept asking for it again and again, every time I started CB.

Just to make sure it wasn't saving anything, I created a mock-up project and noticed (later, on another run) it wasn't showing on the latest projects list.

4) The previous "~/.codeblocks" dir listing was: (owned by my_user:my_user - not root)

   128 Out 30  2015 BrowseTracker.ini
 35553 Jun 21 23:33 cbKeyBinder10.ini
 36004 Out 30  2015 cbKeyBinder10.ini.bak
   198 Jun 21 23:35 codesnippets.ini
 55935 Jun 21 23:35 default.conf
   214 Abr  4 04:00 default.workspace
   253 Jun 21 20:45 default.workspace.layout
   231 Jun 21 23:35 DragScroll.ini
     0 Jun 21 23:35 en_US_personaldictionary.dic
  4096 Dez 13  2014 share

The new "~/.local/share/codeblocks/" dir listing was: (also owned by my_user:my_user)

 4096 Mai 29  2016 plugins
 4096 Mai 29  2016 scripts

Where "plugins" and "scripts" are both empty.

5) Running "codeblocks" from a terminal:

There was a warning message saying it couldn't save the config file (probably default.conf) so I had to "sudo codeblocks", and then it saved config files (after running CB for a second time, no more asking about the default compiler).

After searching for "default.conf" on various locations I've found it at: "~/.config/codeblocks/" (yes, not "/root/.config/codeblocks" but "/home/my_user/.config/codeblocks"), whose dir listing is:

 37549 Jun 22 05:28 cbKeyBinder10.ini
   198 Jun 22 05:28 codesnippets.ini
 38679 Jun 22 05:28 default.conf
   231 Jun 22 05:28 DragScroll.ini
     0 Jun 22 05:28 en_US_personaldictionary.dic

Note: my_user:my_user owns both "~/.config" and "~/.config/codeblocks", but the files above were initially owned by root:root as they were written by CB 16 when I first sudoed it.

6) To make it work properly, I've changed the ownership of those files to my_user:my_user. Now all is normal.

The new config (base) dir "~/.local/share/codeblock" remains unused, as well as "plugins" and "scripts" in it.

I haven't tried to reproduce this a number of times but it seems, at least, unexpected.

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10054
Re: Upgrading CB 13.12 to 16.01 failed saving config files.
« Reply #3 on: June 23, 2017, 01:14:25 am »
If we can't reproduce a problem then we most probably can't fix it.
And also most of the times such problems are caused by user errors.

The upgrade process doesn't need to run as root. I'm surprised that it did the correct thing to copy the files in /home/bla/.config and not /root/.config/.
If you have the original ~/.codeblocks folder you could try to remove the ~/.config/codeblocks and see if the upgrade code runs fine with your normal user.

p.s. I don't know what you're using to list files, but the listings in the previous post miss the most important information - user/group and permissions. Also please next time use code tags to organise your post better (the list # button).
p.p.s. I guess this is one more reason to never setup a system to support sudo. It is too easy to run commands as root...
<debugger plugin maintainer>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7177
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Upgrading CB 13.12 to 16.01 failed saving config files.
« Reply #4 on: June 23, 2017, 05:26:18 pm »
$HOME/.config/codeblocks is the folder where the config-files shoulf go.
$HOME/.local/share/codeblocks is the folder for user-scripts, -plugins etc.

Something like this is written in the popup-dialog.
So default.conf below .config is expected and correct.

The dialog that pops ups on start and ask for the default-compiler is most likely unrelated to the config-folder change.
If I remember correctly it can also pop up if a compiler search path is invalid in 16.01 or something similar.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 5835
    • My Best Post
Re: Upgrading CB 13.12 to 16.01 failed saving config files.
« Reply #5 on: June 23, 2017, 06:19:12 pm »
IIRC, an user said they had to run codeblocks from the command line (This was NOT running as root) to get CB to do a good save of CB configs before the unity short-cut would work.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org