Merge branch 'getenv-invalid-names' into 'main'

genvironment: consider macOS behavior when testing g_getenv

See merge request GNOME/glib!4899
This commit is contained in:
Philip Withnall
2025-11-09 18:22:32 +00:00
2 changed files with 7 additions and 6 deletions

View File

@@ -127,10 +127,14 @@ test_getenv (void)
g_assert_true (g_setenv ("foo", "bar=baz", TRUE));
/* Different OSs return different values; some return NULL because the key
* is invalid, but some are happy to return what we set above. */
* is invalid, but some are happy to return what we set above. macOS clips
* the key when it contains `=` */
data = g_getenv ("foo=bar");
if (data != NULL)
g_assert_cmpstr (data, ==, "baz");
{
g_assert_true (g_strcmp0 (data, "bar=baz") == 0 ||
g_strcmp0 (data, "baz") == 0);
}
else
{
data = g_getenv ("foo");

View File

@@ -33,10 +33,7 @@ glib_tests = {
'can_fail' : host_system == 'darwin' or linux_libc == 'musl',
},
'dir' : {},
'environment' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
'can_fail' : host_system == 'darwin',
},
'environment' : {},
'error' : {},
'fileutils' : {},
'gdatetime' : {