Re: Bug in lftp mirror when using xfer:use-temp-file option

Alexander Lukyanov <[email protected]> Mon, 27 Oct 2014 15:31:37 +0400
Newsgroups gmane.network.lftp.user,gmane.network.lftp.devel
Message-ID <CANnoEwpTdXKt5+9tD6q8__8ui-ih0tU3TL+hBLwNzzhuOVs9Mg@mail.gmail.com>
--===============3370782155202450384==
Content-Type: multipart/alternative; boundary=001a11c34e10b1b99d050665df84

--001a11c34e10b1b99d050665df84
Content-Type: text/plain; charset=UTF-8

This change should fix the problem.
https://github.com/lavv17/lftp/commit/b1164d695393cf8ec8429bb2b5caa9f05cfc4d39

2014-10-27 14:20 GMT+03:00 Alexander Lukyanov <[email protected]>:

> I have found the bug. As a workaround, use "set xfer:clobber yes".
>
> 2014-10-27 13:06 GMT+03:00 akshay gupta <[email protected]>:
>
>> no, I am running as a root user. There is some issue with lftp, when file
>> with same name already exist its not able to rename the temp file to actual
>> file.
>>
>> On Mon, Oct 27, 2014 at 1:44 PM, Alexander V. Lukyanov <[email protected]>
>> wrote:
>>
>>> On Mon, Oct 27, 2014 at 01:30:42PM +0530, akshay gupta wrote:
>>> > ---> RETR test.txt
>>> > <--- 150 Opening BINARY mode data connection for 'test.txt' (202
>>> bytes).
>>> > ---- Got EOF on data connection
>>> > ---- Closing data socket
>>> > <--- 226 Transfer complete.
>>>
>>> So the file cannot be renamed locally, right? Is there a permissions
>>> problem?
>>>
>>> --
>>>    Alexander.
>>>
>>> > On Mon, Oct 27, 2014 at 1:18 PM, Alexander Lukyanov <[email protected]
>>> >
>>> > wrote:
>>> >
>>> > > Can you provide a debug log? Why lftp cannot replace the old file?
>>> > >
>>> > > 2014-10-27 10:44 GMT+03:00 akshay gupta <[email protected]>:
>>> > >
>>> > >> Hi,
>>> > >>
>>> > >> I am trying to mirror files using lftp, I have tested a use case
>>> where a
>>> > >> file at the source machine gets modified but the file name remains
>>> the
>>> > >> same. After mirroring, lftp is unable to replace the old file and
>>> also
>>> > >> leaves a temporary file.
>>> > >>
>>> > >> For example. If source have file a.txt and its mirrored
>>> successfully at
>>> > >> the destination, now if I update a.txt append some content and save
>>> it with
>>> > >> same name. If I run lftp mirror again then its not able to replace
>>> the
>>> > >> existing a.txt but it also leaves the temp file a.txt_transit_
>>> behind. And
>>> > >> if i run the mirror multiple times it always downloads the changed
>>> a.txt, i
>>> > >> can see this from the lftp logs.
>>> > >>
>>> > >> Suggestion: Will it make sense to keep versions of the files as
>>> they are
>>> > >> updated at the source. Like if a.txt is changed at source then lftp
>>> mirror
>>> > >> will save it as a.txt_{TIMESTAMP}_. Every time a file is updated it
>>> will be
>>> > >> saved with a new time stamp. And mirror will consider these file to
>>> decide
>>> > >> whether to download or not.
>>> > >>
>>> > >>
>>> > >> Thanks,
>>> > >> Akshay
>>> > >>
>>> > >>
>>> > >>
>>> > >>
>>> > >>
>>> > >
>>> > >
>>> > > --
>>> > >    Alexander.
>>> > >
>>>
>>> > _______________________________________________
>>> > lftp mailing list
>>> > [email protected]
>>> > http://univ.uniyar.ac.ru/mailman/listinfo/lftp
>>>
>>>
>>
>
>
> --
>    Alexander.
>



-- 
   Alexander.

