14.04 debdiff to fix this bug.

** Description changed:

+ [Impact] 
+  * daily cron job may fail with a bash "unbound variable" error
+  * the fix is small, low risk and easy to understand
+  * the fix is from Debian and included in vivid and simply initializes the 
affected variables. See the Original description (below) for details
+ 
+ [Test Case]
+  * the test case for NF_ADD requires: an aide setup with up to date database, 
downgrade/upgrade a package, then run the aide con job. Specifically:
+   1. $ sudo apt-get install aide
+   2. Update /etc/default/aide to have:
+     COPYNEWDB=yes
+     FILTERUPDATES=yes
+   3. $ sudo aideinit # takes a long time
+   4. $ sudo dpkg -i /path/to/some/different/version/of/installed/deb
+   5. $ sudo /etc/cron.daily/aide
+ 
+ [Regression Potential] 
+  * Regression potential is very low. It is a simple change to the  
/etc/cron.daily/aide shell script which only initializes a few variables that 
weren't initialized yet
+ 
+ Attached is a debdiff to fix this issue.
+ 
+ 
+ Original description:
+ 
  Ubuntu version: 14.04 LTS (server)
  AIDE version: 0.16~a2.git20130520-2
  
  EXPECTED RESULT
  ===============
  The daily cron job should excute properly, generating an email with the AIDE 
report for that day.
  
  ACTUALLY RESULT
  ==============
  The daily cron job fails with a bash "unbound variable" error.
-  
+ 
  DESCRIPTION
  ===============
  I recently upgraded a machine from Ubuntu Server 12.04 LTS to Ubuntu Server 
14.04 LTS.  After the upgrade I noticed that the AIDE cronjob was failing with 
this error:
  
  -----
  /etc/cron.daily/aide:
  /etc/cron.daily/aide: line 413: NF_ADD: unbound variable
  run-parts: /etc/cron.daily/aide exited with return code 1
  -----
  
  NF_ADD is explicity defined as an array, but on line 413 it would appear
  that a new element is trying to be added to the array based on the
  current count of the array:
  
  NF_ADD[${#NF_ADD[*]}]="$line"
  
  However, if the variable/array is empty, then referencing ${#NF_ADD[*]}
  produces an "unbound variable" error, and since line #3 of the script
  sets the -e option, bash will terminate executeion of the script upon
  encountering this error, meaning the AIDE cron.daily script fails to
  complete.
  
  The attached patch seems to have fixed the issue for me, though I really
  don't know if that is the correct fix, or if it might have other
  unintended consequences when run with different options or in a
  different environment.

** Patch added: "aide_0.16~a2.git20130520-2ubuntu0.1.debdiff"
   
https://bugs.launchpad.net/ubuntu/trusty/+source/aide/+bug/1323827/+attachment/4259252/+files/aide_0.16%7Ea2.git20130520-2ubuntu0.1.debdiff

** Changed in: aide (Ubuntu Trusty)
       Status: Triaged => In Progress

** Description changed:

- [Impact] 
-  * daily cron job may fail with a bash "unbound variable" error
-  * the fix is small, low risk and easy to understand
-  * the fix is from Debian and included in vivid and simply initializes the 
affected variables. See the Original description (below) for details
+ [Impact]
+  * daily cron job may fail with a bash "unbound variable" error
+  * the fix is small, low risk and easy to understand
+  * the fix is from Debian and included in vivid and simply initializes the 
affected variables. See the Original description (below) for details
  
  [Test Case]
-  * the test case for NF_ADD requires: an aide setup with up to date database, 
downgrade/upgrade a package, then run the aide con job. Specifically:
-   1. $ sudo apt-get install aide
-   2. Update /etc/default/aide to have:
-     COPYNEWDB=yes
-     FILTERUPDATES=yes
-   3. $ sudo aideinit # takes a long time
-   4. $ sudo dpkg -i /path/to/some/different/version/of/installed/deb
-   5. $ sudo /etc/cron.daily/aide
+  * the test case for NF_ADD requires: an aide setup with up to date database, 
downgrade/upgrade a package, then run the aide con job. Specifically:
+   1. $ sudo apt-get install aide
+   2. Update /etc/default/aide to have:
+     COPYNEWDB=yes
+     FILTERUPDATES=yes
+   3. $ sudo aideinit # takes a long time
+   4. $ sudo dpkg -i /path/to/some/different/version/of/installed/deb
+   5. $ sudo /etc/cron.daily/aide # takes a long time
  
- [Regression Potential] 
-  * Regression potential is very low. It is a simple change to the  
/etc/cron.daily/aide shell script which only initializes a few variables that 
weren't initialized yet
+ [Regression Potential]
+  * Regression potential is very low. It is a simple change to the  
/etc/cron.daily/aide shell script which only initializes a few variables that 
weren't initialized yet
  
  Attached is a debdiff to fix this issue.
- 
  
  Original description:
  
  Ubuntu version: 14.04 LTS (server)
  AIDE version: 0.16~a2.git20130520-2
  
  EXPECTED RESULT
  ===============
  The daily cron job should excute properly, generating an email with the AIDE 
report for that day.
  
  ACTUALLY RESULT
  ==============
  The daily cron job fails with a bash "unbound variable" error.
  
  DESCRIPTION
  ===============
  I recently upgraded a machine from Ubuntu Server 12.04 LTS to Ubuntu Server 
14.04 LTS.  After the upgrade I noticed that the AIDE cronjob was failing with 
this error:
  
  -----
  /etc/cron.daily/aide:
  /etc/cron.daily/aide: line 413: NF_ADD: unbound variable
  run-parts: /etc/cron.daily/aide exited with return code 1
  -----
  
  NF_ADD is explicity defined as an array, but on line 413 it would appear
  that a new element is trying to be added to the array based on the
  current count of the array:
  
  NF_ADD[${#NF_ADD[*]}]="$line"
  
  However, if the variable/array is empty, then referencing ${#NF_ADD[*]}
  produces an "unbound variable" error, and since line #3 of the script
  sets the -e option, bash will terminate executeion of the script upon
  encountering this error, meaning the AIDE cron.daily script fails to
  complete.
  
  The attached patch seems to have fixed the issue for me, though I really
  don't know if that is the correct fix, or if it might have other
  unintended consequences when run with different options or in a
  different environment.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1323827

Title:
  aide cronjob fails with bash unbound variable error

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/aide/+bug/1323827/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to