Commit Graph

185 Commits

Author SHA1 Message Date
Carsten Haitzler 2037474dc0 vpath usage - simplify to bare minimum to make gustavo happy
since these are only local path resolves, the do and wait are
technically not needed. also remove any other tmp strings and use the
vpath string resolving feature to avoid printfs/strjoins/cats etc.
etc. as well.
2017-02-09 22:06:16 +09:00
Carsten Haitzler 75e1033682 efreet - use vpath to get XDG_RUNTIME_DIR so we have a single impl
having too many places that get XDG_RUNTIME_DIR makes it harder to
keep secure etc, so make it a single location for efreet too.
2017-02-09 18:38:28 +09:00
Cedric BAIL 8f1c071d6a eina: rename EINA_{FLT,DBL}_CMP to EINA_{FLT,DBL}_EQ. 2017-01-06 15:58:46 -08:00
Carsten Haitzler a6f7b0f834 efreet cache - handle corner case where efreetd keeps disconnecting
so an odd one. there is a socket, but nothing is actually listening on
it, but clients keep spinning launching efreetd's because the launch,
connect, then get a disconnect and try again immediately keeping
things spinning heavily, so add a delay of 0.5 sec before launchnig
another efreetd if the launch + connect fails and gets a disconnect
within 0.5 sec ... so give up for 0.5 sec before trying again to avoid
a runaway system.

@fix
2016-12-26 13:06:35 +09:00
Chris Michael 72a3556fa7 efreet: remove float comparison warnings
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-12-20 11:01:27 -05:00
Cedric BAIL 6da2fbc9c4 efreet: make mime type evaluation way faster by using mmap. 2016-11-14 15:17:12 -08:00
Carsten Haitzler f4f5a042a6 efreet - fix command generation by fixing string buffer expansion
so by chance i discovered efreet is doing bad things(tm) when
expanding/appending to string buffers to generate commands based off
desktop files. the string append basically was buggy, so fixed it by
making it a lot simpler and more obvious and now reliable.

@fix
2016-09-25 23:50:53 +09:00
Carsten Haitzler 07ffb2e5c5 efreet xml parse - handle 0 sized xml specially to avoid crash
fixes T4493
2016-09-20 14:55:35 +09:00
Jean Guyomarc'h 1ab1e3697d efreet: mime types database can be empty
When the mime types database is empty, the file will
be exactly 28 bytes.

Fixes T4426
2016-08-26 21:16:39 +02:00
Mike Blumenkrantz 8c3efbd174 efreet: add doc note about stringshare reliability for efreet_mime_type_get() 2016-08-26 10:20:45 -04:00
Carsten Haitzler 510c093602 efreet - convert crash into NULL mimes when no mime db found
so ok - efreet crashed letting you know you have a missing mimedb...
return NULL instead fixes T4425 :) - rememebr to kill your efreetd's
to get a new mimedb - log out and in will do that.
2016-08-24 10:00:50 +09:00
Carsten Haitzler 561f8eaa8f efreet - save about 240-300k or so of memory used by efreet mime
so efreet mime was loading a bunch of mime type info files, parsing
them on startup and allocating memory to store all this mime info -
globs, mimetype strings and more. all a big waste of memory as its
allocated on the heap per process where its the SAME data files loaded
every time.

so make an efreet mime cache file and a tool to create it from mime
files. mmap this file with all the hashes/strings in it so all that
data is mmaped once in memory and shared between all processes and it
is only paged in on demand - as actually read/needed so if your
process doesnt need to know about mime stuff.. it wont touch it anyway.

this saves about 240-300k or so of memory in my tests. this has not
covered the mime MAGIC files which still consume memory and are on the
heap. this is more complex so it will take more time to come up with a
nice file format for the data that is nicely mmaped etc.

@optimize
2016-08-23 12:04:06 +09:00
Carsten Haitzler 56c52311e5 efreet - fix efreet_*_dir_get() to support the xdg env vars
these api's didnt respect the env vars xdg dictates should override
the xdg dirs for that process. this fixes this and uses them if set

