Tags: patch

Here is a debdiff with modified debian/patches/fhs-compliance on top
of git commit 826a741f45aa0617336583bd5c2d01db2ad994b1.
The fix works for me. Please consider including it into next versions.
diff -Nru cfengine3-3.1.5/debian/changelog cfengine3-3.1.5/debian/changelog
--- cfengine3-3.1.5/debian/changelog	2011-05-10 20:24:19.000000000 +0600
+++ cfengine3-3.1.5/debian/changelog	2011-05-14 10:45:14.000000000 +0600
@@ -1,3 +1,10 @@
+cfengine3 (3.1.5-1+fix626280) natty; urgency=low
+
+  * debian/patches/fhs-compliance: do not try to be FHS compilant when
+    running as non-root user (Closes: 626280)
+
+ -- Andrey Bondarenko <abondare...@users.sourceforge.net>  Sat, 14 May 2011 10:40:52 +0600
+
 cfengine3 (3.1.5-1) unstable; urgency=low
 
   * New upstream release
diff -Nru cfengine3-3.1.5/debian/patches/fhs-compliance cfengine3-3.1.5/debian/patches/fhs-compliance
--- cfengine3-3.1.5/debian/patches/fhs-compliance	2011-05-10 20:24:19.000000000 +0600
+++ cfengine3-3.1.5/debian/patches/fhs-compliance	2011-05-14 10:56:41.000000000 +0600
@@ -6,10 +6,10 @@
 That symlink is created by debian/links but we need to remove the
 actual creation of the inputs dir any cf-* binary will fail
 
-Index: cfengine3/src/generic_agent.c
+Index: sid-my/src/generic_agent.c
 ===================================================================
---- cfengine3.orig/src/generic_agent.c	2011-05-06 22:24:14.000000000 +0000
-+++ cfengine3/src/generic_agent.c	2011-05-06 22:24:25.000000000 +0000
+--- sid-my.orig/src/generic_agent.c	2011-05-14 10:46:15.000000000 +0600
++++ sid-my/src/generic_agent.c	2011-05-14 10:55:23.000000000 +0600
 @@ -490,7 +490,6 @@
     CfOut(cf_verbose,"","Work directory is %s\n",CFWORKDIR);
  
@@ -18,69 +18,66 @@
     snprintf(vbuff,CF_BUFSIZE,"%s%cinputs%cupdate.conf",CFWORKDIR,FILE_SEPARATOR,FILE_SEPARATOR);
     MakeParentDirectory(vbuff,force);
     snprintf(vbuff,CF_BUFSIZE,"%s%cbin%ccf-agent -D from_cfexecd",CFWORKDIR,FILE_SEPARATOR,FILE_SEPARATOR);
-@@ -1211,7 +1210,7 @@
+@@ -1211,7 +1210,9 @@
     }
  else
     {
 -   snprintf(LOGFILE,CF_BUFSIZE,"%s%ccfagent.%s.log",CFWORKDIR,FILE_SEPARATOR,VSYSNAME.nodename);
-+   snprintf(LOGFILE,CF_BUFSIZE,"/var/log/cfagent.%s.log",VSYSNAME.nodename);
++   snprintf(LOGFILE,CF_BUFSIZE,"%s%ccfagent.%s.log",
++            (getuid() > 0) ? CFWORKDIR : "/var/log",
++            FILE_SEPARATOR,VSYSNAME.nodename);
     VSETUIDLOG = strdup(LOGFILE);
     }
  
