Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
6fa9f9d515
!41 backport some patches
From: @chengyechun 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
2025-03-24 09:13:25 +00:00
chengyechun
41d613ca1f backport some patches 2025-03-24 16:51:10 +08:00
openeuler-ci-bot
71bb53bd7a
!34 sync some patch
From: @chengyechun 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
2024-11-13 01:18:00 +00:00
chengyechun
22ea1954a3 fix sftp too many out of order packets 2024-11-11 14:39:33 +08:00
openeuler-ci-bot
e18d110e77
!28 sync upstream patch
From: @chengyechun 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
2024-08-05 02:14:41 +00:00
chengyechun
7e6b655dfd snyc some patches 2024-08-02 14:49:29 +08:00
openeuler-ci-bot
67b61def2c
!26 [sync] PR-25: update the release version
From: @openeuler-sync-bot 
Reviewed-by: @robertxw 
Signed-off-by: @robertxw
2024-03-28 07:37:20 +00:00
chengyechun
3036fd141d update the release version
(cherry picked from commit e7e6a71cbbf2a9828ac022ed10ca19ca811339cb)
2024-03-28 15:24:12 +08:00
openeuler-ci-bot
ef8bb83b50
!19 update some patches from community
From: @chengyechun 
Reviewed-by: @seuzw 
Signed-off-by: @seuzw
2022-10-17 08:30:50 +00:00
chengyechun
c2686e9235 fix second find_cmd Segmentation fault 2022-09-13 16:30:58 +08:00
9 changed files with 378 additions and 2 deletions

View File

@ -0,0 +1,30 @@
From 40c20c587ed6435bb489f31c0aac94c2ca828f4a Mon Sep 17 00:00:00 2001
From: Kevin Adler <kadler@su.ibm.com>
Date: Sat, 23 Jul 2022 16:39:40 +0800
Subject: [PATCH] Ensure that PollVec enum matches poll values
Conflict:NA
Reference:https://github.com/lavv17/lftp/commit/40c20c587ed6435bb489f31c0aac94c2ca828f4a
---
src/PollVec.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/PollVec.h b/src/PollVec.h
index fda75a4..296f2f2 100644
--- a/src/PollVec.h
+++ b/src/PollVec.h
@@ -59,8 +59,8 @@ public:
void Block();
enum {
- IN=1,
- OUT=4,
+ IN=POLLIN,
+ OUT=POLLOUT,
};
void SetTimeout(const timeval &t) { tv_timeout=t; }
--
2.23.0

View File

