SearchFAQMemberlist Log in
Reply to topic Page 1 of 1
trouble parsing rsync_long_args with a s
Author Message
Post trouble parsing rsync_long_args with a s 
On May 23, 2006, at 07:03, David Cantrell wrote:

I think the patch needs to go immediately after the line that reads:
< at > rsync_long_args_stack = ( split(/\s+/, $rsync_long_args) );

Yeah, that's where I had it but something else must have modified it
later on because it wound up getting undone before the rsync command
was called. I'd work more at it but I like your proposed solutions
better.

or alternatively that line needs replacing. The best solution would
involve something like Text::Balanced, but that was only put into the
perl core quite recently so I'm disinclined to use it.

Hey, neat, that'll come in handy on a different project. Another day
another module. :)

It looks like this went in perl 5.007003:

perl -MModule::CoreList -e "print
Module::CoreList->first_release('Text::Balanced');"

In Redhat land you'd need Redhat 7 (August 2000) or better:


ftp://archive.download.redhat.com/pub/redhat/linux/7.0/en/os/i386/
SRPMS/perl-5.6.0-9.src.rpm

ftp://archive.download.redhat.com/pub/redhat/linux/6.2/en/os/i386/
SRPMS/perl-5.00503-10.src.rpm

Personally, I haven't seen more than one Redhat 6 or older machine in
the past three years, and that needed a desperate upgrade. But it's
also easy to forget that Redhat 7 is less than 6 years old. Just
adding some data points.

[update: according to the clever people in the London Perl Mongers IRC
channel, the regex to use is (?<!')(?<!\s)(?:'')*\s+. This footnote is
a reminder to myself to try it out later]

A regex is certainly the best way to do it, IMHO. This particular one
doesn't seem exactly right. Test script:

#!/usr/bin/perl -w
use strict;
use warnings FATAL=>'all';

my $string = "--delete --numeric-ids --ignore-errors
--exclude='/private/var/vm/*' --exclude='.Spotlight-*'
--rsync-path='/usr/bin/sudo /usr/local/bin/rsync-mac'";

my < at > rsync_long_args_stack = split(/\s+/, $string);

foreach my $arg ( < at > rsync_long_args_stack) {
print STDERR "rsync param after space split: $arg\n";
}

< at > rsync_long_args_stack = split(/(?<!')(?<!\s)(?:'')*\s+/, $string);

foreach my $arg ( < at > rsync_long_args_stack) {
print STDERR "rsync param after super split: $arg\n";
}

Output:

rsync param after space split: --delete
rsync param after space split: --numeric-ids
rsync param after space split: --ignore-errors
rsync param after space split: --exclude='/private/var/vm/*'
rsync param after space split: --exclude='.Spotlight-*'
rsync param after space split: --rsync-path='/usr/bin/sudo
rsync param after space split: /usr/local/bin/rsync-mac'

rsync param after super split: --delete
rsync param after super split: --numeric-ids
rsync param after super split: --ignore-errors
rsync param after super split: --exclude='/private/var/vm/*'
--exclude='.Spotlight-*' --rsync-path='/usr/bin/sudo
rsync param after super split: /usr/local/bin/rsync-mac'

I'd need to meditate on that regex for a while to understand it - I'm
not real quick with the complex ones.

-Bill

-----
Bill McGonigle, Owner Work: 603.448.4440
BFC Computing, LLC Home: 603.448.1668
bill < at > bfccomputing.com Cell: 603.252.2606
http://www.bfccomputing.com/ Page: 603.442.1833
Blog: http://blog.bfccomputing.com/
VCard: http://bfccomputing.com/vcard/bill.vcf



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
rsnapshot-discuss mailing list
rsnapshot-discuss < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rsnapshot-discuss

Display posts from previous:
Reply to topic Page 1 of 1
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
  


Magic SEO URL for phpBB