--001a11c34e10b1b99d050665df84
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">This change should fix the problem.<br><a href=3D"https://=
github.com/lavv17/lftp/commit/b1164d695393cf8ec8429bb2b5caa9f05cfc4d39">htt=
ps://github.com/lavv17/lftp/commit/b1164d695393cf8ec8429bb2b5caa9f05cfc4d39=
</a><br></div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">201=
4-10-27 14:20 GMT+03:00 Alexander Lukyanov <span dir=3D"ltr">&lt;<a href=3D=
"mailto:[email protected]" target=3D"_blank">[email protected]</a>&gt;</spa=
n>:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-=
left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">I have found the bug=
. As a workaround, use &quot;set xfer:clobber yes&quot;.<br></div><div clas=
s=3D"gmail_extra"><div><div class=3D"h5"><br><div class=3D"gmail_quote">201=
4-10-27 13:06 GMT+03:00 akshay gupta <span dir=3D"ltr">&lt;<a href=3D"mailt=
o:[email protected]" target=3D"_blank">[email protected]</a>&=
gt;</span>:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex=
;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">no, I am run=
ning as a root user. There is some issue with lftp, when file with same nam=
e already exist its not able to rename the temp file to actual file.</div><=
div><div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Mon, =
Oct 27, 2014 at 1:44 PM, Alexander V. Lukyanov <span dir=3D"ltr">&lt;<a hre=
f=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>&gt;</span> wro=
te:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-=
left:1px #ccc solid;padding-left:1ex"><span>On Mon, Oct 27, 2014 at 01:30:4=
2PM +0530, akshay gupta wrote:<br>
&gt; ---&gt; RETR test.txt<br>
&gt; &lt;--- 150 Opening BINARY mode data connection for &#39;test.txt&#39;=
 (202 bytes).<br>
&gt; ---- Got EOF on data connection<br>
&gt; ---- Closing data socket<br>
&gt; &lt;--- 226 Transfer complete.<br>
<br>
</span>So the file cannot be renamed locally, right? Is there a permissions=
 problem?<br>
<br>
--<br>
=C2=A0 =C2=A0Alexander.<br>
<span><br>
&gt; On Mon, Oct 27, 2014 at 1:18 PM, Alexander Lukyanov &lt;<a href=3D"mai=
lto:[email protected]" target=3D"_blank">[email protected]</a>&gt;<br>
&gt; wrote:<br>
&gt;<br>
&gt; &gt; Can you provide a debug log? Why lftp cannot replace the old file=
?<br>
&gt; &gt;<br>
&gt; &gt; 2014-10-27 10:44 GMT+03:00 akshay gupta &lt;<a href=3D"mailto:aks=
[email protected]" target=3D"_blank">[email protected]</a>&gt;:<=
br>
&gt; &gt;<br>
&gt; &gt;&gt; Hi,<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; I am trying to mirror files using lftp, I have tested a use c=
ase where a<br>
&gt; &gt;&gt; file at the source machine gets modified but the file name re=
mains the<br>
&gt; &gt;&gt; same. After mirroring, lftp is unable to replace the old file=
 and also<br>
&gt; &gt;&gt; leaves a temporary file.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; For example. If source have file a.txt and its mirrored succe=
ssfully at<br>
&gt; &gt;&gt; the destination, now if I update a.txt append some content an=
d save it with<br>
&gt; &gt;&gt; same name. If I run lftp mirror again then its not able to re=
place the<br>
&gt; &gt;&gt; existing a.txt but it also leaves the temp file a.txt_transit=
_ behind. And<br>
&gt; &gt;&gt; if i run the mirror multiple times it always downloads the ch=
anged a.txt, i<br>
&gt; &gt;&gt; can see this from the lftp logs.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Suggestion: Will it make sense to keep versions of the files =
as they are<br>
&gt; &gt;&gt; updated at the source. Like if a.txt is changed at source the=
n lftp mirror<br>
&gt; &gt;&gt; will save it as a.txt_{TIMESTAMP}_. Every time a file is upda=
ted it will be<br>
&gt; &gt;&gt; saved with a new time stamp. And mirror will consider these f=
ile to decide<br>
&gt; &gt;&gt; whether to download or not.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Thanks,<br>
&gt; &gt;&gt; Akshay<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt;=C2=A0 =C2=A0 Alexander.<br>
&gt; &gt;<br>
<br>
</span>&gt; _______________________________________________<br>
&gt; lftp mailing list<br>
&gt; <a href=3D"mailto:[email protected]" target=3D"_blank">[email protected].=
ru</a><br>
&gt; <a href=3D"http://univ.uniyar.ac.ru/mailman/listinfo/lftp" target=3D"_=
blank">http://univ.uniyar.ac.ru/mailman/listinfo/lftp</a><br>
<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear=3D"all"><br></div></div><span =
class=3D"HOEnZb"><font color=3D"#888888">-- <br><div dir=3D"ltr"><div></div=
>=C2=A0=C2=A0 Alexander.<br></div>
</font></span></div>
</blockquote></div><br><br clear=3D"all"><br>-- <br><div dir=3D"ltr"><div><=
/div>=C2=A0=C2=A0 Alexander.<br></div>
</div>

--001a11c34e10b1b99d050665df84--

--===============3370782155202450384==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
lftp mailing list
[email protected]
http://univ.uniyar.ac.ru/mailman/listinfo/lftp

--===============3370782155202450384==--