daily cron script fails with "onexit: command not found"

Bug #109268 reported by Neal Stephenson
14
Affects Status Importance Assigned to Milestone
aide (Debian)
Fix Released
Unknown
aide (Ubuntu)
Fix Released
Undecided
Unassigned
Feisty
Won't Fix
Undecided
Jean-Baptiste Lallement

Bug Description

Binary package hint: aide

install aide on feisty and run /etc/cron.daily/aide
produces the following:
/etc/cron.daily/aide: line 117: onexit: command not found
/etc/cron.daily/aide: line 61: onexit: command not found

Revision history for this message
Christian Andretzky (christian-andretzky-mb) wrote :

I can confirm this. The reason is that /etc/cron.daily/aide has a -u switch set and the shell functions and variable definitions inside are not in the right order. I'll send a version of /etc/cron.daily/aide which works for me in a separate comment from home.

Revision history for this message
Christian Andretzky (christian-andretzky) wrote :

Here the corrrected /etc/cron.daily/aide file

Revision history for this message
Thomas Templin (coastgnu) wrote :

There is a small bug in your file I suppose.
See also bug no #114730 "/var/run/aide/ missing"

The problem is in /etc/cron.daily/aide after line 39
 TMPBASE="/var/run/aide"
add:
       if [ ! -d $TMPBASE ] ; then
               # TMPBASE does not exist, create it
               mkdir $TMPBASE;
       fi

Revision history for this message
Daniel Holbach (dholbach) wrote :

To get your fix included in Ubuntu, try transforming it into a debdiff (http://wiki.ubuntu.com/PackagingGuide/Recipes/Debdiff) and submitting it for review (http://wiki.ubuntu.com/SponsorshipProcess).

Setting to 'incomplete' for now.

Changed in aide:
status: New → Incomplete
Revision history for this message
Daniel Holbach (dholbach) wrote :

Setting to In Progress.

Changed in aide:
status: Incomplete → In Progress
Revision history for this message
Torsten Krah (tkrah) wrote :

The TMPBASE not exists bug is still valid and no fix released - i cant believe that its so hard to get these 4 lines into the packet.
Looking at #114730 it should already be fixed, but looking at the latest release its not.

Revision history for this message
Torsten Krah (tkrah) wrote :

Patch attached.

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

A debdiff to fix the TMPBASE issue has been submitted in bug #114730 . How is this related the bug reported here ?

The bug described here has been solved in 0.13.1-3 according to debian bug #406206 when the cron job has been refactored.

To summarize Feisty need an upgrade, this is solved in newer releases of Ubuntu, and Dapper version is too old to be affected.

Thanks for your time.

Changed in aide:
status: In Progress → Fix Released
Changed in aide:
status: Unknown → Fix Released
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

SRU: Patch against feisty.

The fix is from debian 0.13.1-3
This is not a small patch because the cron job has been refactored after 0.13.1-2. The order of the function declarations and calls has been changed, there is now a return code and error handling has been improved.

The patch is rather safe, it affects an application rather than critical infrastructure packages, and the bug avoids aide to run correctly.

Revision history for this message
Martin Pitt (pitti) wrote :

Jean-Baptiste, this is a huge patch and might possibly introduce other regressions. Isn't there a much less intrusive way to fix this "onexit" issue?

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

I'll see how to do it. I'll try to send you a smaller patch this week.

Changed in aide:
assignee: nobody → jibel
status: New → In Progress
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Here is a much smaller change. I've moved the calls to onexit after the declaration.

The script is still very buggy but this is not a big deal because the error occurs only when the script fails to create the tmp dir. Solving all of this is too much work for a SRU and regarding the low importance of that issue. BTW all of this has been solved in Gutsy.

Revision history for this message
Martin Pitt (pitti) wrote :

Jean-Baptiste, thanks, that looks muuuch better! One question, why did you swap the order of the two code blocks? Now, if no db exists, you abort after you already created the lock file, which wasn't the case before. That should be the same order as before, just to avoid introducing any new bug, right?

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Sorry for the delay :/ You're right. This time the bug has occurred between the chair and the keyboard.
Here is patch with the correct order.

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Closing feisty task as won't fix because it has reach eol.

Changed in aide:
status: In Progress → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.