Bug#660860: cfengine3: segfaults when triggering some locks

2012-04-15 Thread Jimmy Thrasibule
Hello,

I backported the commit 253b3720fb43 from the upstream. Everything is
works fine when applied. You will find a patch for the package's
repository.

--
Jimmy
From 86877f0895a99f266cf4fa92d391d2be072dc397 Mon Sep 17 00:00:00 2001
From: Jimmy Thrasibule thrasibule.ji...@gmail.com
Date: Sun, 15 Apr 2012 19:33:36 +0200
Subject: [PATCH] add patch to fix bug #660860

---
 debian/patches/fix-bug-660860 |   53 +
 debian/patches/series |1 +
 2 files changed, 54 insertions(+), 0 deletions(-)
 create mode 100644 debian/patches/fix-bug-660860

diff --git a/debian/patches/fix-bug-660860 b/debian/patches/fix-bug-660860
new file mode 100644
index 000..ed9a4cc
--- /dev/null
+++ b/debian/patches/fix-bug-660860
@@ -0,0 +1,53 @@
+Index: cfengine-debian/src/cf.defs.h
+===
+--- cfengine-debian.orig/src/cf.defs.h
 cfengine-debian/src/cf.defs.h
+@@ -382,6 +382,7 @@ typedef int clockid_t;
+ #define CF_EXEC_EXPIREAFTER 1
+ 
+ #define MAXIP4CHARLEN 16
++#define PACK_UPIFELAPSED_SALT packageuplist
+ 
+ /***/
+ /*  DBM*/
+Index: cfengine-debian/src/promises.c
+===
+--- cfengine-debian.orig/src/promises.c
 cfengine-debian/src/promises.c
+@@ -776,7 +776,11 @@ md = EVP_get_digestbyname(FileHashName(t
+
+ EVP_DigestInit(context,md);
+ 
+-EVP_DigestUpdate(context,pp-promiser,strlen(pp-promiser));
++// multiple packages (promisers) may share same package_list_update_ifelapsed lock
++if(!(salt  (strncmp(salt, PACK_UPIFELAPSED_SALT, sizeof(PACK_UPIFELAPSED_SALT) - 1) == 0)))
++   {
++   EVP_DigestUpdate(context,pp-promiser,strlen(pp-promiser));
++   }
+ 
+ if (pp-ref)
+{
+Index: cfengine-debian/src/verify_packages.c
+===
+--- cfengine-debian.orig/src/verify_packages.c
 cfengine-debian/src/verify_packages.c
+@@ -59,7 +59,7 @@ PromiseBanner(pp);
+ 
+ if (a.packages.package_list_update_command)
+{
+-   snprintf(lockname,CF_BUFSIZE-1,package-%s-%s,pp-promiser,a.packages.package_list_update_command);
++   snprintf(lockname,CF_BUFSIZE-1,%s-%s,PACK_UPIFELAPSED_SALT,a.packages.package_list_update_command);
+ 
+al = a;
+
+@@ -73,9 +73,8 @@ if (a.packages.package_list_update_comma
+if (thislock.lock != NULL)
+   {
+   ExecPackageCommand(a.packages.package_list_update_command,false,al,pp);   
++  YieldCurrentLock(thislock);
+   }
+-   
+-   YieldCurrentLock(thislock);
+}
+ 
+ // Now verify the package itself
diff --git a/debian/patches/series b/debian/patches/series
index 6a99a2c..902d2e5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ remove-man-errors
 fhs-compliance
 fix-examples-paths
 fix-error-typos
+fix-bug-660860
-- 
1.7.7.6



Bug#660860: cfengine3: segfaults when triggering some locks

2012-04-02 Thread Antonio Radici
On Sun, Apr 01, 2012 at 09:16:06PM +0200, Jimmy Thrasibule wrote:
 Hi,
 
 What is the status of this bug? The given workaround doesn't work for me
 and I had to switch to the testing package.
 
 We will have a solution to use the stable package?

It seems that there is a patch, I'll try to apply that and send you a
test binary; in the meantime can you please provide us with the
coredump?

Cheers
Antonio



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#660860: cfengine3: segfaults when triggering some locks

2012-04-01 Thread Jimmy Thrasibule
Hi,

What is the status of this bug? The given workaround doesn't work for me
and I had to switch to the testing package.

We will have a solution to use the stable package?

--
Jimmy




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#660860: cfengine3: segfaults when triggering some locks

2012-02-22 Thread Petru Ratiu
Package: cfengine3
Version: 3.0.5+dfsg-1
Severity: normal

*** Please type your report below this line ***

Hello,

I recently began my cf3 deployment on a few Debian machines and I managed to
hit a case when having some locks present triggers a segmentation fault.

How to reproduce:
- get the COPBL library from
  http://source.cfengine.com/browse/copbl/trunk/cfengine_stdlib.cf and comment
  the cmd_repair body as it doesn't work with 3.0 (I used r110, just in case);
- use the following promises.cf:
 from here 
body common control {
bundlesequence = { debs };
inputs = { cfengine_stdlib.cf };
}

bundle agent debs {
packages:
  cfengine3
package_policy = add,
package_method = generic;
}
= to here =
- run cf-agent -I once, observe that it does run aptitude update properly;
- run cf-agent -I again, watch it segfault;
- run cf-agent -KI, it works.

Strace ends with:
 from here 
...
open(/var/lib/cfengine3/state/cf_lock.db, O_RDWR|O_CREAT, 0) = 3
fcntl(3, F_GETFD)   = 0
fcntl(3, F_SETFD, FD_CLOEXEC)   = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=8192, ...}) = 0
pread(3, \0\0\0\0\1\0\0\0\0\0\0\0b1\5\0\t\0\0\0\0\20\0\0\0\t\0\0\0\0\0\0...,
4096, 0) = 4096
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Segmentation fault
= to here =

I'll see if I can narrow it down further and reply to this bug.

-- System Information:
Debian Release: 6.0.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages cfengine3 depends on:
ii  libc6   2.11.3-3 Embedded GNU C Library: Shared lib
ii  libdb4.84.8.30-2 Berkeley v4.8 Database Libraries [
ii  libpcre38.02-1.1 Perl 5 Compatible Regular Expressi
ii  libssl0.9.8 0.9.8o-4squeeze7 SSL shared libraries

cfengine3 recommends no packages.

cfengine3 suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#660860: cfengine3: segfaults when triggering some locks

2012-02-22 Thread Petru Ratiu
After a bit more digging, I found the bug in upstream's bug tracker,
at: https://cfengine.com/bugtracker/bug_view_advanced_page.php?bug_id=163
, where they mention it was fixed in r1089, meaning this patch:
http://source.cfengine.com/websvn/comp.php?repname=Cfengine+corecompare[]=%2F@1088compare[]=%2F@1089

In the meantime, I found the following workaround: set
package_list_update_ifelapsed = 0 in the appropriate package_method
(with the downside that it'll run an aptitude update at any agent
run).

-- 
Petre.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org