Author Topic: Unable to read source file  (Read 16356 times)

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Unable to read source file
« on: July 20, 2018, 10:52:15 am »
Hello there,

I just installed Code::Blocks on OpenSuse Leap 42.3 for Windows Subsystem (Windows 10 installed -> OpenSuse Sub).
I'm using wxWidgets version 3.0.4 nostl.
When I try to open an existing project I get the following error in the terminal:

Quote
NativeParser::DoFullParsing(): AddProjectDefinedMacros failed!
NativeParser::DoFullParsing(): Adding cpp/c files to batch-parser
NativeParser::DoFullParsing(): Added 1 source file(s) for project 'test' to batch-parser...
NativeParser::CreateParser(): Finish creating a new parser for project 'test'
NativeParser::OnParserStart(): Starting batch parsing for project 'test'...
NativeParser::OnParserEnd(): Project 'test' parsing stage done!
Project 'test' parsing stage done (2 total parsed files, 245 tokens in 0 minute(s), 0.003 seconds).
SystemHeadersThread: /usr/include/c++/4.8/ , 4326
SystemHeadersThread: /usr/include/c++/4.8/x86_64-suse-linux/ , 23
SystemHeadersThread: /usr/include/c++/4.8/backward/ , 8
SystemHeadersThread: /usr/lib64/gcc/x86_64-suse-linux/4.8/include/ , 56
SystemHeadersThread: /usr/local/include/ , 162
SystemHeadersThread: /usr/lib64/gcc/x86_64-suse-linux/4.8/include-fixed/ , 3
SystemHeadersThread: /usr/x86_64-suse-linux/include/ , 0
SystemHeadersThread: /usr/include/ , 16359
SystemHeadersThread: Total number of paths: 8
Final encoding detected: Unicode 8 bit (UTF-8) (ID: 43)
Encoding conversion has failed (buffer is empty)!
Something seriously went wrong while converting file content to wxString!

