Michael,

It's really easy to use the temp_store_directory pragma to force SQLite
working in the Cache directory (for example).
I've tried it on my QNAP, it works well, and I could send you a diff if
you wish.

But... 

AFAIK, SQLite should already follow the TMPDIR environment variable
which is defined and exported by SSOTS/SSODS, and points to the
/var/tmp directory of the SSOxS' installation root (and is writeable by
the user running slimserver.pl, of course).


And most important...

SQLite's temp_store_directory pragma is deprecated!


That's why I've played a bit with RC3 today, trying to understand why
SQLite wouldn't respect TMPDIR, and here's what I've discovered:

First, I've modified Slim/Utils/SQLiteHelper.pm to tell me whether it
saw this environment variable or not:

Code:
--------------------
    sub init {
  my ( $class, $dbh ) = @_;
  
  logger('server')->error("\$ENV{TMPDIR}='".($ENV{TMPDIR}||"<undef>")."'");
  
  # Make sure we're running the right version of DBD::SQLite
  if ( $DBD::SQLite::VERSION lt 1.34 ) {
  die "DBD::SQLite version 1.34 or higher required\n";
  }
  
--------------------


Then I restarted SBS and could see that in server.log:

Code:
--------------------
    [11-08-19 19:05:57.1257] main::init (350) Starting Squeezebox Server 
(v7.6.1, r33110, Wed Aug 17 19:52:41 MDT 2011) perl 5.010000
  [11-08-19 19:05:57.1267] main::init (351) $ENV{TMPDIR}='/opt/ssods4/var/tmp'
  [11-08-19 19:05:57.1381] main::init (380) Squeezebox Server OS Specific 
init...
  [11-08-19 19:05:57.1391] main::init (414) Squeezebox Server daemonizing...
  [11-08-19 19:05:57.1443] main::init (427) Squeezebox Server settings 
effective user and group if requested...
  [11-08-19 19:05:57.1443] Slim::bootstrap::theEND (442) Got to the END
  [11-08-19 19:05:57.1478] main::changeEffectiveUserAndGroup (1031) Running as 
uid: 65534 / gid: 65534 100 65534 65534
  [11-08-19 19:05:57.1490] Slim::Utils::OS::setPriority (368) Squeezebox Server 
changing process priority to 0
  [11-08-19 19:05:57.1500] main::init (444) Squeezebox Server binary search 
path init...
  [11-08-19 19:05:57.1526] main::init (448) Squeezebox Server PluginManager 
init...
  [11-08-19 19:05:57.2755] main::init (451) Squeezebox Server strings init...
  [11-08-19 19:05:57.2871] Slim::Utils::Strings::loadStrings (123) Retrieving 
string data from string cache: 
/opt/ssods4/var/home/SqueezeboxServer/Cache/stringcache.i686-linux.bin
  [11-08-19 19:05:57.3058] main::init (463) Squeezebox Server SQL init 
(Slim::Utils::SQLiteHelper)...
  [11-08-19 19:05:57.3068] Slim::Utils::SQLiteHelper::init (59) 
$ENV{TMPDIR}='/opt/ssods4/var/tmp'
--------------------

So far so good, SBS is aware of the TMPDIR environment variable.

But then, I've started a wipe scan, and this is what I get in
scanner.log:

Code:
--------------------
    [11-08-19 19:25:05.7833] main::main (197) Starting Squeezebox Server 
scanner (v7.6.1, r33110, Wed Aug 17 19:52:41 MDT 2011) perl 5.010000
  [11-08-19 19:25:05.7854] main::initializeFrameworks (376) Squeezebox Server 
OSDetect init...
  [11-08-19 19:25:05.7873] main::initializeFrameworks (382) Squeezebox Server 
settings init...
  [11-08-19 19:25:05.7923] main::initializeFrameworks (388) Squeezebox Server 
strings init...
  [11-08-19 19:25:05.7939] Slim::Utils::Strings::loadStrings (123) Retrieving 
string data from string cache: 
/opt/ssods4/var/home/SqueezeboxServer/Cache/stringcache.i686-linux.bin
  [11-08-19 19:25:05.8074] main::initializeFrameworks (392) Squeezebox Server 
Info init...
  [11-08-19 19:25:06.0963] Slim::Utils::OS::setPriority (368) Squeezebox Server 
changing process priority to 0
  [11-08-19 19:25:06.0983] main::main (219) Squeezebox Server SQL init...
  [11-08-19 19:25:06.0993] Slim::Utils::SQLiteHelper::init (59) 
$ENV{TMPDIR}='<undef>'
--------------------

As you can see, TMPDIR isn't defined any more.

Hmmm, would SBS filter the environment variables it passes to its
children?
Nope, as you can see from this (truncated) /proc dump, the scanner.pl
process is initialized with TMPDIR:

Code:
--------------------
    
  [/opt/ssods4/var/home/SqueezeboxServer] # ps -ef|grep scan
  14443 guest     30912 D   /opt/ssods4/bin/perl 
/share/MD0_DATA/.qpkg/SSOTS/var/home/SqueezeboxServer/scanner.pl 
--logdir=/opt/ssods4
  [/opt/ssods4/var/home/SqueezeboxServer] # cat /proc/14443/environ 
  
TERM=unknownSHELL=/bin/shTMPDIR=/opt/ssods4/var/tmpOLDPWD=/share/MD0_DATA/.qpkg/SSOTS/share/ssods/www/ssods
--------------------


And that's where my knowledge of SBS' code shows its limits.
I haven't understood (yet) why the environment variable wouldn't be
visible at this point, although it *IS* exported to the script.


-- 
sebp

'Last.fm' (http://www.last.fm/user/sebp)
------------------------------------------------------------------------
sebp's Profile: http://forums.slimdevices.com/member.php?userid=11768
View this thread: http://forums.slimdevices.com/showthread.php?t=88524

_______________________________________________
beta mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/beta

Reply via email to