Fix test_find_program on FreeBSD

On FreeBSD /home is generally a symlink to /usr/home, so the relative
resolves to /usr/bin instead of /bin and `sh` can only be found in /bin
on FreeBSD. Fix this by resolving symlinks in the CWD first.
This commit is contained in:
Alex Richardson 2022-12-14 23:55:20 +00:00
parent d1ba2b421f
commit 25ae9f59e8

View File

@ -451,7 +451,9 @@ test_find_program (void)
g_assert (res != NULL);
g_free (res);
cwd = g_get_current_dir ();
/* Resolve any symlinks in the CWD as that breaks the test e.g.
* with the FreeBSD /home/ -> /usr/home symlink. */
cwd = realpath (".", NULL);
absolute_path = g_find_program_in_path ("sh");
relative_path = g_strdup (absolute_path);
for (i = 0; cwd[i] != '\0'; i++)