Re: [lftp] issue with SITE commands and retries

2015-03-12 Thread Mattias Bergvall
Hi again.
The problems with FTP-retries is not fixed when setting net:max-retries 1
and cmd:fail-exit true. Am I using the wrong variables?

I use LFTP | Version 4.6.0 | Copyright (c) 1996-2014 Alexander V.
Lukyanov with Libraries used: Readline 5.1, zlib 1.2.3, and still get 1
automatic FTP retry when the FTP server uncleanly closes the session, (and
since I didn't set ftp:site, it didn't re-issue the site commands).

Regarding the double-spaces in the ftp:site option, what would happen if
there are trailing spaces or more than 2 spaces between two site commands?


Thanks again for a great product!


Kind regards
Mattias Bergvall

On Wed, Jun 11, 2014 at 11:37 AM, Alexander V. Lukyanov l...@netis.ru
wrote:

 On Tue, Jun 10, 2014 at 10:58:12AM +0200, Mattias Bergvall wrote:
  I have an issue with LFTP (Version 4.4.15) when it comes to “misbehaving”
  mainframe remote sites.
  The problem occurs when the FTP server/proxy  (IBM FTP CS V1R13) fails to
  get exclusive permissions to the target dataset (file).
  The server then issues a 125 message and terminates the connection.
 (Which
  I think is incorrect behavior, but that's not the point).
 
  What happens next is that lftp reconnects again (I have net:max-retries =
  1. I don’t want it to retry!) and does NOT issue the SITE commands that

 The problem with retries should be fixed in 4.5.2.

 You can also try this patch for 4.5.2 which adds ftp:site setting for
 tuning the connection after login. For your case it would be

set ftp:site SBD=(IBM-278,ISO8859-1)  LRECL=240  RECFM=FB

 (note the double spaces).

 --
Alexander.

___
lftp mailing list
lftp@uniyar.ac.ru
http://univ.uniyar.ac.ru/mailman/listinfo/lftp


Re: [lftp] issue with SITE commands and retries

2015-03-12 Thread Alexander V. Lukyanov
On Thu, Mar 12, 2015 at 09:55:13AM +0100, Mattias Bergvall wrote:
 The problems with FTP-retries is not fixed when setting net:max-retries 1
 and cmd:fail-exit true. Am I using the wrong variables?
 
 I use LFTP | Version 4.6.0 | Copyright (c) 1996-2014 Alexander V.
 Lukyanov with Libraries used: Readline 5.1, zlib 1.2.3, and still get 1
 automatic FTP retry when the FTP server uncleanly closes the session, (and
 since I didn't set ftp:site, it didn't re-issue the site commands).

Can you provide debug log from lftp?

 Regarding the double-spaces in the ftp:site option, what would happen if
 there are trailing spaces or more than 2 spaces between two site commands?

Two spaces terminate a single SITE command, if there is third - it becomes
part of the next SITE command.

-- 
   Alexander.
___
lftp mailing list
lftp@uniyar.ac.ru
http://univ.uniyar.ac.ru/mailman/listinfo/lftp


Re: [lftp] issue with SITE commands and retries

2014-06-13 Thread Mattias Bergvall
Thanks Alexander.
I've upgraded to 4.5.2 now.

Will the ftp:site option be available in 4.5.3?


BR
Mattias Bergvall


On Wed, Jun 11, 2014 at 11:37 AM, Alexander V. Lukyanov l...@netis.ru
wrote:

 On Tue, Jun 10, 2014 at 10:58:12AM +0200, Mattias Bergvall wrote:
  I have an issue with LFTP (Version 4.4.15) when it comes to “misbehaving”
  mainframe remote sites.
  The problem occurs when the FTP server/proxy  (IBM FTP CS V1R13) fails to
  get exclusive permissions to the target dataset (file).
  The server then issues a 125 message and terminates the connection.
 (Which
  I think is incorrect behavior, but that's not the point).
 
  What happens next is that lftp reconnects again (I have net:max-retries =
  1. I don’t want it to retry!) and does NOT issue the SITE commands that

 The problem with retries should be fixed in 4.5.2.

 You can also try this patch for 4.5.2 which adds ftp:site setting for
 tuning the connection after login. For your case it would be

set ftp:site SBD=(IBM-278,ISO8859-1)  LRECL=240  RECFM=FB

 (note the double spaces).

 --
Alexander.

___
lftp mailing list
lftp@uniyar.ac.ru
http://univ.uniyar.ac.ru/mailman/listinfo/lftp


Re: [lftp] issue with SITE commands and retries

2014-06-11 Thread Alexander V. Lukyanov
On Tue, Jun 10, 2014 at 10:58:12AM +0200, Mattias Bergvall wrote:
 I have an issue with LFTP (Version 4.4.15) when it comes to “misbehaving”
 mainframe remote sites.
 The problem occurs when the FTP server/proxy  (IBM FTP CS V1R13) fails to
 get exclusive permissions to the target dataset (file).
 The server then issues a 125 message and terminates the connection. (Which
 I think is incorrect behavior, but that's not the point).

 What happens next is that lftp reconnects again (I have net:max-retries =
 1. I don’t want it to retry!) and does NOT issue the SITE commands that

The problem with retries should be fixed in 4.5.2.

You can also try this patch for 4.5.2 which adds ftp:site setting for
tuning the connection after login. For your case it would be

   set ftp:site SBD=(IBM-278,ISO8859-1)  LRECL=240  RECFM=FB

(note the double spaces).

--
   Alexander.
diff --git a/src/ftpclass.cc b/src/ftpclass.cc
index aa4cf6a..44be63d 100644
--- a/src/ftpclass.cc
+++ b/src/ftpclass.cc
@@ -1559,6 +1559,7 @@ int   Ftp::Do()
 TuneConnectionAfterFEAT();
   SendSiteGroup();
   SendSiteIdle();
+  SendSiteCommands();
 
   if(!home_auto)
   {
@@ -2648,6 +2649,23 @@ void Ftp::SendSiteGroup()
conn-SendCmd2(SITE GROUP,group);
expect-Push(Expect::IGNORE);
 }
+void Ftp::SendSiteCommands()
+{
+   const char *site_commands=QueryStringWithUserAtHost(site);
+   if(!site_commands)
+  return;
+   char *cmd=alloca_strdup(site_commands);
+   for(;;) {
+  char *sep=strstr(cmd,  );
+  if(sep)
+*sep=0;
+  conn-SendCmd2(SITE,cmd);
+  expect-Push(Expect::IGNORE);
+  if(!sep)
+break;
+  cmd=sep+2;
+   }
+}
 
 void Ftp::SendArrayInfoRequests()
 {
diff --git a/src/ftpclass.h b/src/ftpclass.h
index c83c208..d762086 100644
--- a/src/ftpclass.h
+++ b/src/ftpclass.h
@@ -327,6 +327,7 @@ private:
voidSendSiteIdle();
voidSendAcct();
voidSendSiteGroup();
+   voidSendSiteCommands();
voidSendUTimeRequest();
void SendAuth(const char *auth);
void TuneConnectionAfterFEAT();
diff --git a/src/resource.cc b/src/resource.cc
index 6f63ed7..4aa071a 100644
--- a/src/resource.cc
+++ b/src/resource.cc
@@ -181,6 +181,7 @@ static ResType lftp_vars[] = {
{ftp:fxp-passive-source,   no,
ResMgr::BoolValidate,ResMgr::NoClosure},
{ftp:fxp-passive-sscn, yes,   
ResMgr::BoolValidate,ResMgr::NoClosure},
{ftp:home, ,  0,0},
+   {ftp:site  ,  0,0},
{ftp:site-group,   ,  0,0},
{ftp:lang, ,  0,0},
{ftp:list-empty-ok,no,0,0},
___
lftp mailing list
lftp@uniyar.ac.ru
http://univ.uniyar.ac.ru/mailman/listinfo/lftp


[lftp] issue with SITE commands and retries

2014-06-10 Thread Mattias Bergvall
Hi!
Thanks for lftp. A great piece of software.


We need an option to completely disable retries. The option net:max-retries
= 0 unfortunately means unlimited retries.

I have an issue with LFTP (Version 4.4.15) when it comes to “misbehaving”
mainframe remote sites.
The problem occurs when the FTP server/proxy  (IBM FTP CS V1R13) fails to
get exclusive permissions to the target dataset (file).
The server then issues a 125 message and terminates the connection. (Which
I think is incorrect behavior, but that's not the point).

What happens next is that lftp reconnects again (I have net:max-retries =
1. I don’t want it to retry!) and does NOT issue the SITE commands that
were in the command file, prior to the put command.
This time, the FTP server does not have a problem, so lftp successfully
sends the file, but it then gets the wrong record length on the remote side
☹.

This is my command file:

set ftp:use-feat false
set dns:fatal-timeout 50
set net:max-retries 1
set cmd:fail-exit true
set ftp:sync-mode true
set ftp:use-site-utime false
set net:connection-limit 1
open 10.0.0.2
set net:socket-bind-ipv4 172.17.0.2
site SBD=(IBM-278,ISO8859-1)
site LRECL=240
site RECFM=FB
put -a /var/tmp/vidare_tmp.21077.21504tina1399629722_00b996a43ed577108682
-o \'BQY0P.QY300A10.FEFI(+1)\'



and the resulting log:


 Resolving host address...
 1 address found: 10.0.0.2
 Connecting to 10.0.0.2 (10.0.0.2) port 21
--- 220 blaha FTP Proxy, Authorized use only, use user@host to login
--- USER US0@MVS3
--- 331-TCPFTPD1 IBM FTP CS V1R13 at mvs3ibm.sys.bla.ha, 10:02:08 on
2014-05-09.
--- 331-Connection will close if idle for more than 5 minutes.
--- 331 Send password please.
--- 230 US0 is logged on.  Working directory is US0..
--- PWD
--- 257 'US0.' is working directory.
--- TYPE I
--- 200 Type set to I
--- SITE SBD=(IBM-278,ISO8859-1)
200 SITE command was accepted
--- SITE LRECL=240
200 SITE command was accepted
--- SITE RECFM=FB
200-BLOCKSIZE must be a multiple of LRECL for RECFM FB
200-BLOCKSIZE being set to 6000
200 SITE command was accepted
--- TYPE A
--- 200 Type set to A
--- PASV
--- 227 Entering Passive Mode (10.0.0.2,201,78)
 Connecting data socket to (10.0.0.2) port 51534
 Data connection established
--- ALLO 4579
--- 202 ALLO not necessary, you may proceed
--- STOR 'BQY0P.QY300A10.FEFI(+1)'
--- 125-FTP Server unable to obtain EXCLUSIVE use of
BQY0P.QY300A10.FEFI.G0100V00 which is held by: UNKNOWN  UNKNOWN  UNKNOWN
 on UNKNOWN
--- 125 Data set BQY0P.QY300A10.FEFI.G0100V00 is not available
 Closing data socket
 Peer closed connection
 Closing control socket
 Connecting to 10.0.0.2 (10.0.0.2) port 21
--- 220 blaha FTP Proxy, Authorized use only, use user@host to login
--- USER US0@MVS3
--- 331-TCPFTPD1 IBM FTP CS V1R13 at mvs3ibm.sys.bla.ha, 10:02:38 on
2014-05-09.
--- 331-Connection will close if idle for more than 5 minutes.
--- 331 Send password please.
--- 230 US0 is logged on.  Working directory is US0..
--- TYPE I
--- 200 Type set to I
--- SIZE 'BQY0P.QY300A10.FEFI(+1)'
--- 501 command aborted -- FTP server not configured for SIZE
--- TYPE A
copy: put rolled back to 0, seeking get accordingly
--- 200 Type set to A
--- PASV
--- 227 Entering Passive Mode (10.0.0.2,202,240)
 Connecting data socket to (10.0.0.2) port 51952
 Data connection established
--- STOR 'BQY0P.QY300A10.FEFI(+1)'
--- 125 Storing data set BQY0P.QY300A10.FEFI.G0100V00
 Closing data socket
--- 250 Transfer completed successfully.
--- QUIT
 Closing control socket



As you can see, the SITE commands are not sent again after the second login
has been made after the connection loss.

Is there a way I can disable the reconnection and instead have LFTP fail
with non-zero result when the connection gets dropped? I would really
appreciate that.
It’s IBM on a mainframe I’m talking to. They are a bank. They don’t care
that they violate the RFC. We are their only customer that has issues with
this.



Thanks!

Mattias
___
lftp mailing list
lftp@uniyar.ac.ru
http://univ.uniyar.ac.ru/mailman/listinfo/lftp