Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: paulvdh on March 18, 2018, 05:28:31 pm

Title: Minor bug when working with symbolic links.
Post by: paulvdh on March 18, 2018, 05:28:31 pm
I'm trying out CodeBlocks 16.01 on Linux (Debian testing/Buster) and I hit the first bug within half an hour.
When a link to a file is in a CodeBlocks project and the file is saved, the link is overwritten with a copy of the file.

How to uplicate:
1). Make a link:
asdf@dualcore:~/projects/avr/mumarnet/rollerblinds$ ln -fs ~/projects/avr/lib/timer0/timer0.cpp
asdf@dualcore:~/projects/avr/mumarnet/rollerblinds$ ls -hl timer*
lrwxrwxrwx 1 asdf asdf 45 Mar 18 17:08 timer0.cpp -> /home/asdf/projects/avr/lib/timer0/timer0.cpp
lrwxrwxrwx 1 asdf asdf 43 Mar 18 17:07 timer0.h -> /home/asdf/projects/avr/lib/timer0/timer0.h

2). Open codeblocks, edit timer0.cpp and  [CTRL + s] to save.
3). The link is now overwritten with a copy of the file:
asdf@dualcore:~/projects/avr/mumarnet/rollerblinds$ ls -hl timer*
-rwxr-xr-x 1 asdf asdf 6.5K Mar 18 17:11 timer0.cpp
lrwxrwxrwx 1 asdf asdf   43 Mar 18 17:07 timer0.h -> /home/asdf/projects/avr/lib/timer0/timer0


This also seems to be an very old bug. Apparently it was reported / diagnosed back in 2007.
http://forums.codeblocks.org/index.php/topic,5134.0.html (http://forums.codeblocks.org/index.php/topic,5134.0.html)
Title: Re: Minor bug when working with symbolic links.
Post by: oBFusCATed on March 18, 2018, 06:00:54 pm
This one is fixed in 17.12 as far as I know.
We detect symbolic links and disable the save-to-temp-and-move operation we use.
Probably we should add an option for to disable this safer way for saving files.