Hi,

I came up with one solution about the problem I mailed.
I downloaded latest source code
http://www.fossil-scm.org/fossil/vinfo?name=64096c726997b1c00f4861398e49ed112afa43c2
, apply the change below and that works well.
Therefore, I'll mail drh [at] sqlite org with the patch below attached.

Idea
=====
  Instead of checking writable permission of home directory,
  only if  configuration file is not exist &&  home directory is not
writable,
  show fatal message.

Solution candidate
=====
rewrite l.835-l.839 of db.c
http://fossil-scm.org/index.html/artifact/514eeeeff48b8180bbfd20aceef4278e12af12c4?ln=835-839

--- src/db.c 2014-01-23 03:32:05.000000000 +0900
+++ src/db.c 2014-01-23 05:31:21.891744040 +0900
@@ -833,10 +833,12 @@
   /* . filenames give some window systems problems and many apps problems
*/
   zDbName = mprintf("%//_fossil", zHome);
 #else
-  if( file_access(zHome, W_OK) ){
+  zDbName = mprintf("%s/.fossil", zHome);
+  if( file_size(zDbName)<1024*3 && file_access(zHome, W_OK) ){
     fossil_fatal("home directory %s must be writeable", zHome);
+  }else if( file_access(zDbName, W_OK) ){
+    fossil_fatal("configuration file %s must be writeable", zDbName);
   }
-  zDbName = mprintf("%s/.fossil", zHome);
 #endif
   if( file_size(zDbName)<1024*3 ){
     db_init_database(zDbName, zConfigSchema, (char*)0);

Further suggestion
=====
- add documentation about making environment variable available for cgi.

``` .htaccess in the same directory as fossil cgi exists
RewriteEngine On
RewriteRule .* - [E=HOME:/home/yourname]
```
- add `delete .fossil (or _fossil) in your home directory` to uninstall
procedure like
http://www.fossil-scm.org/xfer/doc/tip/www/build.wiki

Sincerely,
Akihiro Kameda

On Wed, Jan 22, 2014 at 2:40 PM, KAMEDA, Akihiro <[email protected]> wrote:

> Hi,
>
> Referring http://www.fossil-scm.org/index.html/doc/tip/www/selfhost.wiki,
> I set up cgi page for a fossil repository.
> But setting  (/setup_settings) and timeline (/timeline) page returned the
> error below.
>
> "cannot locate home directory - please set the HOME environment variable"
>
> So, I checked 2 things:
> `echo $HOME` returned my home directory, but cgi using getenv("HOME")
> returned `null`.  (db.c
> http://www.fossil-scm.org/fossil/artifact/514eeeeff48b8180bbfd20aceef4278e12af12c4uses
> getenv("HOME"))
>
> And. I added 2 lines below to .htaccess in the same directory as fossil
> cgi exists for adding the environmental variable.
>
> RewriteEngine On
> RewriteRule .* - [E=HOME:/home/myname/fossil_setting]
>
> Additionally, I set the permission of that directory 777 because fossil
> required writable permission.
> Fortunately, this solved the problem superficially.
>
> However, I'm afraid that the .fossil setting is stored in $HOME directory
> when I use console and
> another.fossil setting is stored in the directory set above when I use CGI
> UI.
> That means global settings are duplicated and not shared between two
> environments.
> On the other hand, setting the same directory as $HOME in .htaccess and
> setting permission of $HOME directory 777 is undesirable.
>
> I couldn't find explanation about this problem in fossil documentation.
> Is there any correct way to set "HOME" environmental variable?
>
> Fossil version: 1.27 (Latest Stable 2013-09-11 11:43:49)
> Server version: Apache/2.2.22 (Ubuntu)
> OS: Ubuntu 12.04.2 Server LTS
>
> Sincerely,
> Akihiro Kameda
>
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to