Bad TMPDIR

After turning on logging, I found out that this is why none of my searches are
working within the GUI (but work just find when I do them by hand with mysql):

DBD::mysql::st execute failed: Can’t create/write to file ‘/usr/home/user/tmp/#sqle341_2212_1.MYI’ (Errcode: 13) at /usr/local/lib/perl5/site_perl/5.005/DBIx/SearchBuilder.pm line 139, chunk 51.
DBIx::SearchBuilder error:Can’t create/write to file ‘/usr/home/user/tmp/#sqle341_2212_1.MYI’ (Errcode: 13)
Query String is SELECT DISTINCT main.* FROM Users main WHERE
((main.Disabled = ‘0’)) AND ((main.Name LIKE ‘%user%’)) ORDER BY main.Name ASC
DBD::mysql::st fetchrow_hashref failed: fetch() without execute() at /usr/local/lib/perl5/site_perl/5.005/DBIx/SearchBuilder.pm line 157, chunk 51.

/usr/home/user/tmp is the TMPDIR ENV setting of the person who built all of
the modules (via the FreeBSD ports collection) and installed RT on the web
server.

Apache itself was started by root, who has no TMPDIR environment variable.
Running the printenv script that comes with apache doesn’t list a TMPDIR ENV
variable, either.

Where is RT getting it’s TMPDIR setting from? How can I force it NOT to use a
user’s personal tmp directory?

After turning on logging, I found out that this is why none of my
searches are working within the GUI (but work just find when I do them
by hand with mysql):

DBD::mysql::st execute failed: Can’t create/write to file
’/usr/home/user/tmp/#sqle341_2212_1.MYI’ (Errcode: 13) at
/usr/local/lib/perl5/site_perl/5.005/DBIx/SearchBuilder.pm line 139,
chunk 51.

Where is RT getting it’s TMPDIR setting from? How can I force it NOT to
use a user’s personal tmp directory?

Hrm. Its not set by RT itself (which could be a problem in overriding
nastys from the environment). RT::Interface::Web uses File::Temp, which in
the documentation mentions using the TMPDIR variable. It is possible that
when installing the modules, the contents of this variable was hardcoded
into some libraries that RT depends on.

Setting the TMPDIR and reinstalling File::Temp on my FreeBSD testbox
does not result in this behaviour, so I’d suggest you do:

find /usr/local/lib/perl5 -type f -print | xargs grep -lE "user\/tmp"

and see which file has it defined.

                         Bruce Campbell                            RIPE
               Systems/Network Engineer                             NCC
             www.ripe.net - PGP562C8B1B                      Operations

bruce_campbell> Hrm. Its not set by RT itself (which could be a problem in
bruce_campbell> overriding nastys from the environment). RT::Interface::Web
bruce_campbell> uses File::Temp, which in the documentation mentions using the
bruce_campbell> TMPDIR variable. It is possible that when installing the
bruce_campbell> modules, the contents of this variable was hardcoded into some
bruce_campbell> libraries that RT depends on.

Well, the fix for this problem (and another issue where the httpd.conf
settings for rt were messing up the timezone for other apps running on the web
server) was to have rt use fastcgi instead of using mod_perl.