[Pkg-javascript-commits] [datatables.js] 01/01: avoid use of static tempfiles in /tmp

Sascha Steinbiss sascha at steinbiss.name
Fri Jan 13 12:45:22 UTC 2017


This is an automated email from the git hooks/post-receive script.

sascha-guest pushed a commit to branch master
in repository datatables.js.

commit 4dce33de60efe0ea8adb565120c7018465dd6a64
Author: Sascha Steinbiss <satta at debian.org>
Date:   Fri Jan 13 12:43:42 2017 +0000

    avoid use of static tempfiles in /tmp
    
    Thanks to Christoph Biedl for the patch.
---
 debian/changelog                             |   8 ++
 debian/patches/series                        |   1 +
 debian/patches/use-tempdir-and-errexit.patch | 112 +++++++++++++++++++++++++++
 3 files changed, 121 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 2179135..c64fe19 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+datatables.js (1.10.13+dfsg-2) unstable; urgency=medium
+
+  * Avoid use of static filenames in /tmp during build.
+    Thanks to Christoph Biedl for the patch.
+    Closes: #850879
+
+ -- Sascha Steinbiss <satta at debian.org>  Fri, 13 Jan 2017 12:40:37 +0000
+
 datatables.js (1.10.13+dfsg-1) unstable; urgency=medium
 
   * New upstream release.
diff --git a/debian/patches/series b/debian/patches/series
index 8e3ed0e..0272ced 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 use_correct_closure_path
 disable_git
+use-tempdir-and-errexit.patch
diff --git a/debian/patches/use-tempdir-and-errexit.patch b/debian/patches/use-tempdir-and-errexit.patch
new file mode 100644
index 0000000..fda9598
--- /dev/null
+++ b/debian/patches/use-tempdir-and-errexit.patch
@@ -0,0 +1,112 @@
+Subject: Use a temporary directory to build, run the make.sh script under errexit. Closes: #850879
+Author: Christoph Biedl <debian.axhn at manchmal.in-ulm.de>
+Bug-Debian: https://bugs.debian.org/850879
+Forwarded: https://github.com/DataTables/DataTablesSrc/issues/91
+
+--- a/build/include.sh
++++ b/build/include.sh
+@@ -5,6 +5,8 @@
+ CLOSURE="/usr/share/java/closure-compiler.jar"
+ JSHINT="/usr/bin/jshint"
+ 
++TMPDIR="$(mktemp --directory --tmpdir "jquery-datatables.$$.XXXXX")"
++trap "rm -rf \"$TMPDIR\"" EXIT
+ 
+ # CSS styling frameworks that DataTables supports
+ FRAMEWORKS=(
+@@ -125,23 +127,23 @@
+ 
+ 		# Closure Compiler doesn't support "important" comments so we add a
+ 		# @license jsdoc comment to the license block to preserve it
+-		cp $DIR/$FILE.js /tmp/$FILE.js
+-		perl -i -0pe "s/^\/\*! (.*)$/\/** \@license \$1/s" /tmp/$FILE.js
++		cp $DIR/$FILE.js $TMPDIR/$FILE.js
++		perl -i -0pe "s/^\/\*! (.*)$/\/** \@license \$1/s" $TMPDIR/$FILE.js
+ 
+-		rm /tmp/closure_error.log
+-		java -jar $CLOSURE --charset 'utf-8' --js /tmp/$FILE.js > /tmp/$FILE.min.js 2> /tmp/closure_error.log
++		rm -f $TMPDIR/closure_error.log || true
++		java -jar $CLOSURE --charset 'utf-8' --js $TMPDIR/$FILE.js > $TMPDIR/$FILE.min.js 2> $TMPDIR/closure_error.log
+ 
+-		if [ -e /tmp/closure_error.log ]; then
++		if [ -e $TMPDIR/closure_error.log ]; then
+ 			if [ -z "$LOG" -o "$LOG" = "on" ]; then
+-				cat /tmp/closure_error.log
++				cat $TMPDIR/closure_error.log
+ 			fi
+ 		fi
+ 
+ 		# And add the important comment back in
+-		perl -i -0pe "s/^\/\*/\/*!/s" /tmp/$FILE.min.js
++		perl -i -0pe "s/^\/\*/\/*!/s" $TMPDIR/$FILE.min.js
+ 
+-		mv /tmp/$FILE.min.js $DIR/$FILE.min.js
+-		rm /tmp/$FILE.js
++		mv $TMPDIR/$FILE.min.js $DIR/$FILE.min.js
++		rm $TMPDIR/$FILE.js
+ 
+ 		echo_msg "  File size: $(ls -l $DIR/$FILE.min.js | awk -F" " '{ print $5 }')"
+ 	fi
+@@ -161,9 +163,10 @@
+ 	IFS='%'
+ 
+ 	cp $IN_FILE $IN_FILE.build
+-	grep "_buildInclude('" $IN_FILE.build > /dev/null
++	CODE=0
++	grep "_buildInclude('" $IN_FILE.build > /dev/null || CODE=$?
+ 
+-	while [ $? -eq 0 ]; do
++	while [ $CODE -eq 0 ]; do
+ 		REQUIRE=$(grep "_buildInclude('" $IN_FILE.build | head -n 1)
+ 
+ 		SPACER=$(echo ${REQUIRE} | cut -d _ -f 1)
+@@ -177,7 +180,7 @@
+ 
+ 		rm ${DIR}/${FILE}.build
+ 
+-		grep "_buildInclude('" $IN_FILE.build > /dev/null
++		grep "_buildInclude('" $IN_FILE.build > /dev/null || CODE=$?
+ 	done
+ 
+ 	mv $IN_FILE.build $OUT
+--- a/build/make.sh
++++ b/build/make.sh
+@@ -1,5 +1,7 @@
+ #!/bin/bash
+ 
++set -e
++
+ . include.sh
+ 
+ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+@@ -34,9 +36,10 @@
+ 	OLD_IFS=$IFS
+ 	IFS='%'
+ 	cp DataTables.js DataTables.js.build
+-	grep "_buildInclude('" DataTables.js.build > /dev/null
++	CODE=0
++	grep "_buildInclude('" DataTables.js.build > /dev/null || CODE=$?
+ 
+-	while [ $? -eq 0 ]; do
++	while [ $CODE -eq 0 ]; do
+ 		REQUIRE=$(grep "_buildInclude('" DataTables.js.build | head -n 1)
+ 
+ 		SPACER=$(echo ${REQUIRE} | cut -d _ -f 1)
+@@ -50,7 +53,7 @@
+ 
+ 		rm ${DIR}/${FILE}.build
+ 
+-		grep "_buildInclude('" DataTables.js.build > /dev/null
++		grep "_buildInclude('" DataTables.js.build > /dev/null || CODE=$?
+ 	done
+ 
+ 	mv DataTables.js.build $OUT_FILE
+@@ -70,7 +73,7 @@
+ 
+ 	js_compress $OUT_FILE
+ 
+-	cp jquery.js $OUT_DIR
++	#cp jquery.js $OUT_DIR
+ 	cp integration/* $OUT_DIR
+ 
+ 	# Compress the integration files

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/datatables.js.git



More information about the Pkg-javascript-commits mailing list