#619411 roundcube-core: program/include/iniset.php should not alter INSTALL_PATH constant

#619411#5
Date:
2011-03-23 16:43:00 UTC
From:
To:
Hi,

The INSTALL_PATH constant is hardcoded in program/include/iniset.php to the
default installation on Debian: /var/lib/roundcube. This does not allow us to
have multiple virtual hosts (with different DocumentRoot) for a single domain
(with two instances for desktop and mobile devices) or multiple domains.

Please do not modify the upstream file 'iniset.php'.

Thanks
--- /usr/share/roundcube/program/include/iniset.php_0.5.1+dfsg-7	2011-03-11 10:14:46.000000000 +0200
+++ /usr/share/roundcube/program/include/iniset.php	2011-03-23 15:25:09.000000000 +0200
@@ -42,7 +42,7 @@
 define('RCMAIL_START', microtime(true));

 if (!defined('INSTALL_PATH')) {
-    define('INSTALL_PATH', '/var/lib/roundcube/');
+    define('INSTALL_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/');
 }

 if (!defined('RCMAIL_CONFIG_DIR')) {

#619411#10
Date:
2011-03-23 17:06:18 UTC
From:
To:
OoO Lors  de la soirée naissante  du mercredi 23 mars  2011, vers 17:43,
Teodor <mteodor@gmail.com> disait :

The  modification   is  done  because   $_SERVER['SCRIPT_FILENAME']  may
dereference  symlinks  and  result  in /usr/share/roundcube  instead  of
/var/lib/roundcube.    Some   features    won't   work   then   (because
/usr/share/roundcube is not complete).

I don't quite  understand what you try to do. Do  you copy the roundcube
installation into another location?

#619411#15
Date:
2011-03-23 17:06:18 UTC
From:
To:
OoO Lors  de la soirée naissante  du mercredi 23 mars  2011, vers 17:43,
Teodor <mteodor@gmail.com> disait :

The  modification   is  done  because   $_SERVER['SCRIPT_FILENAME']  may
dereference  symlinks  and  result  in /usr/share/roundcube  instead  of
/var/lib/roundcube.    Some   features    won't   work   then   (because
/usr/share/roundcube is not complete).

I don't quite  understand what you try to do. Do  you copy the roundcube
installation into another location?

#619411#20
Date:
2011-03-24 05:19:11 UTC
From:
To:
Hi,

2011/3/23 Vincent Bernat <bernat@debian.org>:
'index2.php' with this content:
<?php
require_once 'program/include/iniset.php';
  echo $_SERVER['SCRIPT_FILENAME'];
  echo '<br>';
  echo INSTALL_PATH;
?>

The result is:
/var/lib/roundcube/index2.php
/var/lib/roundcube/

I'm using roundcube with the upstream 'iniset.php' with no problems.

I've cloned '/var/lib/roundcube' (with rsync) on a different directory
in /var/www for a new virtual host designed only for mobile devices
(smart phones). Afterwards I just changed a few symbolic links
(config/main.inc.php, logs) and added a new skin. But for this to work
I had to change the iniset.php to detect automatically INSTALL_PATH.

I hope this explains the setup. I don't want to duplicate roundcube
code if not really necessary.

Thanks

#619411#25
Date:
2011-03-24 06:27:26 UTC
From:
To:
OoO En  cette fin  de nuit blanche  du jeudi  24 mars 2011,  vers 06:19,
Teodor MICU <mteodor@gmail.com> disait :

SCRIPT_FILENAME may be  set by a lot of components. It  is set by Apache
if you use  mod_php, set by PHP if  you use FPM, etc. I did  not find an
authoritative  source if  SCRIPT_FILENAME  should or  should not  follow
symlinks. I don't remember why we  created this patch but I suppose this
was a useful once.

Romain, did you remember why you put this patch?

This is a very particular setup.  I would like not to break other setups
by removing the patch.

#619411#30
Date:
2011-03-24 08:47:16 UTC
From:
To:
2011/3/24 Vincent Bernat <bernat@debian.org>:

Look, this is quite simple. Roundcube upstream is using it and Debian
has modified it to a hardcoded value that is not necessary. I've
proven that it works either way.

That would be good to know, but the above point remains valid.

I've proved that nothing gets broken. Also, the setup you put in place
in roundcube Debian packages is even suitable to support multiple
roundcube virtual hosts since all the content from
/usr/share/roundcube is linked in /var/lib/roundcube. If
/var/lib/roundcube did not exist at all the /roundcube was set to
/usr/share/roundcube than anyone who would like to setup a virtual
host will create a directory with what is now in /var/lib/roundcube.
It's just a flexible way to add/remove plugins, skins or set a custom
main.inc.php. The alternative is just a burden to maintain different
copies of roundcube.

Thanks

#619411#35
Date:
2011-03-24 18:21:48 UTC
From:
To:
OoO  En cette matinée  ensoleillée du  jeudi 24  mars 2011,  vers 09:47,
Teodor MICU <mteodor@gmail.com> disait :

Upstream does not use symlinks.  You have only proven that removing your
patch works in your case. SCRIPT_FILENAME variable may be set by various
softwares. As I said, if you  use mod_php, this is Apache that sets this
variable. If  you use PHP FPM, this  is PHP that sets  this variable. If
you   use  lighttpd   fastcgi,  this   is  lighttpd   which   sets  this
variable. Each of those may  set SCRIPT_FILENAME differently and some of
them may follow symlinks.