[polyml] 05/07: Added patch reset-save-vector-sleep.diff
James Clarke
jrtc27-guest at moszumanska.debian.org
Mon Apr 25 20:35:52 UTC 2016
This is an automated email from the git hooks/post-receive script.
jrtc27-guest pushed a commit to branch master
in repository polyml.
commit d53701b6363ed3209d2f6411299d08018ffa50f3
Author: James Clarke <jrtc27 at jrtc27.com>
Date: Mon Apr 25 21:05:23 2016 +0100
Added patch reset-save-vector-sleep.diff
This fixes a potential assertion failure when sleeping, as the save
vector could previously overflow.
---
debian/changelog | 3 ++
debian/patches/reset-save-vector-sleep.diff | 77 +++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 81 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 56621eb..92b3171 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,9 @@ polyml (5.6-6) UNRELEASED; urgency=medium
* New patches:
- polyc-it.diff: Don't set "it" in polyc. This fixes the test suite when
compiled with polyc.
+ - reset-save-vector-sleep.diff: Ensure the save vector is reset when
+ sleeping in Posix.Process.sleep. This stops the save vector from
+ potentially overflowing and causing an assertion failure.
-- James Clarke <jrtc27 at jrtc27.com> Mon, 25 Apr 2016 19:38:35 +0100
diff --git a/debian/patches/reset-save-vector-sleep.diff b/debian/patches/reset-save-vector-sleep.diff
new file mode 100644
index 0000000..c723116
--- /dev/null
+++ b/debian/patches/reset-save-vector-sleep.diff
@@ -0,0 +1,77 @@
+Description: Ensure the save vector is reset when sleeping in
+ Posix.Process.sleep. This is almost the same as commit 57bc974 in
+ basicio.cpp.
+Origin: backport, https://github.com/polyml/polyml/commit/a66e52345ab56fe0af3e4862bb61a7f98a3da1db
+Author: David Matthews <dm at prolingua.co.uk>
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- /dev/null
++++ b/Tests/Fail/Test073.ML
+@@ -0,0 +1,5 @@
++(* Testing Posix is a problem because the Posix structure is not available in Windows. *)
++(* This caused an assertion failure when the save vector overflowed. *)
++Posix.Process.sleep (Time.fromMilliseconds 15000);
++rubbish; (* Generate a "failure" i.e. the correct result *)
++
+--- a/libpolyml/unix_specific.cpp
++++ b/libpolyml/unix_specific.cpp
+@@ -383,7 +383,6 @@
+ Handle OS_spec_dispatch_c(TaskData *taskData, Handle args, Handle code)
+ {
+ unsigned lastSigCount = receivedSignalCount; // Have we received a signal?
+- TryAgain:
+ int c = get_C_long(taskData, DEREFWORDHANDLE(code));
+ switch (c)
+ {
+@@ -580,27 +579,30 @@
+ }
+
+ case 21: /* Pause until signal. */
+- {
+ /* This never returns. When a signal is handled it will
+ be interrupted. */
++ while (true)
++ {
+ processes->ThreadPause(taskData);
+ if (lastSigCount != receivedSignalCount)
+ raise_syscall(taskData, "Call interrupted by signal", EINTR);
+- goto TryAgain;
+- }
++ }
+
+ case 22: /* Sleep until given time or until a signal. Note: this is called
+ with an absolute time as an argument and returns a relative time as
+ result. This RTS call is tried repeatedly until either the time has
+ expired or a signal has occurred. */
++ while (true)
+ {
+ struct timeval tv;
+ /* We have a value in microseconds. We need to split
+ it into seconds and microseconds. */
++ Handle hSave = taskData->saveVec.mark();
+ Handle hTime = args;
+ Handle hMillion = Make_arbitrary_precision(taskData, 1000000);
+ unsigned long secs = get_C_ulong(taskData, DEREFWORDHANDLE(div_longc(taskData, hMillion, hTime)));
+ unsigned long usecs = get_C_ulong(taskData, DEREFWORDHANDLE(rem_longc(taskData, hMillion, hTime)));
++ taskData->saveVec.reset(hSave);
+ /* Has the time expired? */
+ if (gettimeofday(&tv, NULL) != 0)
+ raise_syscall(taskData, "gettimeofday failed", errno);
+@@ -613,11 +615,13 @@
+ processes->ThreadPause(taskData);
+ if (lastSigCount != receivedSignalCount)
+ raise_syscall(taskData, "Call interrupted by signal", EINTR);
+- goto TryAgain;
++ // And loop
++ }
++ else
++ {
++ processes->TestAnyEvents(taskData); // Check for interrupts anyway
++ return Make_arbitrary_precision(taskData, 0);
+ }
+- else processes->TestAnyEvents(taskData); // Check for interrupts anyway
+-
+- return Make_arbitrary_precision(taskData, 0);
+ }
+
+ case 23: /* Set uid. */
diff --git a/debian/patches/series b/debian/patches/series
index b2a7f49..83915c0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -25,3 +25,4 @@ sh.diff
hppa.diff
thread-exited-interrupt-requested-overlap.diff
polyc-it.diff
+reset-save-vector-sleep.diff
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/polyml.git
More information about the debian-science-commits
mailing list