@fix
2016-08-23 12:04:06 +09:00
Marcel Hollerbach 3f1d40cff8 efreet: free fallback cache on shutdown
this fixes errors like:
ERR<4864>:eet lib/eet/eet_lib.c:645 eet_shutdown() File '/home/osauser/.cache/efreet/icons___efreet_fallback_localhost.localdomain.eet' is still open 1 times !

@fix
2016-08-04 17:04:50 +02:00
Carsten Haitzler 2ca5075193 efreet - fix mime file path messing with short paths like /
this fixes T4015

@fix
2016-07-05 16:28:52 +09:00
Carsten Haitzler 9527240d74 efl - fix lots of little init/shutdown pairs that are wrong
i've fixed almost all the eina init/shutdown pairs to do the right
thing now... except one (ecore_shutdown) with comment inline where
eo_shutdown is not called. if this is called we are in crash land.
this needs further inspection.
2016-07-04 21:30:34 +09:00
Mike Blumenkrantz 200f45c2b5 efreet: add locking for efreet_desktop_x_field_get()
in a threaded environment, reading from a hash is not atomic and is
subject to race conditions

@fix

ref 39417cf0ea
2016-01-25 11:27:02 -05:00
Mike Blumenkrantz 9aee7c249a efreet: reject invalid "" data for Efreet_Desktop->x hash
ref T3096

@fix
2016-01-25 11:27:01 -05:00
Andy Williams c4cd3f19bf [efreet] document NULL return possibility.
If file is not found then NULL is the fallback
2016-01-20 23:37:15 +00:00
Vincent Torri e20978054a Efreet: support language, country and modifer on Windows
Summary:
On Windows, the environment variables LANG, LC_ALL and LC_MESSAGES
do not exist, so retrieve langage and country modifier directly from the systeM

Test Plan: verify the value with some ptrinF

Reviewers: jpeg

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D3464
2015-12-18 16:48:34 +09:00
Vincent Torri 3b44645363 efl: add binary mode to f(re)open() calls
This allows better compatibility with Windows

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-12-05 21:04:36 +01:00
Carsten Haitzler 5263e61585 efreet desktop tracking - fix monitoring of dirs of custom desktops
@fix

this is wrong - start monitoring every/any dir in which a desktop file
exists that we load a desktop file from. imagine you browse directories
in efm with lots of desktop files in them - we end up monitoring lots
of directories that we then rememebr and don't un-monitor. this
disables monitoring of dirs from which we load a .desktop file from to
fix this.
2015-12-02 20:53:27 +09:00
Marcel Hollerbach 7b9bb510b4 efreet_icon: Fix wrong inherit selection
Summary:
The list of elem->paths is given with the actual icon at position 0 and
the bigger the index is the lower the icon in the inherit structure is.

Due to the for loop beginning at 0 walking to the end this
direction is flipped. So the last r is returned, which is the lowest
icon in the inherit structure.

This is fixed by returning if the first valid path is found.

@fix

Test Plan: run jesus or efm with a custom icon theme beore the wrong icons are taken, now the correct ones are taken

Reviewers: raster, cedric

Subscribers: DaveMDS

Differential Revision: https://phab.enlightenment.org/D3366
2015-11-25 09:35:07 +01:00
Carsten Haitzler e89253e597 efreet - fix efreetd kill and start with clean cache case blank icons
if you kill efreetd ANd delete all the caches, the restart of efreetd
will lose all icons until an app re-registeres icon extensions and it
can scan all icons .. and then app has to actually get the right
upodate events and do the update properly when this happens. this
fixes that scenario

@fix
2015-08-12 20:08:14 +09:00
Vincent Torri b7a277efa0 Efreet: Fix config and data dir paths on windows.
@fix
2015-07-08 16:29:05 +01:00
Carsten Haitzler 2f4fb3edac efreet - improve edstop exec find to use the command with less args
efreet will just match any desktop file (at random basically -
whatever is first in the list), thjat has the base command looked at.
if you have various desktip files with the same command, like:

mycommand
mycommand %U
mycommand -a -b -c /path/to/file
/usr/bin/mycommand

etc. - which one does it match? it'll pick the first and the list
ordering is arbitrary, so this is pretty bad. this strips off the base
command at the start (full path or whatever) and then uses the command
with the shortest argument length. this means the generic command is
found first if we look for "mycommand" in the above list, whihc ends
up the best... ESPECIALLY for steam which does just this.
2015-07-05 12:53:14 +09:00
Carsten Haitzler ddb3a60518 efreetd - new ipc - re-register on reconnect 2015-06-25 11:41:15 +09:00
Carsten Haitzler 5abfefe99e efl - efreetd service move from dbus session bus to ecore ipc
this fixes warnings about no efreet dbus session bus in non session
environments as brought up on the mailing lists with:

Subject: Re: [E-devel] [EGIT] [core/efl] master 01/01: edje: unset
efreet cache update flag to prevent dbus connections

this moves all of efreetd client and server to ecore ipc, with client
auto-launching efreetd if not found as a service and trying for up to
500ms to connect. efreetd times out on last connection or no
connections after 10sec so it wont hang around forever if not in use.
it seems to work in my testing, so let me know if there is an issue.

@fix
2015-06-24 19:28:17 +09:00
Cedric BAIL 5098e787e8 efreet: use portable environment lookup. 2015-05-14 18:41:48 +02:00
Cedric BAIL 493a2b3ab4 efreet: lower error message to warning. 2015-05-14 18:41:47 +02:00
Sebastian Dransfeld 9e0a00d768 efreet: fix signed warning
Update to 6a0d23. Casting to int isn't a real solution, since we could
have values which overflows.

Since we want the absolute value, just make sure we subtract the larger
value from the smaller.
2015-05-11 13:34:10 +02:00
Cedric BAIL 0b4a911450 efreet: remove the need to order the header correctly for Windows. 2015-05-07 09:53:10 +02:00
Mike Blumenkrantz 3571e7364e efreet: fix leak in efreet_util_desktop_exec_find()
@fix
2015-04-22 19:34:59 -04:00
Jean-Philippe Andre 6a0d2382f1 Efreet: Silence clang warning
[unsigned - unsigned] is unsigned and might wrap around, the implicit
conversion to int (by calling abs()) saved the game here.
2015-04-21 20:32:54 +09:00
Davide Andreoli 762d4fb551 Efreet: do not get confused by path ending with / in XDG_* vars
This @fix the parsing of dirs from the xdg env vars. Now always remove
the leading / char from the paths.

This was causing lots of trouble on my system, where XDG_DATA_DIRS is:
/usr/local/share/enlightenment:/usr/local/share:/usr/local/share/:/usr/share/

At first /usr/local/share was added 2 times in the list, one with the / and one
witout, causing a double lookup for each file.

Secondly the icon cache was totally unusable as the cached paths ended up
as: /usr/share//icons/Mint-X/places/32/folder.svg. The double / in there
was making the cache lookup to fail and anways return the biggest icon
available. Causing a big system slowdown whe searching for icons.

As a bonus the function now use eina_str_split instead of the custom splitting
code that require a bad special handling for the last item.
2015-01-25 12:44:09 +01:00
kabeer khan ee3bcaf71d efreetd_cache: Resolved TODO checking symbolic link to monitor real path
Summary: Signed-off-by: kabeer khan <kabeer.khan@samsung.com>

Reviewers: englebass

Reviewed By: englebass

Subscribers: devilhorns, cedric

