1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-16 07:58:04 +00:00

lang/mono: allow overriding Environment.SpecialFolder.Personal

Any port that writes to Environment.SpecialFolder.Personal during build
or when running tests may end up with files outside of the stage area that
aren't cleaned up by the ports framework.  The issue lies with Mono
looking in /etc/passwd first and only if no entry found there in $HOME.
This PR was an unnoticed prerequisite for the new port games/openra.

Patch based on discussion in https://github.com/mono/mono/pull/371

PR:		193426
Submitted by:	Jan Beich
Approved by:	maintainer timeout (8 weeks)
This commit is contained in:
John Marino 2014-10-31 13:13:09 +00:00
parent 1eea175f09
commit a3292075d8
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=371813
2 changed files with 44 additions and 0 deletions

View File

@ -3,6 +3,7 @@
PORTNAME= mono
PORTVERSION= 3.10.0
PORTREVISION= 1
CATEGORIES= lang
MASTER_SITES= http://download.mono-project.com/sources/${PORTNAME}/

View File

@ -0,0 +1,43 @@
https://github.com/mono/mono/pull/371
--- eglib/src/gmisc-unix.c~
+++ eglib/src/gmisc-unix.c
@@ -93,24 +93,27 @@ get_pw_data (void)
pthread_mutex_unlock (&pw_lock);
return;
}
+
+ home_dir = g_getenv ("HOME");
+ user_name = g_getenv ("USER");
+
#ifdef HAVE_GETPWUID_R
- if (getpwuid_r (getuid (), &pw, buf, 4096, &result) == 0) {
- home_dir = g_strdup (pw.pw_dir);
- user_name = g_strdup (pw.pw_name);
+ if (home_dir == NULL || user_name == NULL) {
+ if (getpwuid_r (getuid (), &pw, buf, 4096, &result) == 0) {
+ if (home_dir == NULL)
+ home_dir = g_strdup (pw.pw_dir);
+ if (user_name == NULL)
+ user_name = g_strdup (pw.pw_name);
+ } else {
+ if (user_name == NULL)
+ user_name = "somebody";
+ }
}
#endif
- if (home_dir == NULL)
- home_dir = g_getenv ("HOME");
- if (user_name == NULL) {
- user_name = g_getenv ("USER");
- if (user_name == NULL)
- user_name = "somebody";
- }
pthread_mutex_unlock (&pw_lock);
}
-/* Give preference to /etc/passwd than HOME */
const gchar *
g_get_home_dir (void)
{