The new compass binary support should be fixed using the correct binary path.
If compass is not available on a system path, the command will not be executed.

exec("compass version", $out, $rvalue);

A simple solution would be to add the compass path on sasson settings in order to allow custom settings.

Many thanks :-)

Comments

tsi’s picture

Interesting.
If we expose a "path to compass" field how should that be used in our code ?
How many people would actually use that ?
Any links for further reading ?
Thank you

FiNeX’s picture

Well, if "path to compass" has been set it should be used in place of the default value:

// Assuming we've stored the compass path on $settings_compass_path
if ($settings_compass_path){
  exec($setting_compass_path." version", $out, $rvalue);
else {
  exec("compass version", $out, $rvalue);
}

On my specific case I'm using Debian 6 and compass is not available on default repository. You've to install using gem. If your're using bash you've to manually set the gem path like:

PATH=$PATH:/var/lib/gems/1.8/

But the owner of php/httpd process doesn't know that path.

We have two solutions:

  1. set the PATH directly to the system user which own php/httpd and leave sasson to call "compass" assuming that the server knows where to find it
  2. allow sasson to manually set the compass path

About your question "how many people would actually use that"... well... probably few because compass (and sasson) are not so common, but those few could be use Debian or even CentOS (another common web server which doesn't ship compass packages) and I believe that configuring compass PATH to php/httpd system user is worse than setting it to the sasson settings.

What do you think about?

Thanks for your attention :-)

tsi’s picture

Category: bug » feature

I don't actually understand the problem. I'm not a linux guru but I do use it (ubuntu) daily on all of my machines, I, too installed the gem and compiling without issues.
Anyway, I think our best solution will be to set the path via code, without cluttering the UI, any thoughts on how this should be done ?
I think something like:
variable_set('path_to_compass', 'path/to/compass');
Should be "themer friendly" enough, no?
We should also consider security issues since this is going straight to the exec() function.

FiNeX’s picture

Well, it should be good solution. If compass is available on the known paths everything works fine, otherwise the theme developer can change the value from a "settings" file. Not bad, it only needs to be clearly documented.

2 cents about security: setting the path from the configuration file is just a bi more secure than setting the variable from the UI because I suppose that the user who can set that variable from the UI probably have enough privileges to damage the entire website :-) :-) :-)

Anyway every solution is fine, the most important thing is to document it.

Thanks again Tsachi :-)

tsi’s picture

Pushed a fix.
You can now use:
variable_set('sasson_compass_path', 'path/to/compass');
To set a path to the compass binary.
I guess you can put it anywhere in your sub-theme's template.php
Please help testing this.

mxmilkiib’s picture

That worked for me, thanks!

I'd set the correct $PATH for the httpd user, which could run compass anywhere in bash and sh, and had restarted nginx, but dpm($rvalue) said 126 (unexecutable). I updated Sasson, added subtheme template.php variable_set('sasson_compass_path', '/var/lib/gems/1.8/bin/compass');, and things started working.

tsi’s picture

Status: Active » Fixed

Great, Thanks!

Status: Fixed » Closed (fixed)

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

  • Commit 08a4452 on 7.x-3.x, PHPSass, 7.x-3.x-Assetic, 7.x-3.x-susy by tsi:
    issue #1740104 by FiNeX - Compass binary not found (the path should be...