ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Feature Request: Set Output Directory
@ 2014-01-13  3:24 Thangalin
  2014-01-15 10:00 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Thangalin @ 2014-01-13  3:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

Summary: If the --result parameter includes a path then ConTeXt should
assume that that directory is writable thus read/write its temporary
flies at that location instead of the current working directory (CWD).

Consider the following three accounts:

- ConTeXt installation account (e.g., "context")
- Web server account (e.g., "web")
- Application account (e.g., "app")

ConTeXt is run using the web server account. The web server's CWD is
set to the application directory. For security reasons, the "web"
account may not create files in the "app" account.

When ConTeXt is called by the "web" account, the CWD is an "app"
account subdirectory. This subdirectory contains scores of .tex input
files that control various themes for the final rendered document.
Many different users, through this web-based application, create
different content .tex files.

I would like to run context as the web user within the app directory,
where the input .tex files are located; effectively, as the "web"
account, this would look like:

  cd /home/app/public_html/book/context
  source /home/context/bin/context/tex/setuptex
  /home/context/bin/context/tex/texmf-linux-64/bin/context
/home/web/users/1/book.tex --result=/home/web/users/1/book.pdf

Since the "web" account cannot write to the "app" directory, this
causes the following error:

! I can't write on file `book.log'.

The following is also not possible as the "web" account:

  cd /home/web/users/1/
  source /home/context/bin/context/tex/setuptex
  /home/context/bin/context/tex/texmf-linux-64/bin/context book.tex

This fails because the book.tex file includes files that are in the
"app" directory, which cannot be found. Since the "book.tex" file will
be in a different directory for every user, a symbolic link in each
book directory would probably resolve the issue, but that's a bit
wasteful.

I have updated TEXMFCACHE in texmfcnf.lua to point to
/var/cache/context/texmf-cache/ (world-writable), but it didn't help.

It seems that ConTeXt assumes write permissions to the current working
directory, which is not a valid assumption.

Thoughts?

P.S.
Also, the --result parameter should be listed in the --help page (or
the --help page should list --all as a way to see all the options).
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Feature Request: Set Output Directory
  2014-01-13  3:24 Feature Request: Set Output Directory Thangalin
@ 2014-01-15 10:00 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2014-01-15 10:00 UTC (permalink / raw)
  To: ntg-context

On 1/13/2014 4:24 AM, Thangalin wrote:
> Hi,
>
> Summary: If the --result parameter includes a path then ConTeXt should
> assume that that directory is writable thus read/write its temporary
> flies at that location instead of the current working directory (CWD).
>
> Consider the following three accounts:
>
> - ConTeXt installation account (e.g., "context")
> - Web server account (e.g., "web")
> - Application account (e.g., "app")
>
> ConTeXt is run using the web server account. The web server's CWD is
> set to the application directory. For security reasons, the "web"
> account may not create files in the "app" account.
>
> When ConTeXt is called by the "web" account, the CWD is an "app"
> account subdirectory. This subdirectory contains scores of .tex input
> files that control various themes for the final rendered document.
> Many different users, through this web-based application, create
> different content .tex files.
>
> I would like to run context as the web user within the app directory,
> where the input .tex files are located; effectively, as the "web"
> account, this would look like:
>
>    cd /home/app/public_html/book/context
>    source /home/context/bin/context/tex/setuptex
>    /home/context/bin/context/tex/texmf-linux-64/bin/context
> /home/web/users/1/book.tex --result=/home/web/users/1/book.pdf
>
> Since the "web" account cannot write to the "app" directory, this
> causes the following error:
>
> ! I can't write on file `book.log'.
>
> The following is also not possible as the "web" account:
>
>    cd /home/web/users/1/
>    source /home/context/bin/context/tex/setuptex
>    /home/context/bin/context/tex/texmf-linux-64/bin/context book.tex
>
> This fails because the book.tex file includes files that are in the
> "app" directory, which cannot be found. Since the "book.tex" file will
> be in a different directory for every user, a symbolic link in each
> book directory would probably resolve the issue, but that's a bit
> wasteful.
>
> I have updated TEXMFCACHE in texmfcnf.lua to point to
> /var/cache/context/texmf-cache/ (world-writable), but it didn't help.
>
> It seems that ConTeXt assumes write permissions to the current working
> directory, which is not a valid assumption.
>
> Thoughts?

in such case we create a temporary path (that is, the web service does 
that) and run context in a different way, say

mtxrun --path=/data/work/tmp --script context 
--path=/data/resources/mine ....

so, you will run on /data/work/tmp and input files will also be looked 
up opn /data/resources/mine

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-15 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-13  3:24 Feature Request: Set Output Directory Thangalin
2014-01-15 10:00 ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).