[Pkg-ocaml-maint-commits] [ocaml] 03/05: Compute a stable name for preprocessed files (Closes: #838188)
Mehdi Dogguy
mehdi at moszumanska.debian.org
Thu Dec 22 00:01:11 UTC 2016
This is an automated email from the git hooks/post-receive script.
mehdi pushed a commit to branch debian/sid
in repository ocaml.
commit bf639e7f830b6c3c390bb2881fb0bd2bf01bf561
Author: Mehdi Dogguy <mehdi at debian.org>
Date: Thu Dec 22 00:37:18 2016 +0100
Compute a stable name for preprocessed files (Closes: #838188)
---
debian/changelog | 2 ++
...pute-a-stable-name-for-preprocessed-files.patch | 33 ++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 36 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index b74401b..fda32d0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ ocaml (4.02.3-9) UNRELEASED; urgency=medium
* obey hardening LDFLAGS (Closes: #792502). Thanks to Török Edwin
for the patch!
- add patch 0013-Obey-ldflags.patch
+ * Compute a stable name for preprocessed files (Closes: #838188).
+ Thanks to Johannes Schauer for the patch!
-- Mehdi Dogguy <mehdi at debian.org> Thu, 22 Dec 2016 00:12:38 +0100
diff --git a/debian/patches/0014-Compute-a-stable-name-for-preprocessed-files.patch b/debian/patches/0014-Compute-a-stable-name-for-preprocessed-files.patch
new file mode 100644
index 0000000..ad0df46
--- /dev/null
+++ b/debian/patches/0014-Compute-a-stable-name-for-preprocessed-files.patch
@@ -0,0 +1,33 @@
+From: Johannes Schauer <josch at debian.org>
+Date: Thu, 22 Dec 2016 00:36:14 +0100
+Subject: Compute a stable name for preprocessed files
+
+---
+ driver/pparse.ml | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/driver/pparse.ml b/driver/pparse.ml
+index b67c180..321d0cc 100644
+--- a/driver/pparse.ml
++++ b/driver/pparse.ml
+@@ -18,10 +18,19 @@ type error =
+
+ exception Error of error
+
++external open_desc: string -> open_flag list -> int -> int = "caml_sys_open"
++external close_desc: int -> unit = "caml_sys_close"
++
+ (* Optionally preprocess a source file *)
+
+ let call_external_preprocessor sourcefile pp =
+- let tmpfile = Filename.temp_file "ocamlpp" "" in
++ (* do not use Filename.temp_file as the resulting temporary file name will be
++ * recorded in the debug output of the resulting binary and thus make the
++ * output random and unreproducible *)
++ let temp_dir = Filename.get_temp_dir_name () in
++ let hash = Digest.to_hex (Digest.string (sourcefile^pp)) in
++ let tmpfile = Filename.concat temp_dir ("ocamlpp"^hash) in
++ close_desc(open_desc tmpfile [Open_wronly; Open_creat; Open_excl] 0o600);
+ let comm = Printf.sprintf "%s %s > %s"
+ pp (Filename.quote sourcefile) tmpfile
+ in
diff --git a/debian/patches/series b/debian/patches/series
index 7ca62b3..78d8b8c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,3 +11,4 @@
0011-Compatibility-with-x32-architecture.patch
0012-arm-default-PIC.patch
0013-Use-CCLINKFLAGS-for-linking-all-executables-and-shar.patch
+0014-Compute-a-stable-name-for-preprocessed-files.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/ocaml.git
More information about the Pkg-ocaml-maint-commits
mailing list