[packages/lftp] - rel 3; make xfer:clobber work for regular files only (so no need for it if you want to write to /d

arekm arekm at pld-linux.org
Fri Jul 8 10:54:12 CEST 2016


commit 6f16b93546e708d991137b58be3bdec220b55165
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Fri Jul 8 10:47:58 2016 +0200

    - rel 3; make xfer:clobber work for regular files only (so no need for it if you want to write to /dev/null for example)

 lftp-bug-254.patch | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 lftp.spec          |  4 +++-
 2 files changed, 56 insertions(+), 1 deletion(-)
---
diff --git a/lftp.spec b/lftp.spec
index 84251e7..f0b5a0f 100644
--- a/lftp.spec
+++ b/lftp.spec
@@ -24,7 +24,7 @@ Summary(pt_BR.UTF-8):	Sofisticado programa de transferência de arquivos (client
 Summary(zh_CN.UTF-8):	lftp 客户端程序
 Name:		lftp
 Version:	4.7.2
-Release:	2
+Release:	3
 License:	GPL v3+
 Group:		Applications/Networking
 Source0:	http://lftp.yar.ru/ftp/%{name}-%{version}.tar.xz
@@ -41,6 +41,7 @@ Patch2:		aliases.patch
 Patch3:		%{name}-pl.po-update.patch
 Patch4:		%{name}-am.patch
 Patch5:		lftp-bug-250.patch
+Patch6:		lftp-bug-254.patch
 URL:		http://lftp.yar.ru/
 BuildRequires:	autoconf >= 2.60
 BuildRequires:	automake
@@ -99,6 +100,7 @@ o arquivo FEATURES para uma lista mais detalhada.
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
 
 %{__rm} po/stamp-po
 
diff --git a/lftp-bug-254.patch b/lftp-bug-254.patch
new file mode 100644
index 0000000..772f47a
--- /dev/null
+++ b/lftp-bug-254.patch
@@ -0,0 +1,53 @@
+From 389ea5d8063b01d3bdbed117e7da7f80e312bc88 Mon Sep 17 00:00:00 2001
+From: "Alexander V. Lukyanov" <lavv17f at gmail.com>
+Date: Fri, 8 Jul 2016 10:59:48 +0300
+Subject: [PATCH] GetJob: apply noclobber setting to plain files only.
+
+---
+ NEWS          |  1 +
+ src/GetJob.cc | 27 ++++++++++++++-------------
+ 2 files changed, 15 insertions(+), 13 deletions(-)
+
+diff --git a/src/GetJob.cc b/src/GetJob.cc
+index 7afba0a..683b666 100644
+--- a/src/GetJob.cc
++++ b/src/GetJob.cc
+@@ -65,24 +65,25 @@ FileCopyPeer *GetJob::SrcLocal(const char *src)
+ FileCopyPeer *GetJob::DstLocal(const char *dst)
+ {
+    bool clobber=(cont || QueryBool("xfer:clobber",0));
+-   int flags=O_WRONLY|O_CREAT|(truncate_target_first?O_TRUNC:0)|(clobber?0:O_EXCL);
++   int flags=O_WRONLY|O_CREAT|(truncate_target_first?O_TRUNC:0);
+    dst=expand_home_relative(dst);
+    const char *f=(cwd && dst[0]!='/') ? dir_file(cwd,dst) : dst;
+-   if(truncate_target_first && QueryBool("xfer:make-backup",0))
++
++   struct stat st;
++   if(stat(f,&st)!=-1)
+    {
+-      /* rename old file if exists and size>0 */
+-      struct stat st;
+-      if(stat(f,&st)!=-1)
++      if(st.st_size>0 && S_ISREG(st.st_mode))
+       {
+-	 if(st.st_size>0 && S_ISREG(st.st_mode))
++	 if(!clobber)
++	 {
++	    eprintf(_("%s: %s: file already exists and xfer:clobber is unset\n"),op,dst);
++	    errors++;
++	    count++;
++	    return 0;
++	 }
++	 if(truncate_target_first && QueryBool("xfer:make-backup",0))
+ 	 {
+-	    if(!clobber)
+-	    {
+-	       eprintf(_("%s: %s: file already exists and xfer:clobber is unset\n"),op,dst);
+-	       errors++;
+-	       count++;
+-	       return 0;
+-	    }
++	    /* rename old file if exists and size>0 */
+ 	    xstring_ca suffix(xstrftime(Query("xfer:backup-suffix",0),now));
+ 	    backup_file.set(f).append(suffix);
+ 	    if(rename(f,backup_file)!=0)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/lftp.git/commitdiff/6f16b93546e708d991137b58be3bdec220b55165



More information about the pld-cvs-commit mailing list