[PATCH] Re: Error with sync via ftp removing smoke files?

[email protected] (Bram) Tue, 03 Jun 2008 23:19:40 +0200
Newsgroups perl.daily-build
Message-ID <[email protected]>
--=_2hzzwpane9a8
Content-Type: text/plain;
	charset=ISO-8859-1;
	DelSp="Yes";
	format="flowed"
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Citeren Bram <[email protected]>:

> Quoting Abe Timmerman <[email protected]>:
>
>> Bram wrote:
>>> Ran into a problem setting up smoking on one machine...
>>>
>>> Configured the smoke to download sources via ftp.
>>> The machine is behind a firewall which doesn't seem to be   =20
>>> configured properly for ftp.
>>> It was able to connect but all other operations timed out.
>>>
>>> When I ran:
>>>
>>> cd /tmp
>>> /opt/perl/libs/local/bin/smokecurrent.sh -Dcc=3D"ccache /opt/gcc/bin/gcc=
430"
>>>
>>> everything in /opt/perl/libs/local/bin got removed.
>>
>> That is not good. I am so sorry!
>>
>> I am looking into this matter, but cannot reproduce.
>

Patch that fixes this attached.
(No tests for it are added - can't come up with a good test case)

The problem was the cleanup part in FTPClient.pm.

The cleanup routine checks what files are in . and deletes them.

This works fine if at least one file is transfered (since that code =20
does a chdir) but if no files were transfered things gi boom, since . =20
is not the same as the ddir/localdir.


If you want to reproduce this then you need to establish a control =20
channel to an FTP server (port 21) but refuse a data channel (port 20).

I used:

iptables -A INPUT --proto tcp --sport ! 21 --source 204.244.102.6 -j REJECT
iptables -A OUTPUT --proto tcp --dport ! 21 --destination =20
204.244.102.6 -j REJECT

Where 204.244.102.6 is the address of the Activestate ftp server that =20
I used to sync with.


Kind regards,

Bram


--=_2hzzwpane9a8
Content-Type: text/x-patch;
	charset=ISO-8859-1;
	name="patch_smoke"
Content-Disposition: attachment;
	filename="patch_smoke"
Content-Transfer-Encoding: 7bit

diff -Naur old/Test-Smoke-1.32/lib/Test/Smoke/FTPClient.pm new/Test-Smoke-1.32/lib/Test/Smoke/FTPClient.pm
--- old/Test-Smoke-1.32/lib/Test/Smoke/FTPClient.pm	2008-01-05 12:39:10.000000000 +0100
+++ new/Test-Smoke-1.32/lib/Test/Smoke/FTPClient.pm	2008-06-03 23:09:25.000000000 +0200
@@ -294,6 +294,7 @@
         }
     }
     if ( $cleanup ) {
+        chdir $localdir;
         $verbose > 1 and print "Cleanup '$localdir'\n";
         my %ok_file = map {
             ( clean_filename( $_->{name} ) => $_->{type} )

--=_2hzzwpane9a8--