Can't exec "id" errors from pg_maintenance after upgrading to 87ubuntu1

Bug #422189 reported by James Troup
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
postgresql-common (Ubuntu)
Invalid
Medium
Martin Pitt
Hardy
Fix Released
High
Martin Pitt

Bug Description

Binary package hint: postgresql-common

After upgrading to 87ubuntu1 on our servers, I'm getting the following cron spam, presumably because $PATH is not set in cron and the script doesn't use the full path to the binary.

| From: <email address hidden> (Cron Daemon)
| Subject: Cron <root@druzhnaya> if [ -x /usr/sbin/pg_maintenance ]; then /usr/sbin/pg_maintenance --analyze >/dev/null; fi
| To: <email address hidden>
| X-Sent: 12 minutes ago
|
| Can't exec "id": No such file or directory at /usr/share/postgresql-common/PgCommon.pm line 651.
| Use of uninitialized value in concatenation (.) or string at /usr/share/postgresql-common/PgCommon.pm line 651.

Revision history for this message
Steve Langasek (vorlon) wrote :

12:20 < slangasek> elmo: <blink> is /usr/bin not in the path?
12:20 < elmo> slangasek: not in a cron job, no
12:21 < slangasek> hrm
12:21 < elmo> not unless the cron file goes to the trouble of setting $PATH
12:21 < elmo> /etc/crontab sets PATH, but postgresql-common is in /etc/cron.d

Changed in postgresql-common (Ubuntu Hardy):
importance: Undecided → High
status: New → Triaged
tags: added: regression-update
Revision history for this message
Martin Pitt (pitti) wrote :

Hm, this exact change has been in intrepid onwards without such reports, and $PATH in cron.d defaults to "/usr/bin:/bin" in Lenny and Karmic, so I don't think this changed just recently. Is that default $PATH change a local customization on your servers?

Anyway, easy enough to fix, I was just wondering about the scope of this.

Thanks for your report!

Changed in postgresql-common (Ubuntu Hardy):
assignee: nobody → Martin Pitt (pitti)
status: Triaged → In Progress
Changed in postgresql-common (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
James Troup (elmo) wrote : Re: [Bug 422189] Re: Can't exec "id" errors from pg_maintenance after upgrading to 87ubuntu1

Martin Pitt <email address hidden> writes:

> Hm, this exact change has been in intrepid onwards without such
> reports, and $PATH in cron.d defaults to "/usr/bin:/bin" in Lenny and
> Karmic, so I don't think this changed just recently. Is that default
> $PATH change a local customization on your servers?

So my babble about $PATH and cron was clearly rubbish, sorry. However,
the following might be more relevant:

james@druzhnaya:/etc/cron.d$ grep PATH /usr/sbin/pg_maintenance -B1
# untaint environment
$ENV{'PATH'} = '';

?

--
James

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

Argh, this was a regression from:

revno: 758
committer: Martin Pitt <email address hidden>
branch nick: postgresql-common
timestamp: Sun 2007-05-20 13:36:59 +0200
message:
  * pg_createcluster, pg_ctlcluster, pg_dropcluster, pg_maintenance,
    pg_upgradecluster: Strip down PATH untainting to the absolute minimum, to
    not fall over if e. g. /usr/local/bin is misconfigured to be world
    writable. Closes: #420565

Odd, that's two years old, and nobody noticed so far, thanks for pointing out.

This is not an issue any more in Ubuntu 9.04 and 9.10, since the cron job and pg_maintenance are completely gone (thanks to the internal autovacuum in PostgreSQL 8.3 and onward).

Changed in postgresql-common (Ubuntu):
status: In Progress → Invalid
Revision history for this message
Martin Pitt (pitti) wrote :

Straightforward debdiff to fix this, I tested this now.

Uploaded to the queue, needs Steve or Colin to process.

Changed in postgresql-common (Ubuntu Hardy):
status: In Progress → Fix Committed
Revision history for this message
Colin Watson (cjwatson) wrote :

Accepted into hardy-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Revision history for this message
Nafallo Bjälevik (nafallo) wrote :

Haven't got a cronspam since I updated the packages this morning. +1

Martin Pitt (pitti)
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package postgresql-common - 87ubuntu2

---------------
postgresql-common (87ubuntu2) hardy-proposed; urgency=low

  * pg_maintenance: Fix $PATH to include /usr/bin, so that the cron job can
    run the "id" command. (LP: #422189)

 -- Martin Pitt <email address hidden> Tue, 01 Sep 2009 12:10:15 +0200

Changed in postgresql-common (Ubuntu Hardy):
status: Fix Committed → Fix Released
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.