Page MenuHomePhabricator

eina: find a real path of dynamic library
ClosedPublic

Authored by akanad on Aug 19 2018, 11:11 PM.

Details

Summary

In general case, user library path is specifed as /usr/lib/, however,
if the user library path is specified as /lib/ which is a symbolic link to /usr/lib/,
current eina_prefix_new logic will print warning messages.
(actually the logic finds a /usr/lib/ path once a fallback logic runs)

This patch modifies the logic to find a proper path of lib path even if it is specified as symlink.

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
akanad created this revision.Aug 19 2018, 11:11 PM
akanad requested review of this revision.Aug 19 2018, 11:11 PM
bu5hm4n requested changes to this revision.Aug 19 2018, 11:37 PM
bu5hm4n added a subscriber: bu5hm4n.
bu5hm4n added inline comments.
src/lib/eina/eina_prefix.c
587

You can do:
IF_FREE_NULL(pfx->exe_path)
pfx->exe_path = rlink;

and not free the rlink afterwards, that would be equivalent :). It safes two memory allocator access.

592

Maybe a bit of error handling would be nice here. The solving can fail for a few reasons, where we probebly dont want to have that prefix path at all :)

This revision now requires changes to proceed.Aug 19 2018, 11:37 PM
akanad updated this revision to Diff 16419.Aug 20 2018, 3:35 AM

patch to apply what @bu5hm4n suggested.

akanad updated this revision to Diff 16501.Aug 23 2018, 5:58 PM

my bad, fix build error

i don't understand why using a function (using it only once) with a #ifdef instead of using the #ifdef directly...

akanad updated this revision to Diff 16512.Aug 24 2018, 3:18 AM

I thought that I have to make a if blocks.
there have been using of realpath without ifndef blocks already.

akanad added inline comments.Aug 24 2018, 3:27 AM
src/lib/eina/eina_prefix.c
309

here

353

here

akanad updated this revision to Diff 16513.Aug 24 2018, 3:32 AM

fix dumb error

bu5hm4n accepted this revision.Aug 24 2018, 6:42 AM

yeah, realpath is defined by evil.

This revision is now accepted and ready to land.Aug 24 2018, 6:42 AM
Closed by commit rEFL3ea6f58ec68e: eina: find a real path of dynamic library (authored by WhiskyKiloSq, committed by Marcel Hollerbach <mail@marcel-hollerbach.de>). · Explain WhyAug 24 2018, 6:49 AM
This revision was automatically updated to reflect the committed changes.