Differential Revision: https://phab.enlightenment.org/D1625
2014-11-18 12:24:06 +01:00
Nicolas Aguirre f078d16391 efreet: add documentation for Efreet_Version structure. 2014-10-20 18:02:03 +02:00
Sebastian Dransfeld d1207854f4 efreet: fix show/nowshow
This partly reverts c700192, as the change here was wrong.
2014-09-30 23:19:57 +02:00
Sebastian Dransfeld b624345bbd efreet: improve messages 2014-09-29 09:39:38 +02:00
Sebastian Dransfeld d8aead7ab8 efreet: remove dead code 2014-09-29 09:39:38 +02:00
Sebastian Dransfeld f60fdced44 efreet: tab to spaces 2014-09-29 09:39:38 +02:00
Sebastian Dransfeld 88843b7377 efreet: TODO++ 2014-09-25 13:54:13 +02:00
Sebastian Dransfeld 8204212f36 efreet: Fix leak
When doing efreet_desktop_command_append_multiple we add all files from
command, whilst still looping command->files. So the command was created
with all files for all files.

Set l to NULL, since we parse all elements in command->files in
efreet_desktop_command_append_multiple to break the loop.
2014-09-25 09:24:27 +02:00
Sebastian Dransfeld 8e740ea765 efreet: remove debug fprintf 2014-09-25 09:22:07 +02:00
Sebastian Dransfeld 0f4f0a7e5e efreet: Fix leak on error
If we encountered an error, special hashes in internal desktop struct
wasn't free'd.
2014-09-25 09:01:12 +02:00
Sebastian Dransfeld 793fd5e847 efreet: Implement fields added by desktop spec 1.1 2014-09-25 08:47:45 +02:00
Sebastian Dransfeld c700192736 efreet: Accept both only_show_in and not_show_in
In one file it is allowed with both OnlyShowIn and NotShowIn, and it is
the user who has to ensure that these lists don' clash.

@fix
2014-09-25 08:47:45 +02:00
Sebastian Dransfeld 54d5653e1b efreet: Store known desktop environments 2014-09-18 10:48:50 +02:00
Carsten Haitzler 3539afeaf0 make indenting consistent
this doesnt mean its right - it just matches. efreet needs some indent
love.
2014-08-14 20:56:55 +09:00
Adrien Nader a2d8c1651b efreet: replace 4096 with sizeof(buf) in snprintf(buf, 4096, ...).
buf is a local variable defined as:
  char buf[4096];
The current code is correct; this change only makes sure the value won't
get out-of-sync later on.
2014-08-14 20:55:58 +09:00
Adrien Nader 3778036926 efreet: reverse if's condition and swap then/else blocks for readability
The reversal makes it possible to merge two #if and unspaghetti the code
a bit.

Since the diff is not very readable, here is the before/after to show
the spirit:

  before:

    #if cond
      if (...)
    #endif
        do_foo();
    #if cond
      else
        do_bar();
    #endif

  after:

    #if cond
      if ( ! ...)
        do_bar();
      else
    #endif
        do_foo();
2014-08-14 20:55:58 +09:00
Adrien Nader 0fb9f5d516 efreet: remove #ifdef GETUID inside #ifdef _WIN32 (it's always false). 2014-08-14 20:55:58 +09:00
Sebastian Dransfeld e7198621c5 efreet: use eina_file_mkstemp to create filename 2014-08-14 13:30:48 +02:00
Sebastian Dransfeld 95a02295c1 efreet: remove creation of XDG_RUNTIME_DIR
XDG_RUNTIME_DIR should be created and set by the system, not a library.
2014-08-14 13:01:29 +02:00
Carsten Haitzler 356d10fbee efreet - add menu ref/unref calls and refcounting to try solve e issue
not much more to say really... efreet_menu_free now unrefs nd checks
for 0 refcount first... unref just calls it to be "nice"

@feature
2014-07-23 20:36:19 +09:00
Jean-Philippe Andre 62e3c75777 Efreet: Fix shadow warning 2014-06-19 10:33:49 +09:00
Sebastian Dransfeld 9415f8a7ef efreet: improve handling of merged menus
If the menu is of the format ${XDG_MENU_PREFIX}applications.menu, we
want to merge applications-merged/, not
${XDG_MENU_PREFIX}applications-merged
2014-06-11 11:04:23 +02:00
Sebastian Dransfeld a10d4167f1 efreet: remove code duplication
If the menu starts with either kde- or gnome- the resulting action is
the same.
2014-06-11 11:04:23 +02:00
Sebastian Dransfeld ffda8635fe efreet: Correctly handle default merge dir
When main menu file is gnome-applications.menu or kde-applications.menu,
we should be using applications as base for merged dir.

