Bug#711164: lftp splits input script file after byte 4096 - patch

2013-06-07 Thread Marko Randjelovic
Besides the upstream author didn't yet answer my email, it's probably better 
anyway I submit my patch for this bug, and the author, as well as anyone else 
interested, may comment on it afterwards.

==
diff -uNpr lftp-4.3.6/src/CmdExec.cc lftp-4.3.7/src/CmdExec.cc
--- lftp-4.3.6/src/CmdExec.cc2012-01-24 10:38:25.0 +0100
+++ lftp-4.3.7/src/CmdExec.cc2012-05-30 08:18:54.0 +0200
@@ -351,7 +351,7 @@ void CmdExec::AtFinish()
 {
if(queue_feeder  queue_feeder-JobCount())
   return;
-   if(!fed_at_finish  NumAwaitedJobs()==0) {
+   if(!fed_at_finish  NumAwaitedJobs()==0  cmd_buf.Size()==0) {
   
FeedCmd(ResMgr::Query(queue_feeder?cmd:at-queue-finish:cmd:at-finish,0));
   FeedCmd(\n);
   fed_at_finish=true;
diff -uNpr lftp-4.3.6/src/FileFeeder.cc lftp-4.3.7/src/FileFeeder.cc
--- lftp-4.3.6/src/FileFeeder.cc2012-01-24 10:38:25.0 +0100
+++ lftp-4.3.7/src/FileFeeder.cc2012-05-30 07:49:12.0 +0200
@@ -36,7 +36,7 @@ const char *FileFeeder::NextCmd(CmdExec
}
if(fg_data==0)
   fg_data=new FgData(in-GetProcGroup(),true);
-   int res=read(fd,buffer,buffer_size-1);
+   int res=read(fd,buffer,sizeof(buffer)-1);
if(res==0)
{
   return 0;
diff -uNpr lftp-4.3.6/src/FileFeeder.h lftp-4.3.7/src/FileFeeder.h
--- lftp-4.3.6/src/FileFeeder.h2012-01-24 10:38:26.0 +0100
+++ lftp-4.3.7/src/FileFeeder.h2012-05-30 07:48:46.0 +0200
@@ -25,9 +25,8 @@
 class FileFeeder : public CmdFeeder
 {
RefFDStream in;
-   enum { buffer_size=0x1000 };
-   char buffer[buffer_size];
RefFgData fg_data;
+   char buffer[0x1001];
 public:
const char *NextCmd(CmdExec *exec,const char *prompt);
FileFeeder(FDStream *in);
==

-- 
Marko Ranđelović, B.Sc.
Software Developer
Niš, Serbia
marko...@eunet.rs


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#711164: lftp splits input script file after byte 4096

2013-06-05 Thread Marko Randjelovic
Package: lftp
Version: 4.3.6-1+deb7u3
Severity: normal

I was testing Wheezy and I ran lftp with this script:

open http://server
get /test/001.txt /test/002.txt ... /test/999.txt

I get this output:

get: Access failed: 404 Not Found (/test/2)
Unknown command `91.txt'.

It is because the file is split after byte 4096 and it's in the middle of word 
/test/291.txt.

To reproduce this bug, run lftp with any script file which size in more than 
4096 bytes.

I will provide a patch for this bug after consultations with the upstream 
author.

-- System Information:
Debian Release: 7.0
  APT prefers stable-updates
  APT policy: (910, 'stable-updates'), (910, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages lftp depends on:
ii  libc6 2.13-38
ii  libgcc1   1:4.7.2-5
ii  libgnutls26   2.12.20-7
ii  libreadline6  6.2+dfsg-0.1
ii  libtinfo5 5.9-10
ii  netbase   5.0

lftp recommends no packages.

lftp suggests no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org