aide cronjob fails with bash unbound variable error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
aide (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Trusty |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[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
FILTERUPDAT
3. $ sudo aideinit # takes a long time
4. $ sudo dpkg -i /path/to/
5. $ sudo /etc/cron.
'5' also takes a while, but will eventually fail with:
/etc/cron.
[Regression Potential]
* Regression potential is very low. It is a simple change to the /etc/cron.
Attached is a debdiff to fix this issue.
Original description:
Ubuntu version: 14.04 LTS (server)
AIDE version: 0.16~a2.
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.
/etc/cron.
run-parts: /etc/cron.
-----
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[
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.
Changed in aide (Ubuntu Trusty): | |
status: | New → Triaged |
The attachment "aide.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.
[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]