bacula misses requirement of gawk

Bug #645082 reported by Fred Baumgarten on 2010-09-22
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
bacula (Ubuntu)
High
Serge Hallyn

Bug Description

Binary package hint: bacula-director-mysql

the awk script /etc/bacula/scripts/make_catalog_backup_awk fails due to the missing gensub function if gawk is not installed and used.

thanks for processing
Fred

Related branches

Changed in bacula (Ubuntu):
status: New → Confirmed
importance: Undecided → High
Serge Hallyn (serge-hallyn) wrote :

Thanks for reporting this bug and helping to make Ubuntu better.

Sure looks like you're right, I'll propose a trivial patch.

Changed in bacula (Ubuntu):
assignee: nobody → Serge Hallyn (serge-hallyn)
Serge Hallyn (serge-hallyn) wrote :
Serge Hallyn (serge-hallyn) wrote :

I've pushed the resulting package to ppa:serge-hallyn/bacula-gawk

Fred Baumgarten (dc6iq) wrote :

Is the fix really that simple ?

Actually make_catalog_backup_awk holds the first line:

#!/usr/bin/gawk -f

which is obviously correct. Durung the bacula call mawk got involved (it was a server installation). I guess the callee does a command like "awk -f /etc/bacula/scripts/make_catalog_backup_awk" which is even wrong if mawk has precendence over gawk by using /etc/alternatives/awk. I guess you need to inspect a bit deeper.

ah yes - i just took a look at bacula-dir.conf in /etc/bacula, there it is:

RunBeforeJob = "/usr/bin/awk -f /etc/bacula/scripts/make_catalog_backup_awk -v cat1=MyCatalog /etc/bacula/bacula-dir.conf"

there the /usr/bin/awk needs to be changed to /usr/bin/gawk as well.

greetings,
Fred

Quoting Fred Baumgarten (<email address hidden>):
> Is the fix really that simple ?
>
> Actually make_catalog_backup_awk holds the first line:
>
> #!/usr/bin/gawk -f
>
> which is obviously correct. Durung the bacula call mawk got involved (it
> was a server installation). I guess the callee does a command like "awk
> -f /etc/bacula/scripts/make_catalog_backup_awk" which is even wrong if
> mawk has precendence over gawk by using /etc/alternatives/awk. I guess
> you need to inspect a bit deeper.

I'm not convinced this matters. If mawk /etc/alternatives/awk points to
mawk, then mawk is installed. If mawk is not installed, then 'awk' will
run gawk, since we are depending on gawk being installed.

> there the /usr/bin/awk needs to be changed to /usr/bin/gawk as well.

Again, not convinced.

Changed in bacula (Ubuntu):
assignee: Serge Hallyn (serge-hallyn) → nobody
Fred Baumgarten (dc6iq) wrote :

Hi Serge !

I am pretty sure it matters. If gawk and mawk are installed the same time, the user has to decide what awk is the default. If he uses mawk as default via /etc/alternatives, /usr/bin/awk points to /etc/alternatives/awk which points to /usr/bin/mawk. If bacula depends on gawk (as quoted in the first line of /etc/bacula/scripts/make_catalog_backup_awk), RunBeforeJob = "/usr/bin/awk -f /etc/bacula/scripts/make_catalog_backup_awk -v cat1=MyCatalog /etc/bacula/bacula-dir.conf" will fail, because the statement in line number 1 is not read.

either way is possible:

RunBeforeJob = "/usr/bin/gawk -f /etc/bacula/scripts/make_catalog_backup_awk -v cat1=MyCatalog /etc/bacula/bacula-dir.conf"

which will use the correct awk, or

RunBeforeJob = "/etc/bacula/scripts/make_catalog_backup_awk -v cat1=MyCatalog /etc/bacula/bacula-dir.conf"

which will use the first line in the script to find the correct awk but requires the executable bit set which is not the case right now. Therefore the right fix would be adding the "g" in solution number 1.

Thanks for your work,

Fred

Dave Walker (davewalker) on 2011-10-09
Changed in bacula (Ubuntu):
milestone: none → precise-alpha-1
assignee: nobody → Serge Hallyn (serge-hallyn)
Serge Hallyn (serge-hallyn) wrote :

@Fred,

I'm sorry, I don't know what i was thinking with comments #3 and #5. I'll get a debdiff sponsored as soon as precise opens up, switching the awk call to gawk in bacula-dir.conf (in addition to adding gawk as a dependency as before).

Thanks for catching that.

Changed in bacula (Ubuntu):
status: Confirmed → In Progress
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bacula - 5.0.3-1ubuntu6

---------------
bacula (5.0.3-1ubuntu6) precise; urgency=low

  * Add needed gawk dependency (LP: #645082)
    - debian/control: add gawk to Depends for bacula-director-common.
    - debian/patches/ubuntu_bacula-dir.conf.patch: call
      make_catalog_backup_awk with gawk, as awk might refer to something
      other than gawk, but make_catalog_backup_awk is gawk-specific.
      (as pointed out by Fred Baumgarten)
 -- Serge Hallyn <email address hidden> Fri, 14 Oct 2011 12:00:42 -0500

Changed in bacula (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers