venerdì 6 gennaio 2017

Padre, SQLite3, security level...

Mentre sono ancora alle prese per riuscire ad installare l'ultimo Padre da CPAN sul mio perlbrew non ho resistito alla tentazione, e così ho installato la versione bundle per kubuntu...tutto semplice, no?
NO!
Ecco cosa succede se si cerca di lanciare l'IDE:



$ padre
DBD::SQLite::db do failed: Safety level may not be changed inside a transaction at (eval 1904) l
ine 37.
Perl exited with active threads:
       1 running and unjoined
       0 finished and unjoined
       0 running and detached



Fortunatamente la soluzione è abbastanza semplice e nota: modificare il file Locker.pm e spostare la direttiva pragma da dopo l'inizio della transazione a subito prima, ossia


$ diff -p /usr/share/perl5/Padre/Locker.pm /usr/shar
e/perl5/Padre/Locker.pm~
*** /usr/share/perl5/Padre/Locker.pm    2017-01-06 19:01:45.429692436 +0100
--- /usr/share/perl5/Padre/Locker.pm~   2013-11-09 04:43:41.000000000 +0100
*************** sub shutdown {
*** 102,108 ****
 sub db_increment {
       my $self = shift;
       unless ( $self->{db_depth}++ ) {
!
 
               # Database operations we lock on are the most likely to
               # involve writes. So opportunistically prevent blocking
--- 102,108 ----
 sub db_increment {
       my $self = shift;
       unless ( $self->{db_depth}++ ) {
!               Padre::DB->begin;
 
               # Database operations we lock on are the most likely to
               # involve writes. So opportunistically prevent blocking
*************** sub db_increment {
*** 110,117 ****
               # database write operations faster, at the risk of config.db
               # corruption if (and only if) there is a power outage,
               # operating system crash, or catastrophic hardware failure.
!           Padre::DB->pragma( synchronous => 0 );
!           Padre::DB->begin;
       }
       return;
 }
--- 110,116 ----
               # database write operations faster, at the risk of config.db
               # corruption if (and only if) there is a power outage,
               # operating system crash, or catastrophic hardware failure.
!               Padre::DB->pragma( synchronous => 0 );
       }
       return;
 }


1 commento:

ildgz ha detto...

Tengo este error, pero no el archivo Locker.pm:

$ padre
DBD::SQLite::db do failed: Safety level may not be changed inside a transaction at (eval 1940) line 37.
Perl exited with active threads:
1 running and unjoined
0 finished and unjoined
0 running and detached