Bug 208666 - devel/spark: commits filesystem violation by writing to /root
Summary: devel/spark: commits filesystem violation by writing to /root
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: Dmitry Sivachenko
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-10 10:36 UTC by John Marino
Modified: 2016-04-10 13:48 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (demon)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Marino freebsd_committer freebsd_triage 2016-04-10 10:36:17 UTC
When building devel/spark on a system that sets /root to read-only (such as ports-mgmt/Synth or dragonfly poudriere), spark fails to build:

[ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.2:compile (scala-compile-first) on project spark-test-tags_2.10: Execution scala-compile-first of goal net.alchim31.maven:scala-maven-plugin:3.2.2:compile failed: Could not create directory /root/.zinc/0.3.5/compiler-interface-2.10.5-51.0 -> [Help 1]


Spark should not be writing at /root during the build, this is a file system violation.

if I find a solution, I'll post it.
Comment 1 John Marino freebsd_committer freebsd_triage 2016-04-10 12:31:55 UTC
okay, I solved it.

you need to pass "-Duser.home=${WRKDIR}" to maven (as seen in other maven ports)

see example:

--- Makefile.orig       2016-04-10 12:05:14 UTC
+++ Makefile
@@ -46,7 +46,11 @@ JAVA_ARCH = ${ARCH}
 do-build:
        ${MKDIR} ${WRKDIR}/snappy/org/xerial/snappy/native/${OPSYS}/${JAVA_ARCH}
        ${CP} ${LOCALBASE}/lib/libsnappyjava.so ${WRKDIR}/snappy/org/xerial/snappy/native/${OPSYS}/${JAVA_ARCH}
-       cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${LOCALBASE}/share/java/maven33/bin/mvn --offline -Dmaven.repo.local=${WRKDIR}/m2 clean package -Dhadoop.version=2.7.2 -Pyarn -Phadoop-2.6 -DskipTests
+       cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
+               ${LOCALBASE}/share/java/maven33/bin/mvn --offline \
+               -Dmaven.repo.local=${WRKDIR}/m2 clean package \
+               -Dhadoop.version=2.7.2 -Pyarn -Phadoop-2.6 -DskipTests \
+               -Duser.home=${WRKDIR}
        ${JAR} uvf ${WRKSRC}/assembly/target/scala*/*assembly*hadoop*.jar -C ${WRKDIR}/snappy org


This patch also changed the *HUGE* line to respect 80 columns which is the convention (and nice for people that aren't on a virtual terminal)
Comment 2 Dmitry Sivachenko freebsd_committer freebsd_triage 2016-04-10 12:38:37 UTC
Thank you very much for your investigation!
Can you please commit it?
Comment 3 commit-hook freebsd_committer freebsd_triage 2016-04-10 13:40:42 UTC
A commit references this bug:

Author: marino
Date: Sun Apr 10 13:39:47 UTC 2016
New revision: 412931
URL: https://svnweb.freebsd.org/changeset/ports/412931

Log:
  devel/spark: Avoid building in /root ($HOME)

  Following other maven ports, set user.home to $WRKDIR to prevent writing
  in /root or $HOME during the build, which is a file system violation.
  While here, change the do-install target to respect 80 columns.

  PR:		208666
  Approved by:	maintainer (demon@) (notice the 666 suffix?)

Changes:
  head/devel/spark/Makefile
Comment 4 John Marino freebsd_committer freebsd_triage 2016-04-10 13:48:21 UTC
done, thanks!