Bug 281809 - CDT doesn't recognize binaries on Linux
Summary: CDT doesn't recognize binaries on Linux
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 6.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-29 03:30 EDT by Ales Nosek CLA
Modified: 2020-09-04 15:25 EDT (History)
2 users (show)

See Also:


Attachments
Patch which fixes the bug (1.46 KB, patch)
2009-06-29 03:30 EDT, Ales Nosek CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ales Nosek CLA 2009-06-29 03:30:24 EDT
Created attachment 140344 [details]
Patch which fixes the bug

Build ID: 20090619-0625

Steps To Reproduce:
1. Create a binary which name has other suffix than "exe". For example:
invisible_binary.bin
unrecognized.bin.i386

2. CDT will not show it as a binary in the Projects view.


More information:
CDT includes code which omits binaries which have other suffix than "exe". On Linux there's no way how to recognize that file is a binary only from its name.

I attach the patch which removes the described code. I tested it and it works pretty well. Binaries are now recognized by the magic numbers, which is portable.
Comment 1 James Blackburn CLA 2009-06-29 03:46:42 EDT
The reason we don't do this by default is performance. If you don't pre-filter files by extension then you end up opening every file looking for magic bytes which is hugely expensive.

Note that we do examine files which don't have any extension. Perhaps you should just add the extensions you listed to the set of built-in .exe type content types?
Comment 2 Ales Nosek CLA 2009-06-29 04:14:35 EDT
(In reply to comment #1)
> looking for magic bytes which is hugely expensive.
> 

Yes, it is. On the Linux platform I would suggest to filter the files based on their executable permissions. File permissions are stored in inodes and these are cached by the kernel. Such a filtering should be really fast.


> Note that we do examine files which don't have any extension. Perhaps you
> should just add the extensions you listed to the set of built-in .exe type
> content types?
> 

Thank you! This is a very good workaround. I added my extensions in Preferences/General/Content Types/Binary File.