Page MenuHomePhabricator

eina_vpath_resolve adds an additional / and also segfault
Closed, ResolvedPublic

Description

consider (on linux):

printf("%s\n", eina_vpath_resolve("(:usr.pictures:)/foo"));

it returns /home/vtorri//Pictures/foo, that is an additional / before Pictures. It's the case on linux or Windows.

It is the case for : desktop, documents, downloads, music, pictures, templates, videos, data and tmp

note that usr.public, while in eina_vpath.h comments, is not recognized (hence, abort)

segfault too with "(:app.bin:)/foo" etc...

vtorri created this task.Nov 7 2021, 12:04 AM
vtorri added a comment.EditedNov 7 2021, 12:24 AM

code (code that aborts is commented) :

#include <stdio.h>

#define EFL_BETA_API_SUPPORT
#include <Eina.h>

int main()
{
  eina_init();

  printf("%s\n", eina_vpath_resolve("(:tmp:)/foo"));
  printf("%s\n", eina_vpath_resolve("(:home:)/foo"));
  printf("%s\n", eina_vpath_resolve("(:usr.desktop:)/foo"));
  printf("%s\n", eina_vpath_resolve("(:usr.documents:)/foo"));
  printf("%s\n", eina_vpath_resolve("(:usr.downloads:)/foo"));
  printf("%s\n", eina_vpath_resolve("(:usr.music:)/foo"));
  printf("%s\n", eina_vpath_resolve("(:usr.pictures:)/foo"));
  //printf("%s\n", eina_vpath_resolve("(:usr.public:)/foo"));
  printf("%s\n", eina_vpath_resolve("(:usr.templates:)/foo"));
  printf("%s\n", eina_vpath_resolve("(:usr.videos:)/foo"));
  printf("%s\n", eina_vpath_resolve("(:usr.data:)/foo"));
  printf("%s\n", eina_vpath_resolve("(:usr.config:)/foo"));
  printf("%s\n", eina_vpath_resolve("(:usr.cache:)/foo"));
  printf("%s\n", eina_vpath_resolve("(:usr.run:)/foo"));
  printf("%s\n", eina_vpath_resolve("(:usr.tmp:)/foo"));
  //printf("%s\n", eina_vpath_resolve("(:app.dir:)/foo"));
  //printf("%s\n", eina_vpath_resolve("(:app.bin:)/foo"));
  //printf("%s\n", eina_vpath_resolve("(:app.lib:)/foo"));
  //printf("%s\n", eina_vpath_resolve("(:app.data:)/foo"));
  //printf("%s\n", eina_vpath_resolve("(:app.locale:)/foo"));
  //printf("%s\n", eina_vpath_resolve("(:app.config:)/foo"));
  //printf("%s\n", eina_vpath_resolve("(:app.local:)/foo"));
  //printf("%s\n", eina_vpath_resolve("(:app.tmp:)/foo"));

  eina_shutdown();

  return 0;
}
vtorri added a comment.Nov 7 2021, 1:19 AM

ok, some thoughts :

:usr.public: is in eina_vpath.h comments, but in eina_vpath.c line 411: ADD(pub); (not ADD(public);)

also eina_vpath_interface_app_set() and eina_vpath_interface_user_set() are public API but are not in eina_vpath.h