installer permissions check bug

Found a bug? Tell us!!
Post Reply
wagwag
Regular
Posts: 29
Joined: Fri Jun 16, 2006 7:56 am

installer permissions check bug

Post 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/') ) {
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: installer permissions check bug

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
wagwag
Regular
Posts: 29
Joined: Fri Jun 16, 2006 7:56 am

Post by wagwag »

I tested 1.0.4 and s9y_200612062342 nightly snapshot and they both had this problem.
wagwag
Regular
Posts: 29
Joined: Fri Jun 16, 2006 7:56 am

Post 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/') ) {
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply