View previous topic :: View next topic |
Author |
Message |
eohrnberger Apprentice
Joined: 09 Dec 2004 Posts: 240
|
Posted: Sun May 20, 2018 10:11 pm Post subject: iDrive perl scripts on Gentoo, no Love, works OK on Debian? |
|
|
I admit that I’m no Perl expert, heck, I’ve never written a single line of Perl code in my life.
I do want to try out iDrive backup on Gentoo. This is implemented in a set of Perl scripts, and they don’t work right now, at least not on my Gentoo.
The error that comes up is this one:
Code: |
./Account_Setting.pl
Undefined subroutine &main::retreat called at /usr/local/sbin/iDrive/Header.pl line 3976.
Compilation failed in require at ./Account_Setting.pl line 14.
|
Googling around, one suggestion was to add the line ‘use strict;’ to the top of the file. I did, and it’s barking all over with error messages:
Code: |
Global symbol "$incPos" requires explicit package name at ./Account_Setting.pl line 10.
Global symbol "$incLoc" requires explicit package name at ./Account_Setting.pl line 11.
Global symbol "$incPos" requires explicit package name at ./Account_Setting.pl line 11.
Global symbol "$incPos" requires explicit package name at ./Account_Setting.pl line 11.
Global symbol "$incLoc" requires explicit package name at ./Account_Setting.pl line 12.
Global symbol "$idriveServicePath" requires explicit package name at ./Account_Setting.pl line 21.
|
I also have a point-linux installation on a laptop, which is a 32-bit Debian installation. I tested on this platform, and the Perl code works without modification, and have successfully run a backup job from this to iDrive.
I've included the perl -V from these 2 systems in the code blocks below.
Debian:
Code: |
perl -V
Summary of my perl5 (revision 5 version 20 subversion 2) configuration:
Platform:
osname=linux, osvers=4.9.0-6-amd64, archname=i586-linux-gnu-thread-multi-64int
uname='linux x86-grnet-01 4.9.0-6-amd64 #1 smp debian 4.9.82-1+deb9u3 (2018-03-02) i686 gnulinux '
config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Dldflags= -Wl,-z,relro -Dlddlflags=-shared -Wl,-z,relro -Dcccdlflags=-fPIC -Darchname=i586-linux-gnu -Dprefix=/usr -Dprivlib=/usr/share/perl/5.20 -Darchlib=/usr/lib/i386-linux-gnu/perl/5.20 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/i386-linux-gnu/perl5/5.20 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.20.2 -Dsitearch=/usr/local/lib/i386-linux-gnu/perl/5.20.2 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dusesitecustomize -Duse64bitint -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -Ui_libutil -Uversiononly -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -Dlibperl=libperl.so.5.20.2 -des'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
use64bitint=define, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
|
Gentoo:
Code: |
perl -V
Summary of my perl5 (revision 5 version 20 subversion 2) configuration:
Platform:
osname=linux, osvers=3.17.8-gentoo-r1, archname=x86_64-linux
uname='linux storage 3.17.8-gentoo-r1 #1 smp sun mar 1 11:05:27 est 2015 x86_64 pentium(r) dual-core cpu e5700 @ 3.00ghz genuineintel gnulinux '
config_args='-des -Duseshrplib -Darchname=x86_64-linux -Dcc=x86_64-pc-linux-gnu-gcc -Doptimize=-O2 -pipe -Dldflags=-Wl,-O1 -Wl,--as-needed -Dprefix=/usr -Dinstallprefix=/usr -Dsiteprefix=/usr/local -Dvendorprefix=/usr -Dscriptdir=/usr/bin -Dprivlib=/usr/lib64/perl5/5.20.2 -Darchlib=/usr/lib64/perl5/5.20.2/x86_64-linux -Dsitelib=/usr/local/lib64/perl5/5.20.2 -Dsitearch=/usr/local/lib64/perl5/5.20.2/x86_64-linux -Dvendorlib=/usr/lib64/perl5/vendor_perl/5.20.2 -Dvendorarch=/usr/lib64/perl5/vendor_perl/5.20.2/x86_64-linux -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dvendorman1dir=/usr/share/man/man1 -Dvendorman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3pm -Dlibperl=libperl.so.5.20.2 -Dlocincpth=/usr/include -Dglibpth=/lib64 /usr/lib64 -Duselargefiles -Dd_semctl_semun -Dcf_by=Gentoo -Dmyhostname=localhost -Dperladmin=root@localhost -Dinstallusrbinperl=n -Ud_csh -Uusenm -Di_ndbm -Di_gdbm -Di_db -DDEBUGGING=none -Dinc_version_list=5.20.0/x86_64-linux 5.20.0 5.20.1/x86_64-linux 5.20.1 -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Dnoextensions=ODBM_File'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
|
It seems that the two perl installations are the same version and revision. Wonder why they are behaving differently?
Is there someone here that is using iDrive or backups from a 64-bit Gentoo installation?
Any hints to offer?
Anyone that’s a Perl wizard that might be able to lend some insights in getting the iDrive perl scripts working on the Gentoo installation?
Thanks in advance. |
|
Back to top |
|
|
dkasak n00b
Joined: 10 Feb 2012 Posts: 61
|
Posted: Mon May 21, 2018 12:52 am Post subject: |
|
|
Perl guru here. Without seeing the code, it's pretty damned hard to see what the problem is. One change that did break things recently in Perl was to stop including the current directory in the 'include path' ( the list of directories searched for libraries ). Since your script is in /usr/local/sbin ... it's not clear how this would have worked either way ... but again ... I can't see the source code so it's hard to say. Anyway, you can modify the include path with perl's "-I" switch ( that's a capital i ). So you might do:
Code: | perl -I /usr/local/sbin/iDrive ./Account_Setting.pl |
The 'use strict' will most certainly not help you out here, but does point out that the quality of code you're running is pretty poor. I would be wary of running it as root, as you're doing.
If you point me to the code, I can maybe help out further. |
|
Back to top |
|
|
eohrnberger Apprentice
Joined: 09 Dec 2004 Posts: 240
|
Posted: Mon May 21, 2018 3:07 am Post subject: |
|
|
dkasak wrote: | Perl guru here. Without seeing the code, it's pretty damned hard to see what the problem is. |
Fair. The download Linux is: https://www.idrive.com/online-backup-linux
Quote: | One change that did break things recently in Perl was to stop including the current directory in the 'include path' ( the list of directories searched for libraries ). Since your script is in /usr/local/sbin ... it's not clear how this would have worked either way ... but again ... I can't see the source code so it's hard to say. Anyway, you can modify the include path with perl's "-I" switch ( that's a capital i ). So you might do:
Code: | perl -I /usr/local/sbin/iDrive ./Account_Setting.pl |
|
Tried this, didn't help. Same error message.
Quote: | The 'use strict' will most certainly not help you out here, but does point out that the quality of code you're running is pretty poor. I would be wary of running it as root, as you're doing.
If you point me to the code, I can maybe help out further. |
Download link is posted above, and I appreciate your help. |
|
Back to top |
|
|
dkasak n00b
Joined: 10 Feb 2012 Posts: 61
|
Posted: Fri May 25, 2018 1:45 am Post subject: |
|
|
For a relatively large codebase, it's written pretty poorly
So I got at least the Account.pl script working, with the following patch:
Code: | dkasak@gandalf ~/Downloads $ diff -u IDrive_for_Linux/scripts/Header.pl IDrive_for_Linux_fixed/scripts/Header.pl
--- IDrive_for_Linux/scripts/Header.pl 2018-05-09 18:45:26.000000000 +1000
+++ IDrive_for_Linux_fixed/scripts/Header.pl 2018-05-25 11:38:06.063511496 +1000
@@ -13,6 +13,7 @@
#use Fcntl;
use POSIX;
use Fcntl qw(:flock);
+use Helpers;
$incPos = rindex(__FILE__, '/');
$incLoc = ($incPos>=0)?substr(__FILE__, 0, $incPos): '.';
@@ -3966,14 +3967,14 @@
#*********************************************************************************************************/
sub getUniqueID{
my $cmd;
- if (-f '/sbin/ifconfig') {
+ if (-f '/bin/ifconfig') {
$cmd = '/sbin/ifconfig -a';
}
- elsif (-f '/sbin/ip') {
+ elsif (-f '/bin/ip') {
$cmd = '/sbin/ip addr';
}
else {
- retreat('unable_to_find_mac_address');
+ Helpers::retreat('unable_to_find_mac_address');
}
my $result = `$cmd`;
dkasak@gandalf ~/Downloads $
|
Summary:
1) The Header.pl script makes use of functions in the Helpers.pm file, but doesn't "use" it. You can't do that. See the "use Helpers;" part I added at the top.
2) They were calling the retreat() function without prefixing it with the Helpers:: namespace that it resided in. You can't do that. See where I changed "retreat('unable_to_find_mac_address');" to "Helpers::retreat('unable_to_find_mac_address');"
3) They were hard-coded the paths of 'ifconfig' and 'ip' to /sbin. You shouldn't hardcode paths, but have some algorithm to actually LOCATE them ( even if you just shell out to 'which ifconfig' and parse the output ). I've fixed this by ... wait for it ... hard-coding the path to what will work for you on Gentoo.
You should now be able to at least *launch* the Account.pl script. You still need to pass the -I flag ( with the path to the scripts ). See how you go. I'm guessing you'll hit more issues. I can help you out a bit more ... but I may have to get myself an iDrive account. |
|
Back to top |
|
|
krinn Watchman
Joined: 02 May 2003 Posts: 7470
|
Posted: Fri May 25, 2018 11:40 am Post subject: |
|
|
dkasak wrote: | it's written pretty poorly |
Which raise the question about of the validity of using their services as backup. |
|
Back to top |
|
|
eohrnberger Apprentice
Joined: 09 Dec 2004 Posts: 240
|
Posted: Sat May 26, 2018 12:46 am Post subject: |
|
|
dkasak wrote: | For a relatively large codebase, it's written pretty poorly
So I got at least the Account.pl script working, with the following patch:
Code: | dkasak@gandalf ~/Downloads $ diff -u IDrive_for_Linux/scripts/Header.pl IDrive_for_Linux_fixed/scripts/Header.pl
--- IDrive_for_Linux/scripts/Header.pl 2018-05-09 18:45:26.000000000 +1000
+++ IDrive_for_Linux_fixed/scripts/Header.pl 2018-05-25 11:38:06.063511496 +1000
@@ -13,6 +13,7 @@
#use Fcntl;
use POSIX;
use Fcntl qw(:flock);
+use Helpers;
$incPos = rindex(__FILE__, '/');
$incLoc = ($incPos>=0)?substr(__FILE__, 0, $incPos): '.';
@@ -3966,14 +3967,14 @@
#*********************************************************************************************************/
sub getUniqueID{
my $cmd;
- if (-f '/sbin/ifconfig') {
+ if (-f '/bin/ifconfig') {
$cmd = '/sbin/ifconfig -a';
}
- elsif (-f '/sbin/ip') {
+ elsif (-f '/bin/ip') {
$cmd = '/sbin/ip addr';
}
else {
- retreat('unable_to_find_mac_address');
+ Helpers::retreat('unable_to_find_mac_address');
}
my $result = `$cmd`;
dkasak@gandalf ~/Downloads $
|
Summary:
1) The Header.pl script makes use of functions in the Helpers.pm file, but doesn't "use" it. You can't do that. See the "use Helpers;" part I added at the top.
2) They were calling the retreat() function without prefixing it with the Helpers:: namespace that it resided in. You can't do that. See where I changed "retreat('unable_to_find_mac_address');" to "Helpers::retreat('unable_to_find_mac_address');"
3) They were hard-coded the paths of 'ifconfig' and 'ip' to /sbin. You shouldn't hardcode paths, but have some algorithm to actually LOCATE them ( even if you just shell out to 'which ifconfig' and parse the output ). I've fixed this by ... wait for it ... hard-coding the path to what will work for you on Gentoo.
You should now be able to at least *launch* the Account.pl script. You still need to pass the -I flag ( with the path to the scripts ). See how you go. I'm guessing you'll hit more issues. I can help you out a bit more ... but I may have to get myself an iDrive account. |
Oh, man you be awesome!
I appreciate your efforts on this, and especially your critiquing of the perl code. Clearly, this was just hacked together without observance of any of the well known coding best practices.
All this aside, I have a hard time recommending this for critical use to anyone, regardless of the price advantages that iDrive might present.
Again, kudos and appreciation to you and your efforts. Much appreciated Sir. |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sat May 26, 2018 5:01 pm Post subject: |
|
|
I did the math and iDrive's "business" plan works out about 10% more expensive than rsync.net in the best case, assuming 100% fill efficiency and no overage fees.
The others are basically a for-pay version of Google Drive, but worse. Their privacy policy in particular self-grants them the amazingly vague permission to share "data you send them" with third parties for "web analytics". |
|
Back to top |
|
|
eohrnberger Apprentice
Joined: 09 Dec 2004 Posts: 240
|
Posted: Sat May 26, 2018 7:18 pm Post subject: |
|
|
Ant P. wrote: | I did the math and iDrive's "business" plan works out about 10% more expensive than rsync.net in the best case, assuming 100% fill efficiency and no overage fees.
The others are basically a for-pay version of Google Drive, but worse. Their privacy policy in particular self-grants them the amazingly vague permission to share "data you send them" with third parties for "web analytics". |
CrashPlan has a decent deal, $10 / month / device unlimited storage.
My only criticism is how long it takes to upload the backup data, especially when it gets into the TB range. |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sun May 27, 2018 6:21 pm Post subject: |
|
|
Tarsnap looks like it might be interesting, they do client side compression/deduplication. They bill for both the bandwidth and storage though. |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3133
|
Posted: Sun May 27, 2018 8:50 pm Post subject: |
|
|
Quote: | heir privacy policy in particular self-grants them the amazingly vague permission to share "data you send them" with third parties for "web analytics". | Nothing new, and nothing old good encryption wouldn't solve. |
|
Back to top |
|
|
freke l33t
Joined: 23 Jan 2003 Posts: 977 Location: Somewhere in Denmark
|
Posted: Tue May 29, 2018 4:31 pm Post subject: |
|
|
Ant P. wrote: | Tarsnap looks like it might be interesting, they do client side compression/deduplication. They bill for both the bandwidth and storage though. |
This is my statement from tarsnap: Code: | Balance 2018-05-26 14.607370113125478315
Usage 2018-05-26 mail.vlh.dk Client->Server bandwidth 7761470 bytes 0.001940367500000000
Usage 2018-05-26 mail.vlh.dk Daily storage 1221538747 bytes 0.009851118769801452
Usage 2018-05-26 mail.vlh.dk Server->Client bandwidth 6647692 bytes 0.001661923000000000
Usage 2018-05-26 ns.vlh.dk Client->Server bandwidth 129847880 bytes 0.032461970000000000
Usage 2018-05-26 ns.vlh.dk Daily storage 2940297196 bytes 0.023712073781897136
Usage 2018-05-26 ns.vlh.dk Server->Client bandwidth 8502433 bytes 0.002125608250000000
Usage 2018-05-26 lamp.vlh.dk Client->Server bandwidth 13554442 bytes 0.003388610500000000
Usage 2018-05-26 lamp.vlh.dk Daily storage 427672136 bytes 0.003448968783526176
Usage 2018-05-26 lamp.vlh.dk Server->Client bandwidth 1123335 bytes 0.000280833750000000
Balance 2018-05-27 14.528498638790253551
Usage 2018-05-27 mail.vlh.dk Client->Server bandwidth 15298219 bytes 0.003824554750000000
Usage 2018-05-27 mail.vlh.dk Daily storage 1236712518 bytes 0.009973487888811288
Usage 2018-05-27 mail.vlh.dk Server->Client bandwidth 95049 bytes 0.000023762250000000
Usage 2018-05-27 ns.vlh.dk Client->Server bandwidth 127841743 bytes 0.031960435750000000
Usage 2018-05-27 ns.vlh.dk Daily storage 3067517337 bytes 0.024738042644513892
Usage 2018-05-27 ns.vlh.dk Server->Client bandwidth 472104 bytes 0.000118026000000000
Usage 2018-05-27 lamp.vlh.dk Client->Server bandwidth 20968220 bytes 0.005242055000000000
Usage 2018-05-27 lamp.vlh.dk Daily storage 448435630 bytes 0.003616416313105080
Usage 2018-05-27 lamp.vlh.dk Server->Client bandwidth 155934 bytes 0.000038983500000000
Balance 2018-05-28 14.448962874693823291
Usage 2018-05-28 mail.vlh.dk Client->Server bandwidth 6584979 bytes 0.001646244750000000
Usage 2018-05-28 mail.vlh.dk Daily storage 1230789823 bytes 0.009925724220220668
Usage 2018-05-28 mail.vlh.dk Server->Client bandwidth 4457777 bytes 0.001114444250000000
Usage 2018-05-28 ns.vlh.dk Client->Server bandwidth 120805424 bytes 0.030201356000000000
Usage 2018-05-28 ns.vlh.dk Daily storage 2977625841 bytes 0.024013111236757956
Usage 2018-05-28 ns.vlh.dk Server->Client bandwidth 5713377 bytes 0.001428344250000000
Usage 2018-05-28 lamp.vlh.dk Client->Server bandwidth 13382985 bytes 0.003345746250000000
Usage 2018-05-28 lamp.vlh.dk Daily storage 438229823 bytes 0.003534111419260668
Usage 2018-05-28 lamp.vlh.dk Server->Client bandwidth 1121223 bytes 0.000280305750000000 |
ie. looking at less than $0.1 each day for ~4.5GB storage - including the daily backup trafic.
That said I use Crashplan for my Windows-desktop. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|