Part of T1284
2014-06-10 13:46:49 +02:00
Kai Huuhko 64f35d4615 efreet: Fix mistakenly inverted behavior in URI handling
Fixes a mistake in commit 78c9a82a14

The authority part would get placed in the struct member "path",
and vice versa.

Lesson learned: Don't rewrite your patch late at night after
arc has messed it up.
2014-05-19 14:52:32 +03:00
Kai Huuhko 78c9a82a14 efreet: Handle URIs in a more generic way
Summary: Fixes T1219

Reviewers: englebass

CC: cedric

Maniphest Tasks: T1219

Differential Revision: https://phab.enlightenment.org/D865
2014-05-19 15:48:41 +09:00
Wonguk Jeong e32f033853 efreet: check magic only for file which has size
Summary:
Due to unnecessary magic checking, there was freezing in /proc in efm.
Proc file's st_size is zero, but, it's readable. therfore, it takes unnecessary time in magic checking. And, there is no need to check magic in case of 0 sized regular files as well.

Therefore, skip magic check in case of st_size is zero.

Fixes T1173

Test Plan: enlightenment -> file browser (efm) -> get int /proc --> check whether efm freezes or not

Reviewers: raster, cedric, zmike

CC: seoz, cedric

Maniphest Tasks: T1173

Differential Revision: https://phab.enlightenment.org/D764

Signed-off-by: Cedric Bail <cedric.bail@free.fr>
2014-04-17 19:34:38 +02:00
Mike Blumenkrantz d03ecb0f3d "whether" has 2x 'h' 2014-04-10 09:27:51 -04:00
Cedric BAIL d0a03f65dc efreet: fix build on windows by matching the #if around the if statement. 2014-01-09 14:30:13 +09:00
Carsten Haitzler e8c13118eb fix mingw build for setuid fix/checks 2014-01-08 22:06:41 +09:00
Carsten Haitzler b95ef3801f setuid safeness - ensure if an app that is setuid doesn't do bad things
this makes efl ignore certain env vars for thnigs and entirely removes
user modules (that no one ever used) etc. etc. to ensure that *IF* an
app is setuid, there isn't a priv escalation path that is easy.
2014-01-08 19:46:23 +09:00
Guillaume Friloux 6ea95af025 Fix documentation for efreet_desktop_exec(). 2014-01-01 21:39:14 +01:00
Guillaume Friloux defc1d1b1a Fix documentation for efreet_desktop_environment_get(). 2014-01-01 21:28:37 +01:00
Guillaume Friloux 42c32b48a6 Simplify code of efreet_desktop_environment_set(). 2014-01-01 21:27:19 +01:00
Daniel Juyung Seo 76d8532b54 efl: Unified eina critical manro to CRI.
Being annoyed by different types of eina critical macros - CRI, CRIT,
 CRITICAL -, I concluded to unify them to one. Discussed on IRC and
 finally, CRI was chosen to meet the consistency with other macros -
 ERR, WRN, INF, DBG - in terms of the number of characters.
