Bug 193426 - lang/mono: allow overriding Environment.SpecialFolder.Personal e.g., HOME=${WRKDIR}
Summary: lang/mono: allow overriding Environment.SpecialFolder.Personal e.g., HOME=${W...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: John Marino
URL:
Keywords: needs-qa, patch
Depends on:
Blocks: 193422
  Show dependency treegraph
 
Reported: 2014-09-07 12:32 UTC by Jan Beich
Modified: 2014-10-31 13:16 UTC (History)
1 user (show)

See Also:


Attachments
reorder (1.02 KB, patch)
2014-09-07 12:32 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2014-09-07 12:32:27 UTC
Created attachment 147004 [details]
reorder

Any port that writes to Environment.SpecialFolder.Personal during build or when running tests may end up with files outside of 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.

Patch based on discussion in

https://github.com/mono/mono/pull/371
Comment 1 Jan Beich freebsd_committer freebsd_triage 2014-09-07 12:50:10 UTC
devel/glib20 provides some background:

/**
 * g_get_home_dir:
 *
 * Gets the current user's home directory.
 *
 * As with most UNIX tools, this function will return the value of the
 * <envar>HOME</envar> environment variable if it is set to an existing
 * absolute path name, falling back to the <filename>passwd</filename>
 * file in the case that it is unset.
 *
 * If the path given in <envar>HOME</envar> is non-absolute, does not
 * exist, or is not a directory, the result is undefined.
 *
 * <note><para>
 *   Before version 2.36 this function would ignore the
 *   <envar>HOME</envar> environment variable, taking the value from the
 *   <filename>passwd</filename> database instead.  This was changed to
 *   increase the compatibility of GLib with other programs (and the XDG
 *   basedir specification) and to increase testability of programs
 *   based on GLib (by making it easier to run them from test
 *   frameworks).
 * </para><para>
 *   If your program has a strong requirement for either the new or the
 *   old behaviour (and if you don't wish to increase your GLib
 *   dependency to ensure that the new behaviour is in effect) then you
 *   should either directly check the <envar>HOME</envar> environment
 *   variable yourself or unset it before calling any functions in GLib.
 * </para></note>
 *
 * Returns: the current user's home directory
 */
Comment 2 John Marino freebsd_committer freebsd_triage 2014-10-31 12:58:01 UTC
Ugh, I didn't notice this before committing openra.  It's been long since timed out.  I have to take it.
Comment 3 commit-hook freebsd_committer freebsd_triage 2014-10-31 13:14:12 UTC
A commit references this bug:

Author: marino
Date: Fri Oct 31 13:13:10 UTC 2014
New revision: 371813
URL: https://svnweb.freebsd.org/changeset/ports/371813

Log:
  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)

Changes:
  head/lang/mono/Makefile
  head/lang/mono/files/patch-eglib_src_gmisc-unix.c
Comment 4 John Marino freebsd_committer freebsd_triage 2014-10-31 13:16:39 UTC
Thanks.  I hope the patch is correct because I don't currently have access to facilities that can quickly build this port.  I really would have preferred mono@ review and commit this but 8 weeks is long enough.

I did confirm the patch target completes though.