Skip Menu |

This queue is for tickets about the File-Rsync CPAN distribution.

Report information
The Basics
Id: 78217
Status: open
Priority: 0/
Queue: File-Rsync

People
Owner: Nobody in particular
Requestors: rick.houser [...] us.pgds.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Broken rsh processing
Date: Thu, 5 Jul 2012 13:54:14 +0000
To: "'bug-File-Rsync [...] rt.cpan.org'" <bug-File-Rsync [...] rt.cpan.org>
From: "Houser, Rick" <rick.houser [...] us.pgds.com>
I'm trying to port an existing rsync command into File::Rsync, and I'm stuck. As near as I can tell, I'm hitting a bug in the processing of the rsh directive (specifically, quoting). Would you please take a look? This works from a shell: rsync <MISC_ARGS> --rsh="/usr/bin/ssh -p 12345 -l userid" <MISC_ARGS> This generates a command that works when pasted on a shell, but File::Rsync can't find the executable (status code 14): my $rsync = File::Rsync->new( { rsh => '"/usr/bin/ssh -p '.$self->{build_port}.' -l '.$self->{userid}.'"' } ); Removing the quote pair from above results in an rsync command line that won't connect, as I would expect. Basically, rsync tries to interpret the ssh arguments, and that doesn't work. I was able to get around this by removing the File::Rsync rsh argument and exporting the unquoted value via $ENV{RSYNC_RSH}, so this isn't holding me up. It looks really hacky, however. Rick Houser Web Administration (517)367-3516
Subject: Re: [rt.cpan.org #78217] Broken rsh processing
Date: Mon, 9 Jul 2012 08:05:31 -0500
To: bug-File-Rsync [...] rt.cpan.org
From: "Eakin, Lee" <leakin [...] ti.com>
Rick, what platform and version of perl and File::Rsync are you running? the module goes to some lengths to avoid the shell to get around quoting issues. I'll try to re-create the issue, but additional details will help. -lee On Thu, Jul 5, 2012 at 8:54 AM, Houser, Rick via RT < bug-File-Rsync@rt.cpan.org> wrote: Show quoted text
> Thu Jul 05 09:54:27 2012: Request 78217 was acted upon. > Transaction: Ticket created by rick.houser@us.pgds.com > Queue: File-Rsync > Subject: Broken rsh processing > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: rick.houser@us.pgds.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=78217 > > > > I'm trying to port an existing rsync command into File::Rsync, and I'm > stuck. As near as I can tell, I'm hitting a bug in the processing of the > rsh directive (specifically, quoting). Would you please take a look? > > This works from a shell: > > rsync <MISC_ARGS> --rsh="/usr/bin/ssh -p 12345 -l userid" <MISC_ARGS> > > > This generates a command that works when pasted on a shell, but > File::Rsync can't find the executable (status code 14): > > my $rsync = File::Rsync->new( { > rsh => '"/usr/bin/ssh -p '.$self->{build_port}.' -l '.$self->{userid}.'"' > } ); > > Removing the quote pair from above results in an rsync command line that > won't connect, as I would expect. Basically, rsync tries to interpret the > ssh arguments, and that doesn't work. > > I was able to get around this by removing the File::Rsync rsh argument and > exporting the unquoted value via $ENV{RSYNC_RSH}, so this isn't holding me > up. It looks really hacky, however. > > Rick Houser > Web Administration > (517)367-3516 > > >
Subject: RE: [rt.cpan.org #78217] Broken rsh processing
Date: Mon, 9 Jul 2012 13:24:42 +0000
To: "'bug-File-Rsync [...] rt.cpan.org'" <bug-File-Rsync [...] rt.cpan.org>
From: "Houser, Rick" <rick.houser [...] us.pgds.com>
Running RHEL5 on x86_64 architecture: perl-5.8.8-38.el5 (stock from RHEL5) perl-File-Rsync-0.43-1 (rebuilt rpmforge SRPM) My best guess is that -e/--rsh parameter isn't getting quoted at all. Thanks for taking a look! - Rick Houser Show quoted text
> -----Original Message----- > From: Eakin, Lee via RT [mailto:bug-File-Rsync@rt.cpan.org] > Sent: Monday, July 09, 2012 9:06 AM > To: Houser, Rick > Subject: Re: [rt.cpan.org #78217] Broken rsh processing > > <URL: https://rt.cpan.org/Ticket/Display.html?id=78217 > > > Rick, > what platform and version of perl and File::Rsync are you running? > the module goes to some lengths to avoid the shell to get around quoting > issues. I'll try to re-create the issue, but additional details will help. > -lee > > > On Thu, Jul 5, 2012 at 8:54 AM, Houser, Rick via RT < bug-File- > Rsync@rt.cpan.org> wrote: >
> > Thu Jul 05 09:54:27 2012: Request 78217 was acted upon. > > Transaction: Ticket created by rick.houser@us.pgds.com > > Queue: File-Rsync > > Subject: Broken rsh processing > > Broken in: (no value) > > Severity: (no value) > > Owner: Nobody > > Requestors: rick.houser@us.pgds.com > > Status: new > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=78217 > > > > > > > I'm trying to port an existing rsync command into File::Rsync, and I'm > > stuck. As near as I can tell, I'm hitting a bug in the processing of > > the rsh directive (specifically, quoting). Would you please take a look? > > > > This works from a shell: > > > > rsync <MISC_ARGS> --rsh="/usr/bin/ssh -p 12345 -l userid" <MISC_ARGS> > > > > > > This generates a command that works when pasted on a shell, but > > File::Rsync can't find the executable (status code 14): > > > > my $rsync = File::Rsync->new( { > > rsh => '"/usr/bin/ssh -p '.$self->{build_port}.' -l '.$self->{userid}.'"' > > } ); > > > > Removing the quote pair from above results in an rsync command line > > that won't connect, as I would expect. Basically, rsync tries to > > interpret the ssh arguments, and that doesn't work. > > > > I was able to get around this by removing the File::Rsync rsh argument > > and exporting the unquoted value via $ENV{RSYNC_RSH}, so this isn't > > holding me up. It looks really hacky, however. > > > > Rick Houser > > Web Administration > > (517)367-3516 > > > > > >
Subject: Re: [rt.cpan.org #78217] Broken rsh processing
Date: Mon, 13 Aug 2012 10:47:12 -0500
To: <bug-File-Rsync [...] rt.cpan.org>
From: Lee Eakin <leakin [...] ti.com>
Rick, I apologize for the delay. I keep getting distracted by my day job. I haven't been able to reproduce this. The code uses IPC::Open3 and passes the command as an array so that exec should avoid the shell completely. All my tests treat the rsh value as a single arg with no extra quoting required. Are you using any other modules that could be overloading arrays, or exec, or anything that might cause a shell to get back into the process? -Lee On 7/5/12 08:54 , Houser, Rick via RT wrote: Show quoted text
> Thu Jul 05 09:54:27 2012: Request 78217 was acted upon. > Transaction: Ticket created by rick.houser@us.pgds.com > Queue: File-Rsync > Subject: Broken rsh processing > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: rick.houser@us.pgds.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=78217 > > > > I'm trying to port an existing rsync command into File::Rsync, and I'm stuck. As near as I can tell, I'm hitting a bug in the processing of the rsh directive (specifically, quoting). Would you please take a look? > > This works from a shell: > > rsync <MISC_ARGS> --rsh="/usr/bin/ssh -p 12345 -l userid" <MISC_ARGS> > > > This generates a command that works when pasted on a shell, but File::Rsync can't find the executable (status code 14): > > my $rsync = File::Rsync->new( { > rsh => '"/usr/bin/ssh -p '.$self->{build_port}.' -l '.$self->{userid}.'"' > } ); > > Removing the quote pair from above results in an rsync command line that won't connect, as I would expect. Basically, rsync tries to interpret the ssh arguments, and that doesn't work. > > I was able to get around this by removing the File::Rsync rsh argument and exporting the unquoted value via $ENV{RSYNC_RSH}, so this isn't holding me up. It looks really hacky, however. > > Rick Houser > Web Administration > (517)367-3516 > >
Subject: RE: [rt.cpan.org #78217] Broken rsh processing
Date: Mon, 13 Aug 2012 17:22:15 +0000
To: "'bug-File-Rsync [...] rt.cpan.org'" <bug-File-Rsync [...] rt.cpan.org>
From: "Houser, Rick" <rick.houser [...] us.pgds.com>
Show quoted text
> I apologize for the delay. I keep getting distracted by my day job.
No problems. I certainly know how that goes. The module I'm experiencing this with uses: File::Rsync File::HomeDir Data::Dumper It's parent module uses: Net::OpenSSH (was Net::SSH::Perl when I reported this) File::Path File::HomeDir Data::Dumper However, my code isn't doing anything fancy. For this bit, the inherited stuff is little more than getting/setting values OO-style (the code uses a factory pattern, so the common bits are abstracted, and this module is the only one with File::Rsync). The part that actually uses File::Rsync is just a straightforward copy, although with the custom RSH command string. Which version of IPC::Open3 are you testing against? I show 1.02 installed here, and it's part of the RHEL5 perl package. Show quoted text
> All my tests treat the rsh value as a single arg with no extra quoting required.
I took a quick glance at Open3 and didn't see anything definitive, but I've seen other APIs where your choices were either a single command string that would be interpreted like a shell or an array of individual arguments as interpreted after the split on spaces. Any chance this internally looks something like (A), as opposed to (B)? A. ('rsync', '--rsh="/usr/bin/ssh -p 12345 -l userid"', <MISC_ARGS>) B. ('rsync', '--rsh="/usr/bin/ssh', '-p', '12345', '-l', 'userid"', <MISC_ARGS>) Rick Houser Web Administration (517)367-3516 Show quoted text
> -----Original Message----- > From: Eakin, Lee via RT [mailto:bug-File-Rsync@rt.cpan.org] > Sent: Monday, August 13, 2012 11:47 AM > To: Houser, Rick > Subject: Re: [rt.cpan.org #78217] Broken rsh processing > > <URL: https://rt.cpan.org/Ticket/Display.html?id=78217 > > > Rick, > I apologize for the delay. I keep getting distracted by my day job. > > I haven't been able to reproduce this. The code uses IPC::Open3 and passes > the command as an array so that exec should avoid the shell completely. All > my tests treat the rsh value as a single arg with no extra quoting required. > Are you using any other modules that could be overloading arrays, or exec, or > anything that might cause a shell to get back into the process? > > -Lee > > > On 7/5/12 08:54 , Houser, Rick via RT wrote:
> > Thu Jul 05 09:54:27 2012: Request 78217 was acted upon. > > Transaction: Ticket created by rick.houser@us.pgds.com > > Queue: File-Rsync > > Subject: Broken rsh processing > > Broken in: (no value) > > Severity: (no value) > > Owner: Nobody > > Requestors: rick.houser@us.pgds.com > > Status: new > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=78217 > > > > > > > I'm trying to port an existing rsync command into File::Rsync, and I'm stuck.
> As near as I can tell, I'm hitting a bug in the processing of the rsh directive > (specifically, quoting). Would you please take a look?
> > > > This works from a shell: > > > > rsync <MISC_ARGS> --rsh="/usr/bin/ssh -p 12345 -l userid" <MISC_ARGS> > > > > > > This generates a command that works when pasted on a shell, but
> File::Rsync can't find the executable (status code 14):
> > > > my $rsync = File::Rsync->new( { > > rsh => '"/usr/bin/ssh -p '.$self->{build_port}.' -l '.$self->{userid}.'"' > > } ); > > > > Removing the quote pair from above results in an rsync command line that
> won't connect, as I would expect. Basically, rsync tries to interpret the ssh > arguments, and that doesn't work.
> > > > I was able to get around this by removing the File::Rsync rsh argument and
> exporting the unquoted value via $ENV{RSYNC_RSH}, so this isn't holding me > up. It looks really hacky, however.
> > > > Rick Houser > > Web Administration > > (517)367-3516 > > > >
>
Subject: Re: [rt.cpan.org #78217] Broken rsh processing
Date: Mon, 13 Aug 2012 13:21:39 -0500
To: <bug-File-Rsync [...] rt.cpan.org>
From: Lee Eakin <leakin [...] ti.com>
The call to Open3 does look similar to A (but more like ['rsync','--rsh','/usr/bin/ssh -p 12345 -l userid',...] Open3 should be passing the array directly to exec. The rsync binary does split the rsh command on spaces (/usr/bin/ssh -p 12345 -l userid) and pass it thru the shell, but the extra double-quotes should break that rather than fix it. There should be nothing in those modules that might affect Arrays. I'll dig some more. I understand there is some magic underneath that invokes the shell if shell meta-characters are seen, and uses exec otherwise, but I thought using an array bypassed that magic. I need to re-find and re-read that portion of the docs so I understand. -Lee On 8/13/12 12:22 , Houser, Rick via RT wrote: Show quoted text
> Queue: File-Rsync > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=78217 > >
>> I apologize for the delay. I keep getting distracted by my day job.
> No problems. I certainly know how that goes. > > > > The module I'm experiencing this with uses: > File::Rsync > File::HomeDir > Data::Dumper > > It's parent module uses: > Net::OpenSSH (was Net::SSH::Perl when I reported this) > File::Path > File::HomeDir > Data::Dumper > > > However, my code isn't doing anything fancy. For this bit, the inherited stuff is little more than getting/setting values OO-style (the code uses a factory pattern, so the common bits are abstracted, and this module is the only one with File::Rsync). The part that actually uses File::Rsync is just a straightforward copy, although with the custom RSH command string. > > > Which version of IPC::Open3 are you testing against? I show 1.02 installed here, and it's part of the RHEL5 perl package. > >
>> All my tests treat the rsh value as a single arg with no extra quoting required.
> I took a quick glance at Open3 and didn't see anything definitive, but I've seen other APIs where your choices were either a single command string that would be interpreted like a shell or an array of individual arguments as interpreted after the split on spaces. Any chance this internally looks something like (A), as opposed to (B)? > > A. > > ('rsync', > '--rsh="/usr/bin/ssh -p 12345 -l userid"', > <MISC_ARGS>) > > B. > > ('rsync', > '--rsh="/usr/bin/ssh', > '-p', > '12345', > '-l', > 'userid"', > <MISC_ARGS>) > > > > Rick Houser > Web Administration > (517)367-3516 > >
>> -----Original Message----- >> From: Eakin, Lee via RT [mailto:bug-File-Rsync@rt.cpan.org] >> Sent: Monday, August 13, 2012 11:47 AM >> To: Houser, Rick >> Subject: Re: [rt.cpan.org #78217] Broken rsh processing >> >> <URL: https://rt.cpan.org/Ticket/Display.html?id=78217 > >> >> Rick, >> I apologize for the delay. I keep getting distracted by my day job. >> >> I haven't been able to reproduce this. The code uses IPC::Open3 and passes >> the command as an array so that exec should avoid the shell completely. All >> my tests treat the rsh value as a single arg with no extra quoting required. >> Are you using any other modules that could be overloading arrays, or exec, or >> anything that might cause a shell to get back into the process? >> >> -Lee >> >> >> On 7/5/12 08:54 , Houser, Rick via RT wrote:
>>> Thu Jul 05 09:54:27 2012: Request 78217 was acted upon. >>> Transaction: Ticket created by rick.houser@us.pgds.com >>> Queue: File-Rsync >>> Subject: Broken rsh processing >>> Broken in: (no value) >>> Severity: (no value) >>> Owner: Nobody >>> Requestors: rick.houser@us.pgds.com >>> Status: new >>> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=78217 > >>> >>> >>> I'm trying to port an existing rsync command into File::Rsync, and I'm stuck.
>> As near as I can tell, I'm hitting a bug in the processing of the rsh directive >> (specifically, quoting). Would you please take a look?
>>> This works from a shell: >>> >>> rsync <MISC_ARGS> --rsh="/usr/bin/ssh -p 12345 -l userid" <MISC_ARGS> >>> >>> >>> This generates a command that works when pasted on a shell, but
>> File::Rsync can't find the executable (status code 14):
>>> my $rsync = File::Rsync->new( { >>> rsh => '"/usr/bin/ssh -p '.$self->{build_port}.' -l '.$self->{userid}.'"' >>> } ); >>> >>> Removing the quote pair from above results in an rsync command line that
>> won't connect, as I would expect. Basically, rsync tries to interpret the ssh >> arguments, and that doesn't work.
>>> I was able to get around this by removing the File::Rsync rsh argument and
>> exporting the unquoted value via $ENV{RSYNC_RSH}, so this isn't holding me >> up. It looks really hacky, however.
>>> Rick Houser >>> Web Administration >>> (517)367-3516 >>> >>>
>
Subject: [rt.cpan.org #78217] Broken rsh processing
Date: Thu, 30 Aug 2012 14:27:17 +0300
To: bug-File-Rsync [...] rt.cpan.org
From: Tenho Tuhkala <tenho [...] netland.fi>
Hello I was struggling with same issue and with help of my colleague we founded a workaround at least: --- /usr/lib/perl5/File/Rsync.pm 2005-06-25 05:09:32.000000000 +0300 +++ bin/Rsync.pm 2012-08-30 14:17:52.000000000 +0300 @@ -556,7 +556,8 @@ my ($cmd, $infun, $outfun, $errfun, $debug) = $self->getcmd(@_); return unless $cmd; - print STDERR "exec: @$cmd\n" if $debug; + my $cmdx = join(" ", @$cmd); + print STDERR "exec: $cmdx\n" if $debug; my $out = FileHandle->new; my $err = FileHandle->new; $err->autoflush(1); $out->autoflush(1); @@ -565,7 +566,7 @@ { my $in = FileHandle->new; $in->autoflush(1); - $pid = eval{ open3 $in,$out,$err,@$cmd }; + $pid = eval{ open3 $in,$out,$err,$cmdx }; $self->{lastcmd} = $cmd; if ($@) { $self->{'realstatus'} = 0; It's made for older (0.42-2) module, but running diff against recent module it looks good for me. Best regards, Tenho Tuhkala