If there is any missing bits, please let me know.
2013-12-26 12:27:13 +09:00
Sebastian Dransfeld 575f466a10 efreet: improve locking
Do find and ref inside lock, so no one can ref-- after we find desktop
2013-11-29 22:20:50 +01:00
Sebastian Dransfeld 233ca45db0 efreet: Only lock once for efficiency 2013-11-21 09:29:25 +01:00
Sebastian Dransfeld c85534af7e efreet: TODO++ 2013-11-21 09:29:25 +01:00
Sebastian Dransfeld e610047ef3 efreet: store volatile value locally before return 2013-11-21 09:29:25 +01:00
Carsten Haitzler b07c0a76ce alpha1 release autofoo/build tree work to pass distcheck and actually work 2013-11-04 18:33:35 +09:00
Sebastian Dransfeld 76721f4153 efreet: Check buffer size
CID 1039582, 1039583
2013-10-14 13:21:48 +02:00
Sebastian Dransfeld 7f30306031 efreet: Always '\0' terminate buf
CID 1039721
2013-10-14 11:54:51 +02:00
Sebastian Dransfeld 144ed4c10c efreet: Fix buffer overrun, leave space for '\0'
CID: #1039304, #1039305 and #1039306
2013-08-07 13:02:54 +02:00
Sebastian Dransfeld e011d5e67c efreet: be paranoid about '\0' termination
CID: #1039721
2013-08-07 13:02:54 +02:00
Sebastian Dransfeld 35a45eb062 efreet: formatting 2013-08-07 13:02:54 +02:00
Sebastian Dransfeld 2e4fb25922 efreet: clean up ugly internal_get function
CID: #1039186
2013-08-07 13:02:54 +02:00
Sebastian Dransfeld 75dd06bcb1 efreet: Remove dead code
CID: #1039942
2013-08-07 13:02:54 +02:00
Sebastian Dransfeld ed524d49cc efreet: Explicitly set num_pending to 0
CID: #1039185
2013-08-07 13:02:54 +02:00
Sebastian Dransfeld 9707fee051 efreet: Check return value of eet_list
CID: #1039327
2013-08-07 13:02:53 +02:00
Sebastian Dransfeld 8327903b99 efreet: fgetc returns int
CID: #1039720
2013-08-07 13:02:53 +02:00
Sebastian Dransfeld a8d70f803c efreet: Check return value of chmod
CID: #1039690
2013-08-07 13:02:53 +02:00
Sebastian Dransfeld 7d1703ea0d efreet: Be paranoid about '\0' termination
CID: #1039722
2013-08-07 13:02:53 +02:00
Sebastian Dransfeld 73ad466cbc efreet: TODO++ 2013-08-07 13:02:53 +02:00
Cedric Bail ea3f82fa1e efreet: let's pass memset parameter in the right order. 2013-08-06 09:17:46 +09:00
Chris Michael 80f2498909 efreet_menu_move_free will free "move" here so remove the menu from
the parent's list Before we free the menu.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2013-08-05 13:58:13 +01:00
Sebastian Dransfeld a76633b930 efreet: Fix allocated data size
Since we check for count < 10 and then add 1, we could get count == 11.
Also set array memory to 0 in one command.
2013-08-05 10:45:29 +02:00
Sebastian Dransfeld 92437d7204 efreet: Formatting 2013-08-05 10:45:29 +02:00
Carsten Haitzler 27553f0500 fix clang sizeof complaint 2013-07-16 19:49:31 +09:00
Chris Michael 57924e5824 Fix memleak reported by Coverity: Close the descriptor returned by
popen if we are going to error out.

NB: Fixes Coverity CID1039184

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2013-07-08 11:25:59 +01:00
Chris Michael aeb4b7f7b9 Fix memleak reported by Coverity: If we fail to allocate a new
internal menu, then free the previously allocated memory for xml file.

NB: Fixed Coverity CID 1039183

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2013-07-08 11:19:37 +01:00
Chris Michael c04cfde0e5 Fix mem leak reported by Coverity: If we fail to create a new internal
menu, then free the previously allocated xml file.

NB: Fixes Coverity CID 1039182

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2013-07-08 11:17:13 +01:00
Cedric Bail 267b9e4c29 efreet: always sanitize path. 2013-06-27 15:19:44 +09:00
Cedric Bail 61396654a5 efreet: cleanup code by using Eina_File infra. 2013-06-27 15:19:43 +09:00
Carsten Haitzler 33678961b6 efreet: and dont try change mode if runtime dir is /tmp 2013-06-26 12:16:50 +09:00
Cedric Bail e920c2cc76 efreet: make geteuid an optional function. 2013-06-26 11:24:29 +09:00