From 9c1de41be35188497a5fb9019833c5f75ea09c6a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 1 Oct 2007 13:35:03 +0100 Subject: set /tmp/_sisu_processing directory permissions to 777, (each user has a sub-directory thereunder) --- CHANGELOG | 4 ++++ lib/sisu/v0/hub.rb | 3 ++- lib/sisu/v0/sysenv.rb | 26 ++++++++++++++++++++------ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 16aee6da..125fc91a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -31,6 +31,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.60.0.orig.tar.gz * parameter reading on first run of file, (initialization of parameters) + * processing directory /tmp/_sisu_processing permissions set to 777 as + processing for individual users occurs within sub-directory named after + user + * composite files (.ssm) building moved to processing directory, to overcome problem of non-writable sisu-source document directories, perhaps also cleaner (management of files) diff --git a/lib/sisu/v0/hub.rb b/lib/sisu/v0/hub.rb index 7dcc0127..a5c82aac 100644 --- a/lib/sisu/v0/hub.rb +++ b/lib/sisu/v0/hub.rb @@ -179,7 +179,8 @@ module SiSU ObjectSpace.garbage_collect else #print "not processed --> ", fns, "\n" end - else Operations.new(@opt).not_found + else + Operations.new(@opt).not_found unless @req =~/^conf$/ end elsif FileTest.file?(put) case @req diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index 95830224..fd3f5be2 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -99,12 +99,19 @@ module SiSU_Env m=/.+\/(\S+)/m @stub_pwd ||=@@pwd[m,1] prcss_dir='_sisu_processing' + prcss_dir_tmp_root="/tmp/#{prcss_dir}" prcss_dir_stub="#{prcss_dir}/#{@stub_pwd}" @processing_dir=if @@home and File.writable?("#{@@home}/."); "#{@@home}/#{prcss_dir_stub}" #elsif File.writable?("#{@@pwd}/."); "#{@@pwd}/#{prcss_dir}" else prcss_dir_stub end - tmp_processing=if @@user; "/tmp/#{prcss_dir}/#{@@user}/#{@stub_pwd}" + tmp_processing_base=if @@user; "#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" + else "#{prcss_dir_stub}" + end + tmp_processing_base_user=if @@user; "#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" + else "/tmp/#{prcss_dir_stub}" + end + tmp_processing=if @@user; "#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" else "/tmp/#{prcss_dir_stub}" end user=ENV['USER'] @@ -126,6 +133,7 @@ module SiSU_Env WEBSERV_SQLITE=:webserv_sqlite OUTPUT_LOCAL=:output_local PROCESSING_PATH=:processing_path + PROCESSING_DIR_TMP_ROOT=:processing_dir_tmp_root PROCESSING_PATH_TMP=:processing_path_tmp PROCESSING_PATH_TMP_BASE=:processing_path_tmp_base PROCESSING_DAL=:processing_dal @@ -165,7 +173,8 @@ module SiSU_Env WEBSERV_SQLITE => out + '/www/sqlite', OUTPUT_LOCAL => @@home + '/sisu_www', PROCESSING_PATH => @processing_dir, - PROCESSING_PATH_TMP_BASE => tmp_processing, + PROCESSING_DIR_TMP_ROOT => prcss_dir_tmp_root, + PROCESSING_PATH_TMP_BASE => tmp_processing_base, PROCESSING_PATH_TMP => tmp_processing, PROCESSING_DAL => 'dal', PROCESSING_TUNE => 'tune', @@ -1212,7 +1221,14 @@ WOK def processing_base_tmp defaults[:processing_path_tmp_base] end + def processing_dir_tmp_root + defaults[:processing_dir_tmp_root] + end def processing #processing directory, used/needed for sisu work files, has sub-directories (dal,tex etc) + unless FileTest.directory?(defaults[:processing_dir_tmp_root]) + File.mkpath(defaults[:processing_dir_tmp_root]) + File.chmod(0777,defaults[:processing_dir_tmp_root]) + end File.mkpath(defaults[:processing_path]) unless FileTest.directory?(defaults[:processing_path]) File.mkpath(defaults[:processing_path_tmp]) unless FileTest.directory?(defaults[:processing_path_tmp]) path_processing=if defined? @rc['processing']['path'] and @rc['processing']['path'] @@ -2379,16 +2395,14 @@ WOK end def make_file(path,filename) if File.writable?("#{path}/."); File.new("#{path}/#{filename}",'w+') - else - SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn + else SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn end end def touch_file(path,filename) if File.writable?("#{path}/."); system("touch #{path}/#{filename}") #File.new("#{path}/#{filename}",'w+') - else - SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn + else SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn end end def make_path(path) -- cgit v1.2.3