@ -0,0 +1,33 @@
From d67fc14d085849a6b0418bb3e912fea2e94c18d1 Mon Sep 17 00:00:00 2001
From: "Alexander V. Lukyanov" <lavv17f@gmail.com>
Date: Sat, 28 Nov 2020 20:09:11 +0300
Subject: [PATCH] fix a coredump in TorrentTracker (fix #513)
Conflict: NA
Reference: https://github.com/lavv17/lftp/commit/d67fc14d085849a6b0418bb3e912fea2e94c18d1
---
src/TorrentTracker.cc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/TorrentTracker.cc b/src/TorrentTracker.cc
index f867c334..30b531ce 100644
--- a/src/TorrentTracker.cc
+++ b/src/TorrentTracker.cc
@@ -121,7 +121,7 @@ bool TorrentTracker::AddPeer(const xstring& addr,int port) const
int TorrentTracker::Do()
{
int m=STALL;
- if(Failed())
+ if(Failed() || !backend)
return m;
if(backend && backend->IsActive()) {
if(tracker_timeout_timer.Stopped()) {
@@ -165,6 +165,8 @@ void TorrentTracker::Start()
}
void TorrentTracker::SendTrackerRequest(const char *event)
{
+ if(!backend)
+ return;
backend->SendTrackerRequest(event);
tracker_timeout_timer.Reset();
}

View File

@ -0,0 +1,47 @@
From ced8ab2f95695aee05424e9aa206cd59a3f90888 Mon Sep 17 00:00:00 2001
From: "Alexander V. Lukyanov" <lavv17f@gmail.com>
Date: Mon, 5 Jul 2021 19:59:33 +0300
Subject: [PATCH] fix a null deref on exit
Conflict: NA
Reference: https://github.com/lavv17/lftp/commit/ced8ab2f95695aee05424e9aa206cd59a3f90888
---
src/Job.cc | 7 +++++--
src/SMTask.cc | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/Job.cc b/src/Job.cc
index 63be3fb5..b783eae4 100644
--- a/src/Job.cc
+++ b/src/Job.cc
@@ -365,12 +365,15 @@ xstring& Job::FormatJobs(xstring& s,int verbose,int indent)
void Job::BuryDoneJobs()
{
- xlist_for_each_safe(Job,all_jobs,node,scan,next)
+ xarray<Job*> to_bury;
+ xlist_for_each(Job,all_jobs,node,scan)
{
if((scan->parent==this || scan->parent==0) && scan->jobno>=0
&& scan->Done())
- scan->DeleteLater();
+ to_bury.append(scan);
}
+ for(int i=0; i<to_bury.count(); i++)
+ to_bury[i]->DeleteLater();
CollectGarbage();
}
diff --git a/src/SMTask.cc b/src/SMTask.cc
index b8a84e2f..435ab8c3 100644
--- a/src/SMTask.cc
+++ b/src/SMTask.cc
@@ -129,6 +129,7 @@ void SMTask::DeleteLater()
{
if(deleting)
return;
+ DEBUG(("DeleteLater(%p) from %p\n",this,current));
deleting=true;
deleted_tasks.add_tail(deleted_tasks_node);
PrepareToDie();

View File

@ -0,0 +1,29 @@
From 9697856be9af5f3d51a85ef29b02d956b94b0b55 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A8=8B=E4=B8=9A=E6=98=A5?=
<57088250+chengyechun@users.noreply.github.com>
Date: Thu, 10 Oct 2024 14:48:39 +0800
Subject: [PATCH] Update FileCopy.cc
File growth can be calculated only if it is strictly greater than
Conflict:NA
Reference:https://github.com/lavv17/lftp/commit/9697856be9af5f3d51a85ef29b02d956b94b0b55
---
src/FileCopy.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/FileCopy.cc b/src/FileCopy.cc
index 31d4e066..0d71d29b 100644
--- a/src/FileCopy.cc
+++ b/src/FileCopy.cc
@@ -1137,7 +1137,8 @@ void FileCopyPeerFA::OpenSession()
debug((10,"copy dst: seek past eof (seek_pos=%lld, size=%lld)\n",
(long long)seek_pos,(long long)e_size));
eof=true;
- fileincreased=true;
+ if(seek_pos>e_size)
+ fileincreased=true;
if(date==NO_DATE || date==NO_DATE_YET)
return;
}

View File

@ -0,0 +1,94 @@
From 0ead378c8a19d4c7b86e35265a7f6e878fd63c0d Mon Sep 17 00:00:00 2001
From: "Alexander V. Lukyanov" <lavv17@gmail.com>
Date: Wed, 20 Apr 2022 23:32:37 +0300
Subject: [PATCH] fix second find_cmd Segmentation fault
Conflict:NA
Reference:https://github.com/lavv17/lftp/commit/0ead378c8a19d4c7b86e35265a7f6e878fd63c0d
---
src/GetFileInfo.cc | 34 +++++++++++++++++++++++-----------
src/GetFileInfo.h | 2 ++
2 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/src/GetFileInfo.cc b/src/GetFileInfo.cc
index 7afb3d8..4d08dfa 100644
--- a/src/GetFileInfo.cc
+++ b/src/GetFileInfo.cc
@@ -114,6 +114,22 @@ void GetFileInfo::PrepareToDie()
}
}
+void GetFileInfo::MakeVerifyFileName()
+{
+ /* Here we should have the home directory path. Find out
+ * the real name of the path. (we may have something like "~..".) */
+
+ FileAccess::Path pwd(session->GetCwd());
+
+ session->SetCwd(origdir);
+ session->Chdir(dir, false);
+
+ verify_fn.set(basename_ptr(session->GetCwd()));
+
+ /* go back */
+ session->SetCwd(pwd);
+}
+
int GetFileInfo::Do()
{
int res;
@@ -241,6 +257,8 @@ int GetFileInfo::Do()
if(!saved_error_text)
saved_error_text.set(session->StrError(res));
session->Close();
+ if(!verify_fn)
+ MakeVerifyFileName();
if(res==FA::NO_FILE)
{
/* If this is a CWD to the parent, and it failed, we
@@ -262,17 +280,7 @@ int GetFileInfo::Do()
/* Now that we've connected, we should have the home directory path. Find out
* the real name of the path. (We may have something like "~/..".) */
if(!verify_fn)
- {
- FileAccess::Path pwd(session->GetCwd());
-
- session->SetCwd(origdir);
- session->Chdir(dir, false);
-
- verify_fn.set(basename_ptr(session->GetCwd()));
-
- /* go back */
- session->SetCwd(pwd);
- }
+ MakeVerifyFileName();
/* Special case: looking up "/". Make a phony entry. */
if(showdir && !strcmp(verify_fn, "/"))
@@ -390,6 +398,10 @@ int GetFileInfo::Do()
* also serves as a last attempt to see if the file exists--we
* only get here if everything else thinks the path doesn't exist.
*/
+
+ /* verify_fn_mabe null. */
+ if(!verify_fn)
+ MakeVerifyFileName();
FileInfo *fi=new FileInfo(verify_fn);
fi->need=need;
/* We need to do at least one. */
diff --git a/src/GetFileInfo.h b/src/GetFileInfo.h
index 1ac8f4d..483dcc3 100644
--- a/src/GetFileInfo.h
+++ b/src/GetFileInfo.h
@@ -66,6 +66,8 @@ class GetFileInfo : public ListInfo
void PrepareToDie();
+ void MakeVerifyFileName();
+
public:
GetFileInfo(const FileAccessRef& a, const char *path, bool showdir);
virtual ~GetFileInfo();
--
2.23.0

View File

@ -0,0 +1,75 @@
From fdb81537a2f854cf5e2b9dd95c7e5542bb5cd420 Mon Sep 17 00:00:00 2001
From: Paul Dennis <padenn@github.com>
Date: Mon, 29 Jul 2024 16:43:02 -0400
Subject: [PATCH] Attempt to fix SFTP issue #636 Too many out-of-order packets.
lftp supports making many SFTP DATA requests in parallel when downloading a file. Responses
with data payloads from an sftp server can sometimes arrive in a different order from the
original requests.
The out of order data payload (packets) are added to the `ooo_chain` to be processed when the expected
(but late) next requested packet arrives.
A single packet being delayed while many parallel requests continue to be made can sometimes result in the
`Too many out-of-order packets` message if the `ooo_chain` buffer of 64 entries is exceeded.
This fix checks the remaining capacity of the `ooo_chain` and pending requests (`RespQueueSize()`)
and will avoid sending new requests for more data until the `ooo_chain` is processed or `RespQueueSize()`
shrinks. Adding this constraint does mean that `sftp:max-packets-in-flight` will be limited to
the current `ooo_chain` length of 64.
I was able to reliably reproduce the issue with a 4gb download and verify the fix.
Conflict:NA
Reference:https://github/lavv17/lftp/commit/fdb81537a2f854cf5e2b9dd95c7e5542bb5cd420
---
src/SFtp.cc | 8 ++++++--
src/SFtp.h | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/SFtp.cc b/src/SFtp.cc
index 6c818dfa1..5879a6314 100644
--- a/src/SFtp.cc
+++ b/src/SFtp.cc
@@ -344,6 +344,7 @@ void SFtp::Init()
size_write=0x8000;
use_full_path=false;
flush_timer.Set(0,500);
+ max_out_of_order=64;
}
SFtp::SFtp() : SSH_Access("SFTP:")
@@ -892,7 +893,7 @@ void SFtp::HandleExpect(Expect *e)
{
LogNote(9,"put a packet with id=%d on out-of-order chain (need_pos=%lld packet_pos=%lld)",
reply->GetID(),(long long)(pos+file_buf->Size()),(long long)r->pos);
- if(ooo_chain.count()>=64)
+ if(ooo_chain.count()>=max_out_of_order)
{
LogError(0,"Too many out-of-order packets");
Disconnect();
@@ -1192,7 +1193,10 @@ int SFtp::Read(Buffer *buf,int size)
{
// keep some packets in flight.
int limit=(entity_size>=0?max_packets_in_flight:max_packets_in_flight_slow_start);
- if(RespQueueSize()<limit && !file_buf->Eof())
+ int ooo_queue_available=max_out_of_order-ooo_chain.count();
+ int current_in_flight=RespQueueSize();
+ if(RespQueueSize()<limit && !file_buf->Eof()
+ && current_in_flight < ooo_queue_available)
{
// but don't request much after possible EOF.
if(entity_size<0 || request_pos<entity_size || RespQueueSize()<2)
diff --git a/src/SFtp.h b/src/SFtp.h
index 50888b376..2099440c6 100644
--- a/src/SFtp.h
+++ b/src/SFtp.h
@@ -755,6 +755,7 @@ enum sftp_status_t {
int size_read;
int size_write;
bool use_full_path;
+ int max_out_of_order;
protected:
void SetError(int code,const Packet *reply);

View File

@ -0,0 +1,28 @@
From e71135d7523bcb992764e37d3238db477a8b1842 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A8=8B=E4=B8=9A=E6=98=A5?=
<57088250+chengyechun@users.noreply.github.com>
Date: Thu, 10 Oct 2024 14:51:31 +0800
Subject: [PATCH] Update FileAccess.h
The first transmission is not counted as retransmission. Therefore, the number of retransmission attempts must be greater than the configured number of retransmissions.
Conflict:NA
Reference:https://github.com/lavv17/lft/commit/e71135d7523bcb992764e37d3238db477a8b1842
---
src/FileAccess.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/FileAccess.h b/src/FileAccess.h
index 1bd081151..4d8e252f7 100644
--- a/src/FileAccess.h
+++ b/src/FileAccess.h
@@ -565,7 +565,7 @@ class UploadState
retries=session->GetRetries();
off_t pos=session->GetRealPos();
int max_retries=session->GetMaxRetries();
- if(max_retries>0 && retries>=max_retries)
+ if(max_retries>0 && retries>max_retries)
pos=0;
if(pos_watermark<pos) {
pos_watermark=pos;

View File

@ -1,7 +1,7 @@
Summary: A sophisticated file transfer program
Name: lftp
Version: 4.9.2
Release: 2
Release: 7
License: GPLv3+
URL: http://lftp.yar.ru/
Source0: http://lftp.yar.ru/ftp/%{name}-%{version}.tar.xz
@ -10,7 +10,15 @@ BuildRequires: gettext readline-devel, zlib-devel, gcc-c++ desktop-file-utils
BuildRequires: chrpath
Patch0: lftp-4.0.9-date_fmt.patch
Patch1: Quit-while-source-file-increased.patch
Patch6000: backport-fix-a-coredump-in-TorrentTracker-fix-513.patch
Patch6001: backport-fix-a-null-deref-on-exit.patch
Patch6002: backport-Quit-while-source-file-increased.patch
Patch6003: backport-Ensure-that-PollVec-enum-matches-poll-values.patch
Patch6004: backport-fix-second-find_cmd-Segmentation-fault.patch
Patch6005: backport-fix-sftp-too-many-out-of-order-packets.patch
Patch6006: backport-fix-file-growth-when-strictly-greater-than.patch
Patch6007: backport-fix-the-error-of-retransmission.patch
%description
LFTP is a sophisticated file transfer program supporting a number of
@ -84,6 +92,38 @@ echo "%{_libdir}/lftp/%{version}" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arc
%changelog
* Mon Mar 24 2025 chengyechun <chengyechun1@huawei.com> - 4.9.2-7
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:File growth can be calculated only if it is strictly greater than
fix the error of retransmission
* Mon Nov 11 2024 chengyechun <chengyechun1@huawei.com> - 4.9.2-6
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix sftp too many out of order packets
* Fri Aug 02 2024 chengyechun <chengyechun1@huawei.com> - 4.9.2-5
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:sync some patches and rename a patch
* Thu Mar 28 2024 chengyechun <chengyechun1@huawei.com> - 4.9.2-4
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:update the release version
* Thu Sep 8 2022 chengyechun <chengyechun1@huawei.com> - 4.9.2-3
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix second find_cmd Segmentation fault
Ensure that PollVec enum matches poll values
* Thu Oct 28 2021 zhouyihang <zhouyihang3@huawei.com> - 4.9.2-2
- Type:bugfix
- ID:NA