-@@ -1762,7 +1761,7 @@
+@@ -1762,7 +1763,9 @@
  
  { FILE *fp;
  
 -snprintf(PIDFILE,CF_BUFSIZE-1,"%s%c%s",CFWORKDIR,FILE_SEPARATOR,filename);
-+snprintf(PIDFILE,CF_BUFSIZE-1,"/var/run/%s",filename);
++snprintf(PIDFILE,CF_BUFSIZE-1,"%s%c%s",
++         (getuid() > 0) ? CFWORKDIR : "/var/run",
++         FILE_SEPARATOR,filename);
  
  if ((fp = fopen(PIDFILE,"w")) == NULL)
     {
-Index: cfengine3/src/agent.c
+Index: sid-my/src/agent.c
 ===================================================================
---- cfengine3.orig/src/agent.c	2011-05-06 22:12:42.000000000 +0000
-+++ cfengine3/src/agent.c	2011-05-06 22:24:25.000000000 +0000
-@@ -338,7 +338,7 @@
+--- sid-my.orig/src/agent.c	2011-05-14 10:32:16.000000000 +0600
++++ sid-my/src/agent.c	2011-05-14 10:48:45.000000000 +0600
+@@ -338,7 +338,8 @@
    status which we need for setting returns
  */
  
 -snprintf(filename,CF_BUFSIZE,"%s/cfagent.%s.log",CFWORKDIR,VSYSNAME.nodename);
-+snprintf(filename,CF_BUFSIZE,"/var/log/cfagent.%s.log",VSYSNAME.nodename);
++snprintf(filename,CF_BUFSIZE,"%s/cfagent.%s.log",
++         (getuid() > 0) ? CFWORKDIR : "/var/log",VSYSNAME.nodename);
  MapName(filename);
  
  if ((fp = fopen(filename,"a")) != NULL)
-Index: cfengine3/src/files_interfaces.c
+Index: sid-my/src/files_interfaces.c
 ===================================================================
---- cfengine3.orig/src/files_interfaces.c	2011-05-06 22:12:42.000000000 +0000
-+++ cfengine3/src/files_interfaces.c	2011-05-06 22:24:25.000000000 +0000
-@@ -1344,7 +1344,7 @@
+--- sid-my.orig/src/files_interfaces.c	2011-05-14 10:32:16.000000000 +0600
++++ sid-my/src/files_interfaces.c	2011-05-14 10:48:45.000000000 +0600
+@@ -1344,7 +1344,8 @@
  b.edits.backup = cfa_nobackup;
  b.edits.maxfilesize = 1000000;
  
 -snprintf(filename,CF_BUFSIZE,"%s/cfagent.%s.log",CFWORKDIR,VSYSNAME.nodename);
-+snprintf(filename,CF_BUFSIZE,"/var/log/cfagent.%s.log",VSYSNAME.nodename);
++snprintf(filename,CF_BUFSIZE,"%s/cfagent.%s.log",
++         (getuid() > 0) ? CFWORKDIR : "/var/log",VSYSNAME.nodename);
  MapName(filename);
  
  if (!LoadFileAsItemList(&VSETUIDLIST,filename,b,pp))
-@@ -1364,7 +1364,7 @@
- b.edits.backup = cfa_nobackup;
- b.edits.maxfilesize = 1000000;
- 
--snprintf(filename,CF_BUFSIZE,"%s/cfagent.%s.log",CFWORKDIR,VSYSNAME.nodename);
-+snprintf(filename,CF_BUFSIZE,"/var/log/cfagent.%s.log",VSYSNAME.nodename);
- MapName(filename);
- 
- PurgeItemList(&VSETUIDLIST,"SETUID/SETGID");
-Index: cfengine3/src/transaction.c
+Index: sid-my/src/transaction.c
 ===================================================================
---- cfengine3.orig/src/transaction.c	2011-05-06 22:12:42.000000000 +0000
-+++ cfengine3/src/transaction.c	2011-05-06 22:24:25.000000000 +0000
+--- sid-my.orig/src/transaction.c	2011-05-14 10:32:16.000000000 +0600
++++ sid-my/src/transaction.c	2011-05-14 10:48:45.000000000 +0600
 @@ -158,7 +158,7 @@
     sum = (CF_MACROALPHABET * sum + cc_operand[i]) % CF_HASHTABLESIZE;
     }
  
 -snprintf(cflog,CF_BUFSIZE,"%s/cf3.%.40s.runlog",CFWORKDIR,host);
-+snprintf(cflog,CF_BUFSIZE,"/var/log/cf3.%.40s.runlog",host);
++snprintf(cflog,CF_BUFSIZE,"%s/cf3.%.40s.runlog",(getuid() > 0) ? CFWORKDIR : "/var/log",host);
  snprintf(cflock,CF_BUFSIZE,"lock.%.100s.%s.%.100s_%d_%s",pp->bundle,cc_operator,cc_operand,sum,str_digest);
  snprintf(cflast,CF_BUFSIZE,"last.%.100s.%s.%.100s_%d_%s",pp->bundle,cc_operator,cc_operand,sum,str_digest);
  

Reply via email to