The Project is called "test" and has one source file: main.c. In Code::Blocks main.c only shows an empty file.
I can write and save but closing and opening a file makes the content disappear.
I used cat /path/to/project/main.c, and it displays everything I have written so far.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #1 on: July 20, 2018, 12:32:51 pm »
What language do you use? What encoding is the file? Does it also happen if you save it as utf-8 file?

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #2 on: July 20, 2018, 12:37:29 pm »
file: main.c: text/plain; charset=us-ascii
Language: C/C++
I can save anything i write, but trying to re-open or read a file causes the above error and only shows an empty file

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Unable to read source file
« Reply #3 on: July 20, 2018, 07:46:26 pm »
What version of codeblocks are you using? Do you see the assert dialog?
(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 BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #4 on: July 20, 2018, 09:48:26 pm »
Quote
Language: C/C++
By language i mean your system language and encoding...
Settings in Settings->Editor->Encoding settings?

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #5 on: July 21, 2018, 08:53:59 am »
@oBFusCATed Is this what you meant? (Sry, I'm new to this)
Quote
Starting Code::Blocks Release 17.12  rev 11256 Jul 19 2018, 16:03:43 - wx3.0.4 (Linux, unicode) - 64 bit
Initialize EditColourSet .....
Initialize EditColourSet: done.
Loading menubar...
AStylePlugin: loaded
Abbreviations: loaded
Autosave: loaded
ClassWizard: loaded
CodeCompletion: loaded
Compiler: loaded
Debugger: loaded
FilesExtensionHandler: loaded
OccurrencesHighlighting: loaded
OpenFilesList: loaded
ProjectsImporter: loaded
ScriptedWizard: loaded
ToDoList: loaded
Source code formatter (AStyle) plugin activated
Abbreviations plugin activated
Autosave plugin activated
Class wizard plugin activated
Code completion plugin activated
Added compiler "GNU GCC Compiler"
Added compiler "Intel C/C++ Compiler"
Added compiler "GDC D Compiler"
Added compiler "GNU Fortran Compiler"
Added compiler "G95 Fortran Compiler"
Added compiler "GNU GCC Compiler for ARM"
Added compiler "GNU GCC Compiler for Android"
Added compiler "GNU GCC Compiler for AVR"
Added compiler "GNU GCC Compiler for Blackfin"
Added compiler "LLVM Clang Compiler"
Added compiler "Digital Mars D Compiler"
Added compiler "LLVM D Compiler"
Added compiler "GNU GCC Compiler for LM32"
Added compiler "GNU GCC Compiler for LM8"
Added compiler "GNU GCC Compiler for MSP430 (HighTec)"
Added compiler "*No Compiler*"
Added compiler "PGI Fortran Compiler"
Added compiler "GNU GCC Compiler for PowerPC EABI"
Added compiler "GNU GCC Compiler for PowerPC (HighTec)"
Added compiler "Small Device C Compiler"
Added compiler "Tiny C Compiler"
Added compiler "GNU GCC Compiler for TriCore (HighTec)"
Added compiler "GNU GCC Compiler for ZPU"
Compiler plugin activated
Debugger plugin activated
Files extension handler plugin activated
OccurrencesHighlighting plugin activated
Open files list plugin activated
Foreign projects importer plugin activated
Project wizard added for 'Empty project'
Project wizard added for 'Fortran application'
Project wizard added for 'Fortran library'
Project wizard added for 'Fortran DLL'
Project wizard added for 'Console application'
Project wizard added for 'D application'
Project wizard added for 'FLTK project'
Project wizard added for 'GLFW project'
Project wizard added for 'GLUT project'
Project wizard added for 'GTK+ project'
Project wizard added for 'Irrlicht project'
Project wizard added for 'Java application'
Project wizard added for 'Lightfeather project'
Project wizard added for 'Matlab project'
Project wizard added for 'OpenCV project'
Project wizard added for 'OpenGL project'
Project wizard added for 'Ogre project'
Project wizard added for 'Code::Blocks plugin'
Project wizard added for 'QT4 project'
Project wizard added for 'QT4 (shared) project'
Project wizard added for 'QT5 project'
Project wizard added for 'SDL project'
Project wizard added for 'SDL2 project'
Project wizard added for 'SFML project'
Project wizard added for 'Static library'
Project wizard added for 'Shared library'
Project wizard added for 'wxWidgets project'
Build-target wizard added for 'Console'
Build-target wizard added for 'Static library'
Build-target wizard added for 'wxWidgets'
Project wizard added for 'Arduino Project'
Project wizard added for 'ARM Project'
Project wizard added for 'AVR Project'
Project wizard added for 'MSP430 Project'
Project wizard added for 'TriCore Project'
Project wizard added for 'PowerPC Project'
Project wizard added for 'MCS51 Project'
File(s) wizard added for 'Empty file'
File(s) wizard added for 'C/C++ source'
File(s) wizard added for 'D source'
File(s) wizard added for 'C/C++ header'
File(s) wizard added for 'Fortran source'
File(s) wizard added for 'Java source'
Scripted wizard plugin activated
Todo List plugin activated
Loading toolbar...
Initializing plugins...

Version: 17.12
Encoding when opening files: UTF-8
Encoding: as fallback encoding
Checked: If conversion fails using the settings above, try system locale settings

Language: (i hope this is what you want, as I wrote at the top, I'm new to this) OpenSuse - English, Windows - German
and encoding is UTF-8



Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Unable to read source file
« Reply #6 on: July 21, 2018, 11:42:21 am »
Can you share a file that can not be opened ?

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #7 on: July 21, 2018, 01:27:16 pm »
this is a simple hello world. The project can be opened, but when i open main.c the file appears empty.

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #8 on: July 23, 2018, 08:23:01 am »
After writing:
Quote
chmod 777 test/
I tried again with codeblocks but same result.

The requested output:
Quote
total 4
drwxrwxrwx 1 luiziffer users  512 Jul 20 09:33 bin
-rwxrwxrwx 1 luiziffer users  101 Jul 21 13:22 main.c
drwxrwxrwx 1 luiziffer users  512 Jul 20 09:33 obj
-rwxrwxrwx 1 luiziffer users 1066 Jul 18 18:49 test.cbp
-rwxrwxrwx 1 luiziffer users  354 Jul 21 13:23 test.layout


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #9 on: July 23, 2018, 10:02:31 am »
does i  happen with any text file or only with files you created with codeblocks?
what if you use some other encoding then utf8?
does the same problem arises with the windows exe of codeblocks on the same system, same file?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #10 on: July 23, 2018, 10:05:00 am »
are the layout and project settings saved and restored correctly?
what if you rename the c file to txt file?
do you use some color scheme?
are you sure the file is displayed as empty, or is the text simply white on white? does the cursor move?

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #11 on: July 23, 2018, 10:36:30 am »
Quote
does i  happen with any text file or only with files you created with codeblocks?
   Any, regardless of how the file was created.
Quote
what if you use some other encoding then utf8?
   I tried Windows-1252 and default, no changes.
Quote
does the same problem arises with the windows exe of codeblocks on the same system, same file?
   No, the windows version can open any file without issue.
Quote
are the layout and project settings saved and restored correctly?
   I'm sorry, I don't know how to determine that.
Quote
what if you rename the c file to txt file?
   No changes.
Quote
do you use some color scheme?
   No, everything is set to default. (Didn't change anything yet)
Quote
are you sure the file is displayed as empty, or is the text simply white on white? does the cursor move?
   The file is empty -> pics: OpenSuse, Windows 10 (win10)


Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Unable to read source file
« Reply #12 on: July 23, 2018, 10:37:53 am »
Could the problem be the BOM at the start of the UTF8 file?

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

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #13 on: July 23, 2018, 10:45:38 am »
troubleshooting.txt contains the text "testing"

I tried:
Quote
vi troubleshooting.txt
:set nobomb
:wq

and,
Quote
sed -i $'1s/^\uFEFF//' troubleshooting.txt

without success


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #14 on: July 23, 2018, 01:23:37 pm »
Quote
   I'm sorry, I don't know how to determine that.
Edit the Project->Build options
close the project reopen it and look if the changes are there...


i am out of ideas.... The file encoding seems to be working, but the file reading is the problem... But it can read the XML documents, because otherwise you would not be able to open the project so file access is not the problem...
I have looked into the code and you fail in the
Code
bool EncodingDetector::DetectEncoding(const wxByte* buffer, size_t size, bool convert_to_wxstring)
function...
I am not quite sure what path the code goes...
Code
 if (cfgMgr->ReadInt(_T("/default_encoding/use_option"), 0) == 1)
is false, because you are not getting
Quote
Warning: bypassing C::B's auto-detection!
so you go the mozilla detection route. There the first entry is
Code
if (!buffer)
            return false;
so if buffer is a 0 pointer you will never continue, so the pointer is valid...

But later it fails in
Code
bool EncodingDetector::ConvertToWxString(const wxByte* buffer, size_t size)
with
Code
if (!buffer || size == 0)
so there is really something wrong here... More error logging would help. But in the end only debugging can solve this...

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #15 on: July 23, 2018, 01:29:58 pm »
After looking future in the code i found this in
sdk\encodingdetector.cpp:137
Code
 
bool EncodingDetector::DetectEncoding(const wxString& filename, bool convert_to_wxstring)
{
[....]
   size_t readBytes = file.Read((void*)buffer, size);
    bool result = false;
    if (readBytes > 0)
        result = DetectEncoding(buffer, size, convert_to_wxstring);
Shouldn't this be
Code
 
   size_t readBytes = file.Read((void*)buffer, size);
    bool result = false;
    if (readBytes > 0)
        result = DetectEncoding(buffer, readBytes , convert_to_wxstring);
?

Anyway this does not explain why later the size is 0....
« Last Edit: July 23, 2018, 01:33:07 pm by BlueHazzard »

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #16 on: July 23, 2018, 02:14:55 pm »
@BlueHazzard I did as described, the changes persist.

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #17 on: July 23, 2018, 03:48:43 pm »
As requested, screenshots are attached to this post.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Unable to read source file
« Reply #18 on: July 23, 2018, 07:38:21 pm »
Ask bluehazzard mentioned the reason for the problem could be found only by making a debug and using a debugger.
My guess is that it is a combination of a cb and wx issue.
So you need to build both with debug information and do the stepping. :(
(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 LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #19 on: July 24, 2018, 08:31:46 am »
@omlk Here you go (it didn't change anything)
@oBFusCATed so what can/should I do now?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #20 on: July 24, 2018, 12:14:05 pm »
Quote
@oBFusCATed so what can/should I do now?
If you ask this question then there is a lot work ahead of you. We can not do anything because we do not have the problem, and also i have not the possibility to use windows with the linux subsystem... If you are motivated enough i will try to guide you trough the steps. Be aware this is A LOT WORK/Time, but you will also learn a lot!

Quote
I just installed Code::Blocks on OpenSuse Leap 42.3 for Windows Subsystem (Windows 10 installed -> OpenSuse Sub).
I'm using wxWidgets version 3.0.4 nostl.
First i would like to know how you installed all this... Compiled by yourself? Installed from repo?

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #21 on: July 25, 2018, 04:42:17 pm »
Thank you all for helping, I managed to fix the issue. I removed everything and reinstalled wxWidgets this time with the version 2.8.12 and codeblocks from the subversion repo. And somehow it works now.
Thank you @BlueHazzard for being willing to invest so much time, sadly i don't have enough myself. (If you still want to know, I installed 3.0.4 via Opensuse download website, added the rpm, then zypper and yast; I got codeblocks from a tar file, installed it via /bootstrap, /configure, etc..
And I will probably sometime in the future work on my knowledge regarding linux).
@omlk it wasn't solved, it had the same issue.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #22 on: July 25, 2018, 05:53:50 pm »
Quote
Thank you all for helping, I managed to fix the issue. I removed everything and reinstalled wxWidgets this time with the version 2.8.12 and codeblocks from the subversion repo. And somehow it works now.
Thank you @BlueHazzard for being willing to invest so much time, sadly i don't have enough myself. (If you still want to know, I installed 3.0.4 via Opensuse download website, added the rpm, then zypper and yast; I got codeblocks from a tar file, installed it via /bootstrap, /configure, etc..
Now it would be easy to help us ;)

1) Open the CodeBlocks_wx30-unix.cbp file
2) It probably will ask you about the global variable "cb_release_type" enter
Code
-g
in the base field...
3) If it did not ask about the "cb_release_type" global variable, then Settings->global variables..->Current variable->New->Name: cb_release_type->ok
3.1) proceed with step 2
4) Build->Rebuild. This will need some time...
5) Hit Alt+G and type "encodingdetector" and double click or enter the encodingdetector.cpp file
6) Git Ctrl+g and type "149" to go to line 149
7) Set a breakpoint to this line by klicking between the line number and line text until a red circle appears, or hit F5
8) Start the debugger with Debug->Start
9) A new Codeblocks (we will call it debugee from now on) will open. Open your faulty file in the debugee.
10) The codeblocks window from where you are debugging will pop up, or blink or whatever... It will display the line 149 with a yellow arrow
11) Open the watches with Debugg->Debugging windows->Watches
12) Now go back to the code and make a right click on "buffer"->Add watch
13) Now go back to the code and make a right click on "size"->Add watch
14) Now this two values will appear in the watches dialog. Please tell us the values
15) Now step trought the program and tell us what functions are called:
15.1) To step one line hit the F7 key. The yellow arrow will make a step. Please note us the path the yellow arrow makes until the end of this function....
16) If the yellow arrow is at line 247 you can abort the debugee by hiting the red button in the toolbars

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #23 on: July 27, 2018, 07:27:41 pm »
i'm encountering the following error when trying to rebuild:
Quote
-------------- Build: scintilla in Code::Blocks wx3.0.x - Unix (compiler: GNU GCC Compiler)---------------
Scanned 0 files for #includes, cache used 0, cache updated 0
g++ -Wall -g -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -DcbDEBUG -DCB_PRECOMP -std=c++11 -D__WX__ -DGTK -DLINK_LEXERS -DSCI_LEXER -DWXMAKINGDLL_SCI -iquote.objs30/include -I.objs30/include -I. -Isdk/wxscintilla/include -Iinclude/tinyxml -Isdk/wxscintilla/src/scintilla/include -Isdk/wxscintilla/src/scintilla/src -Isdk/wxscintilla/src/scintilla/lexlib -c /home/luiziffer/trunk/src/sdk/wxscintilla/src/PlatWX.cpp -o .objs30/sdk/wxscintilla/src/PlatWX.o
g++ -Wall -g -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -DcbDEBUG -DCB_PRECOMP -std=c++11 -D__WX__ -DGTK -DLINK_LEXERS -DSCI_LEXER -DWXMAKINGDLL_SCI -iquote.objs30/include -I.objs30/include -I. -Isdk/wxscintilla/include -Iinclude/tinyxml -Isdk/wxscintilla/src/scintilla/include -Isdk/wxscintilla/src/scintilla/src -Isdk/wxscintilla/src/scintilla/lexlib -c /home/luiziffer/trunk/src/sdk/wxscintilla/src/scintilla/lexers/LexA68k.cxx -o .objs30/sdk/wxscintilla/src/scintilla/lexers/LexA68k.o
g++ -Wall -g -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -DcbDEBUG -DCB_PRECOMP -std=c++11 -D__WX__ -DGTK -DLINK_LEXERS -DSCI_LEXER -DWXMAKINGDLL_SCI -iquote.objs30/include -I.objs30/include -I. -Isdk/wxscintilla/include -Iinclude/tinyxml -Isdk/wxscintilla/src/scintilla/include -Isdk/wxscintilla/src/scintilla/src -Isdk/wxscintilla/src/scintilla/lexlib -c /home/luiziffer/trunk/src/sdk/wxscintilla/src/scintilla/lexers/LexAbaqus.cxx -o .objs30/sdk/wxscintilla/src/scintilla/lexers/LexAbaqus.o
g++ -Wall -g -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -DcbDEBUG -DCB_PRECOMP -std=c++11 -D__WX__ -DGTK -DLINK_LEXERS -DSCI_LEXER -DWXMAKINGDLL_SCI -iquote.objs30/include -I.objs30/include -I. -Isdk/wxscintilla/include -Iinclude/tinyxml -Isdk/wxscintilla/src/scintilla/include -Isdk/wxscintilla/src/scintilla/src -Isdk/wxscintilla/src/scintilla/lexlib -c /home/luiziffer/trunk/src/sdk/wxscintilla/src/scintilla/lexers/LexAda.cxx -o .objs30/sdk/wxscintilla/src/scintilla/lexers/LexAda.o
/home/luiziffer/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:8:23: fatal error: wx/wxprec.h: No such file or directory
 #include "wx/wxprec.h"
                       ^
