You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-dev@tcl.apache.org by "David N. Welton" <da...@dedasys.com> on 2002/03/23 20:26:22 UTC

ap_chdir_file(r->filename);

ap_chdir_file(r->filename);

Any good reason not to do perform this operation?  I think it makes
sense to be operating in the directory that the file is in.

I ask, because otherwise things like:

source [file join . websh.com.gen]

in index.ws3, become a bit problematic (or at least it seems that way
to me...).

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org


Re: ap_chdir_file(r->filename);

Posted by "David N. Welton" <da...@dedasys.com>.
Ronnie Brunner <ro...@netcetera.ch> writes:

> > > So we might have to provide these accessors already. How about
> > > some additions to web::config such as serverdir (Apache
> > > ServerRoot), documentroot (Apache DocumentRoot), pooldir
> > > (directory of current interppool), confdir (Apache WebshConfig)

> > > Does that make sense?

> > Yes... but... won't this introduce a split between mod_websh
> > powered app's and CGI apps?  I think the cwd should be where the
> > file is located, but I'm not sure how to work around the threading
> > problem, and am currently investigating.

> I wouldn't mind having websh just return an empty string in the CGI
> case for the unknown paths. Actually: some servers (e.g. Apache ;-)
> do put these paths into the CGI environment, so we could try to
> access them from the environment within websh3: DOCUMENT_ROOT,
> SERVER_ROOT, [file dirname $env(SCRIPT_FILENAME)] ...

Environmental variables aren't used elsewhere in WebSH, even when they
are made available through the server.  I don't think we should make
an exception just for this.

> Apopos investigating the threading stuff: how does Apache 2 handle
> CGI?

Sets it up and launches it... since it's a seperate process, it's not
as problematic.

> Per definition, the cwd of the cgi process is the directory in which
> the cgi resides.

Currently having a look to see what PHP does.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org


Re: ap_chdir_file(r->filename);

Posted by Ronnie Brunner <ro...@netcetera.ch>.
> > So we might have to provide these accessors already. How about some
> > additions to web::config such as serverdir (Apache ServerRoot),
> > documentroot (Apache DocumentRoot), pooldir (directory of current
> > interppool), confdir (Apache WebshConfig)
>  
> > Does that make sense?
> 
> Yes... but... won't this introduce a split between mod_websh powered
> app's and CGI apps?  I think the cwd should be where the file is
> located, but I'm not sure how to work around the threading problem,
> and am currently investigating.

I wouldn't mind having websh just return an empty string in the CGI
case for the unknown paths. Actually: some servers (e.g. Apache ;-) do
put these paths into the CGI environment, so we could try to access
them from the environment within websh3: DOCUMENT_ROOT, SERVER_ROOT,
[file dirname $env(SCRIPT_FILENAME)] ...

Apopos investigating the threading stuff: how does Apache 2 handle
CGI? Per definition, the cwd of the cgi process is the directory in
which the cgi resides.
------------------------------------------------------------------------
Ronnie Brunner                               ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich    phone +41 1 247 79 79 Fax: +41 1 247 70 75

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org


Re: ap_chdir_file(r->filename);

Posted by "David N. Welton" <da...@dedasys.com>.
Ronnie Brunner <ro...@netcetera.ch> writes:

> So we might have to provide these accessors already. How about some
> additions to web::config such as serverdir (Apache ServerRoot),
> documentroot (Apache DocumentRoot), pooldir (directory of current
> interppool), confdir (Apache WebshConfig)
 
> Does that make sense?

Yes... but... won't this introduce a split between mod_websh powered
app's and CGI apps?  I think the cwd should be where the file is
located, but I'm not sure how to work around the threading problem,
and am currently investigating.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org


Re: ap_chdir_file(r->filename);

Posted by Ronnie Brunner <ro...@netcetera.ch>.
> > > in index.ws3, become a bit problematic (or at least it seems that
> > > way to me...).
>  
> > For simplicity, we could provide some easy to use accessors to
> > different directories (like server root, document root, path to
> > current interp-pool source, or similar). But I wouldn't try to
> > include this in the current release: we wanna finish soon, right?
> 
> Sure.  So, my problem is that I don't want to use absolute paths,
> because I want to set the web site up on my machine, then check it
> into CVS, and check it out again on the actual web server, which has
> things in different paths.
> 
> Neither [info script] nor [pwd] are giving me the information I need.

So we might have to provide these accessors already. How about some
additions to web::config such as serverdir (Apache ServerRoot),
documentroot (Apache DocumentRoot), pooldir (directory of current
interppool), confdir (Apache WebshConfig)

Does that make sense?
------------------------------------------------------------------------
Ronnie Brunner                               ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich    phone +41 1 247 79 79 Fax: +41 1 247 70 75

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org


Re: ap_chdir_file(r->filename);

Posted by "David N. Welton" <da...@dedasys.com>.
Ronnie Brunner <ro...@netcetera.ch> writes:

> > in index.ws3, become a bit problematic (or at least it seems that
> > way to me...).
 
> For simplicity, we could provide some easy to use accessors to
> different directories (like server root, document root, path to
> current interp-pool source, or similar). But I wouldn't try to
> include this in the current release: we wanna finish soon, right?

Sure.  So, my problem is that I don't want to use absolute paths,
because I want to set the web site up on my machine, then check it
into CVS, and check it out again on the actual web server, which has
things in different paths.

Neither [info script] nor [pwd] are giving me the information I need.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org


Re: ap_chdir_file(r->filename);

Posted by Ronnie Brunner <ro...@netcetera.ch>.
> ap_chdir_file(r->filename);
> 
> Any good reason not to do perform this operation?  I think it makes
> sense to be operating in the directory that the file is in.

I don't think that this will work in Apache 2.0: changing the working
directory in a multi-threaded environment is not a good idea according
to my experience ;-)

> I ask, because otherwise things like:
> 
> source [file join . websh.com.gen]

In that respect, this is not a good thing to do anyway. Absolute paths
should be used.

> in index.ws3, become a bit problematic (or at least it seems that way
> to me...).

For simplicity, we could provide some easy to use accessors to
different directories (like server root, document root, path to current
interp-pool source, or similar). But I wouldn't try to include this in
the current release: we wanna finish soon, right?

------------------------------------------------------------------------
Ronnie Brunner                               ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich    phone +41 1 247 79 79 Fax: +41 1 247 70 75

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org