hosting_queues_cron_cmd() assumes that BASH is installed and available at /bin/bash. This is also true on most mainstream Linux distributions, but not all, and certainly not true on BSD-based systems (where, if installed, BASH is available at /usr/local/bin/bash).

So, is there any reason that we need BASH for this? Wouldn't /bin/sh do the job just as well (/bin/sh is guaranteed to be available on all Unix-based systems)?

Why do we even set the SHELL variable in the crontab? It's commonly set at the top of /etc/crontab system wide, and does not need to be set in each user’s crontab.

The code in question:

function hosting_queues_cron_cmd() {
  $command = _hosting_dispatch_cmd();
  $return = <<<END
SHELL=/bin/bash
PATH=$_SERVER[PATH]
*/1 * * * * $command
END;
  return $ret
CommentFileSizeAuthor
#2 change-bash.patch366 byteschertzog
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

anarcat’s picture

The reason why the shell is defined there is that some retard systems (*cough*Solaris*cough*) needed this for the crontab to work properly. Since we didn't want to have templates for crontabs, we just hardcoded this.

*Maybe* this could work with only /bin/sh. I think that would be fair and a better default, in any case.

chertzog’s picture

Version: 6.x-0.3-rc4 » 6.x-2.x-dev
Status: Active » Needs review
FileSize
366 bytes

Here is a patch. I tested this on the 7.x-3.x branch, with aegir-up and everything installed ok. It should probably be ok on 6.x-2.x as well.

anarcat’s picture

Status: Needs review » Fixed

good enough for me!

anarcat’s picture

actually, we'd need to test this on solaris to make sure, but really - i don't think it's okay to assume /bin/bash exists... so solaris will have to fix their shit in another way if /bin/sh is a problem there.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 7630538 on 7.x-3.x, dev-helmo-3.x authored by chertzog, committed by anarcat:
    Issue #1387578 by chertzog: Fixed hosting_queues_cron_cmd() makes...
  • Commit 9a62231 on 6.x-2.x, 7.x-3.x, dev-sni, dev-helmo-3.x authored by chertzog, committed by anarcat:
    Issue #1387578 by chertzog: Fixed hosting_queues_cron_cmd() makes...

  • Commit 7630538 on 7.x-3.x, dev-helmo-3.x authored by chertzog, committed by anarcat:
    Issue #1387578 by chertzog: Fixed hosting_queues_cron_cmd() makes...
  • Commit 9a62231 on 6.x-2.x, 7.x-3.x, dev-sni, dev-helmo-3.x authored by chertzog, committed by anarcat:
    Issue #1387578 by chertzog: Fixed hosting_queues_cron_cmd() makes...