compilation terminated.

further infromation:
wx-config --version
returns: 2.8.12

wx-config --list
returns: Default config is gtk2-unicode-release-2.8

  Default config will be used for output

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Unable to read source file
« Reply #24 on: July 27, 2018, 10:29:16 pm »
Why are you building with 3.0 instead of 2.8 that worked for you?

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

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #25 on: July 28, 2018, 12:29:58 am »
Quote
Why are you building with 3.0 instead of 2.8 that worked for you?
probably to help us xD fix the bug

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Unable to read source file
« Reply #26 on: July 28, 2018, 09:48:31 am »
Quote
Why are you building with 3.0 instead of 2.8 that worked for you?
probably to help us xD fix the bug

In that case, they need to have wxWidgets 3.0 installed on the PC.

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

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #27 on: July 31, 2018, 06:20:23 pm »
Quote
10) The codeblocks window from where you are debugging will pop up, or blink or whatever... It will display the line 149 with a yellow arrow
Sorry, but this doesn't happen. As in, it successfully builds and that's it. What do you mean with faulty file? (I assume you meant the project and clicked on test.cbp)
Also, I completely removed the former codeblocks to install the repo version, I still have the .tar.gz file though.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #28 on: July 31, 2018, 08:26:13 pm »
Quote
(I assume you meant the project and clicked on test.cbp)
and open the c (or cpp) file you have problems with...

Quote
As in, it successfully builds and that's it.
Does the debugee starts?

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #29 on: August 01, 2018, 04:51:11 pm »
Quote
Does the debugee starts?
No, it doesn't. The window opened, i selected test.cbp, and it closed, that's it.
I'm using the WLS so I'm using Xming on windows. (Don't know if this is relevant)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #30 on: August 01, 2018, 05:21:53 pm »
what does the debugger log tell you? Pleas enable full debugger logging and post it here (Settings->Debigger->select default, ot gdb on the right side->Full logging

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #31 on: August 01, 2018, 06:33:57 pm »
Quote
Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
src
Adding source dir: /home/luiziffer/trunk/src/
Adding source dir: /home/luiziffer/trunk/src/
Adding file: /home/luiziffer/trunk/src/devel30/codeblocks
Changing directory to: /home/luiziffer/trunk/src/devel30
Set variable: LD_LIBRARY_PATH=.:/home/luiziffer/trunk/src/base/tinyxml:/home/luiziffer/trunk/src/devel30:/usr/lib64:

[debug]Command-line: /usr/bin/gcc -nx -fullname -quiet  -args /home/luiziffer/trunk/src/devel30/codeblocks
[debug]Working dir : /home/luiziffer/trunk/src/devel30

Starting debugger: /usr/bin/gcc -nx -fullname -quiet  -args /home/luiziffer/trunk/src/devel30/codeblocks
Setting SHELL to '/bin/sh'
done

[debug]gcc: error: unrecognized command line option -quiet
[debug]gcc: error: unrecognized command line option -nx
[debug]gcc: error: unrecognized command line option -fullname
[debug]gcc: error: unrecognized command line option -args

Debugger finished with status 1

I found the setting Full (Debug) Log in Common

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Unable to read source file
« Reply #32 on: August 01, 2018, 07:20:35 pm »
Your debugger settings are wrong.
You've set gcc as debugger instead of the correct gdb.
(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 BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #33 on: August 02, 2018, 09:21:51 am »
Quote
Your debugger settings are wrong.
You've set gcc as debugger instead of the correct gdb.
You can fix this in Settings->Debugger->Default on the left side->Executable path-> point it to gdb

tianrenli92

  • Guest
Re: Unable to read source file
« Reply #34 on: October 27, 2018, 04:30:07 am »
I figured out the reason.
I created two files. test has 616 bytes, which cannot be opened in c::b in Ubuntu (Windows subsystem), with the error described in the original post, and test2 has 617 bytes, which can be opened:
https://imgur.com/a/3eZv6kG
Notice the size on disk, test is 0 byte, while test2 is 4KB.
This happens if the file is so small that its contents and the filesystem bookkeeping fit in 1KB. To save disk space, NTFS keeps small files "resident", storing their contents right in the file record, so no cluster has to be allocated for it.
reference: https://superuser.com/questions/1030800/how-can-a-files-size-on-disk-be-0-bytes-when-theres-data-in-it

TL;DR: If the file is too small (<617B), it may not be found by c::b.

Anyone know how to report the bug?
« Last Edit: October 27, 2018, 04:36:51 am by tianrenli92 »

Offline ked

  • Single posting newcomer
  • *
  • Posts: 6
Re: Unable to read source file
« Reply #35 on: January 17, 2019, 07:37:52 am »
Hi there!
I encountered exactly the same problem with both installations of c::b 16.01 and 17.12, regardless of wx2.x/wx3.x on a Win 10 subsystem for Linux Ubuntu installation (Bionic ver). It seemed completely random which files c::b displayed or not. All files I've tested are completely equal in terms of encoding, permissions, etc. and fully visible in other editors (vi, emacs, gedit, etc) so the discovery of the file size < 617B issue by tianrenli92 really saved my day, and probably the coming week!!! Thank you!!!
The quick fix is of course just to add a few # signs in the files smaller than 617B, but a bug-fix is probably appreciated  ;)

What is the latest news about this issue? Could not find anything about it elsewhere...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Unable to read source file
« Reply #36 on: January 17, 2019, 08:38:31 am »
What is the latest news about this issue? Could not find anything about it elsewhere...
Same as before. Someone has to install a debugger, build debug versions of cb and wx and try to see what is going on.

I have enough platforms, so I cannot bother to debug another one. Sorry.
(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 ked

  • Single posting newcomer
  • *
  • Posts: 6
Re: Unable to read source file
« Reply #37 on: January 17, 2019, 11:57:18 am »
Thanx anyway for discovering the file size relation to the problem. I can live with adding #-es to exceed the critical file size, and debugging c::b source code (and similar) is, however, waaaay out of my knowledge.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #38 on: January 17, 2019, 10:50:24 pm »
no windows 10 to debug :/

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1560
Re: Unable to read source file
« Reply #39 on: January 18, 2019, 09:25:53 am »
I have Windows 10 (64 Pro and 32 Home) and don't have such problem with a 71 byte long file.

I think it is related to the Windows Subsystem for Linux file system adaption layer, both posters are using it.