Page 1 of 1

installer permissions check bug

Posted: Fri Dec 08, 2006 11:37 am
by wagwag
I noticed when I was installing serendipity recently that the installer told me my permissions all looked good, and then failed when trying to write the config after the next page because it could not write to 'uploads/'

I discovered that the permissions were set correctly on the basedir, but not on the contained directories (specifically template_c and upload). The installer assumes that if the child directories fail is_writable(), then they must not exist and everything will be ok as long as basedir is writable; which is obviously a bad assumption.

I suggest these changes to include/admin/installer.inc.php: (change applied to ver 1.0.4)

Code: Select all

363c363
<                 if ($basewritable) {
---
>                 if ($basewritable  && !is_dir($basedir . PATH_SMARTY_COMPILE) ) {
379c379
<                 if ($basewritable) {
---
>                 if ($basewritable && !is_dir($basedir .'archives/') ) {
397c397
<                 if ($basewritable) {
---
>                 if ($basewritable && !is_dir($basedir .'uploads/') ) {

Re: installer permissions check bug

Posted: Fri Dec 08, 2006 2:46 pm
by garvinhicking
Hi!

Thanks for looking into this, but have you tried to use the 1.1-beta installer? It has changed in that regard and should behave differently (hopefully correctly, but I didn't code the change and did not try it out fully yet)

Best regards,
Garvin

Posted: Fri Dec 08, 2006 8:19 pm
by wagwag
I tested 1.0.4 and s9y_200612062342 nightly snapshot and they both had this problem.

Posted: Mon Dec 11, 2006 7:44 am
by wagwag
I've noticed the installer script also does not check whether the plugins directory is writable, which makes spartacus unusable since it cannot download plugins. I think it makes sense to check this directory as well at install, so if the user has to fix any permissions, they can do it all at once rather than discovering more problems later.

Here is the change to fix the perm. check on templates_c/, archives/, uploads/, and adding a check for plugins/. This is applied to the 2006-12-10 nightly snapshot.

Code: Select all

363c363
<                 if ($basewritable) {
---
>                 if ( $basewritable && !is_dir($basedir . PATH_SMARTY_COMPILE) ) {
379c379,395
<                 if ($basewritable) {
---
>                 if ( $basewritable && !is_dir($basedir . 'archives/') ) {
>                     echo serendipity_installerResultDiagnose(S9Y_I_SUCCESS, WRITABLE);
>                     #This directory will be created later in the process
>                 } else {
>                     echo serendipity_installerResultDiagnose(S9Y_I_ERROR, NOT_WRITABLE);
>                     $showWritableNote = true;
>                 }
>             }
>      ?></td>
>     </tr>
>     <tr>
>         <td><?php echo $basedir . 'plugins/'?></td>
>         <td width="200"><?php
>             if ( is_writable($basedir . 'plugins/') ) {
>                 echo serendipity_installerResultDiagnose(S9Y_I_SUCCESS, WRITABLE);
>             } else {
>                 if ( $basewritable && !is_dir($basedir . 'plugins/') ) {
396c412
<                 if ($basewritable) {
---
>                 if ( $basewritable && !is_dir($basedir . 'uploads/') ) {

Posted: Mon Dec 11, 2006 9:38 am
by garvinhicking
Hi!

Ah, after a weekend of regeneration I understand the error you reported. Sorry for not getting it in first place.

Of course that makes sense, so I submitted your patch!

About the "plugins" directory however, I do not want to make that mandatory on installations. People might not want to use spartacus, so I think it should be valid to not have write permission on the plugins directory. Maybe in the future of serendipity, when spartacus has less problems with safe_mode and network outage, we can submit that patch as well?

Thanks a lot for your help,
Garvin