Bug#553174: libphysfs: Fails if $HOME doesn't exist

Jordà Polo jorda at ettin.org
Thu Oct 29 10:15:58 UTC 2009


Package: libphysfs
Version: 2.0.0-3
Severity: normal

PhysicsFS currently fails when the HOME directory doesn't exist, even if
it isn't used at all. For instance, the following simple code fails to
run if $HOME points to a directory that doesn't exist:


  #include <stdio.h>
  #include <physfs.h>

  int main(int argc, char *argv[]) {
     if (PHYSFS_init(argv[0]))
        printf("ok\n");
     else
        printf("not ok: %s\n", PHYSFS_getLastError());
  }


  $ ./a.out
  ok
  $ HOME=/foo ./a.out
  not ok: No such file or directory


This behaviour is unexpected as there is no apparent reason for the
failure. PhysicsFS should be changed to only fail if a real HOME is
actually needed.

As explained in by Guillem Jover (#544835), the callgraph looks
something like this:

>  +- libphysfs/physfs.c:PHYSFS_init()
>  |  `- libphysfs/physfs.c:calculateUserDir()
>  |     `- libphysfs/platform/posix.c:__PHYSFS_platformGetUserDir()
>  |        `- Gets HOME environment variable.
>  +- libphysfs/platform/unix.c:__PHYSFS_platformRealPath()
>     `- Fails





More information about the Pkg-games-devel mailing list