Forum OpenACS Development: Temp Upload Directory NaviServer OS X

Collapse
Posted by Dave Bauer on
On my Naviserver install on OS X, I can't upload files because the uploads are going into a temporary directory that is not allowed.

[24/Feb/2016:10:45:20][712.110e16000][-conn:hub:0-] Notice: ad_page_contract tmpfile filter on variable 'upload_file.tmpfile' at URL '/team/attach/attachment-new': The tmpfile given was '/var/folders/w6/fstmg5vj5fl4p0vf5fytdm3c0000gn/T//ns-JA3WWz', and the list of valid directories is '/tmp /var/tmp'.

Has anyone seen this. Is there some way to change the default directory Naviserver saves temporary uploads to?

Collapse
Posted by Antonio Pisano on
Based on this proc

http://www.openacs.org/api-doc/proc-view?proc=ad_tmpnam&source_p=1

Seems like there is a parametere called tmpdir which can be specified in your config.tcl

In the examples I have at hand I could not find a file using this parameter, but I think you can put it right after "ns_section ns/parameters" in your config.tcl

Collapse
Posted by Gustaf Neumann on
The logic is as follows: If you specify in your config file a tmpdir

ns_section ns/parameters
ns_param tmpdir /tmp

its value is taken. Otherwise, if you have set the environment variable TMPDIR, it uses its value. As a final fallback it takes the C macro "P_tmpdir", which is usually /tmp" Mac OS X sets the TMPDIR since "Mac OS X Leopard" to a private location to improve security.

In your case, if you don't care about security, set the tmpdir via environment variable (before starting the server) or via config-file. Otherwise include the obtained value from the config parameter in the list of "valid directories".

Where is this list ov valid dirs actually coming from?

Collapse
Posted by Dave Bauer on
Thanks, since this is a local development, I can set it in the config file.

The list of valid directories is hard coded in ad_page_contract https://openacs.org/api-doc/proc-view?source_p=1&proc=ad_page_contract_filter_proc_tmpfile&version_id=

That should probably we some sort of parameter as well but it seems to have been OK for 10 years or so.

Collapse
Posted by Gustaf Neumann on
In the last 10 years, many things changes, and people are today much more worried about security. If a program does not honor the environment variable TMPDIR it is regard as a bug and it is a problem for distributions, etc. NaviServer honors TMPDIR since 3 years.

Anyhow, you are right, this should be fixed [1]. Many thanks for the report.

-g

[1] http://cvs.openacs.org/changelog/OpenACS?cs=oacs-5-9%3Agustafn%3A20160225120331