Re: translation_file not saved in case of lstat problem
Brought to you by:
thesun
|
From: Shachar S. <sh...@sh...> - 2018-10-08 03:54:31
|
<html style="direction: ltr;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body bidimailui-charset-is-forced="true" style="direction: ltr;"
text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">I want to clarify the report. You are
not complaining about someone erasing the name translation file
during encryption. You are complaining about someone erasing one
of the <b>source</b> files. Is that correct?<br>
<br>
Erasing the name translation file or one of the encrypted files
during encryption is not a bug rsyncrypto is supposed to handle.
No one should be touching those during the encryption phase.
Erasing a source file is something that rsyncrypto should,
absolutely, be able to handle without failing outright.<br>
<br>
Thank you,<br>
Shachar<br>
<br>
On 07/10/18 11:14, <a class="moz-txt-link-abbreviated" href="mailto:sou...@co...">sou...@co...</a> wrote:<br>
</div>
<blockquote type="cite"
cite="mid:e8d...@co...">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<p>On 07/10/18 09:40, Shachar Shemesh wrote: </p>
<blockquote type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8">
<style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
<div class="moz-cite-prefix">On 06/10/18 11:51, <a
class="moz-txt-link-abbreviated"
href="mailto:sou...@co..."
moz-do-not-send="true">sou...@co...</a> wrote:<br>
</div>
<blockquote type="cite"
cite="mid:899...@co...">
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8">
<p>Hello Shachar,</p>
<p>hereby a scenario to reproduce many times. I've created a
set-up where you can reproduce numerous time, very quickly.</p>
<p>In scenario, I have a huge number of files in a directory,
when rsyncrypto is running, I suspend with Ctrl-Z, delete
all files in the directory, then continue unsuspending
rsyncrypto by bringing to the foreground with 'fg' command.</p>
<p>To be able to reproduce time-after-time, I'm keeping a copy
of the original big directory in repo-source-dir-copy<br>
</p>
</blockquote>
<p>Hello Johan,</p>
<p><br>
</p>
<p>I understand the scenario you describe. I just don't
understand how rsyncrypto is supposed to survive it.</p>
<p><br>
</p>
<p>As with many other programs, rsyncrypto expects the files it
needs not to shift around <i>while</i> it is manipulating
them.</p>
<p><br>
</p>
<p>Essentially, you are asking that if you delete the file
rsyncrypto is creating, that it not get deleted.</p>
<p><br>
</p>
<p>Am I missing something? Can you explain the real wold aim you
are trying to achieve that causes this condition to trigger?</p>
<p><br>
</p>
<p>Thank you,</p>
<p>Shachar<br>
</p>
<br>
</blockquote>
Hello Shachar,
<p>if during a run, there are hunderds of additional files
encrypted and sync, and there is one file that went missing
causing the lstat error, rsyncrypto behaves this lstat error as
a fatal error and doesn't update the translation file.</p>
<p>In addition, these hundreds of additional files are now
encrypted and can't be matched back to the original filename.
Also at the next run, rsyncrypto will create an additional copy
of these extra files.</p>
<p><br>
</p>
<p>What I'm asking for is that rsyncrypto doesn't handle this as a
fatal error and at the end of the run still update the
translation file when the lstat error occured.</p>
<p><br>
</p>
<p>I discovered the issue when running rsyncrypto on my home
directory when still working on my box which causes sometimes
that a file gets deleted.</p>
<p><br>
</p>
<p>The problem also happens when using --filelist, if there is an
error in that filelist, and there is a file that does not
exist, no translation file is saved, here output of such:</p>
<p><br>
</p>
<p> ./rsyncrypto -vv --changed --trim=0
--name-encrypt=./repo-encrypt-filename --ne-nesting=3
--filelist=file-list . ./repo-encrypted-dir ./SRCDIR.KEYS
./rckey.crt<br>
Encrypting file: ./repo-src-dir2/orig-file3<br>
Encrypting file: ./repo-src-dir2/orig-file4<br>
Error in encryption of ./repo-src-dir2/orig-file5: stat
failed(././repo-src-dir2/orig-file5): No such file or directory<br>
Exit code delayed from previous errors<br>
</p>
<p><br>
</p>
<p>A fix that I've found is to change the end of main.cpp to (and
move declaration of rsa_key to a higher level):</p>
<p><br>
</p>
<p> } catch( const rscerror &err ) {<br>
std::cerr<<err.error()<<std::endl;<br>
ret=1;<br>
if( encrypt && EXISTS(nameenc) ) {<br>
// Write the (possibly changed) filelist back to
the file<br>
filemap::write_map(FILENAME(nameenc));<br>
// Encrypt the filelist file itself<br>
file_encrypt(FILENAME(nameenc),
autofd::combine_paths(FILENAME(dst), FILEMAPNAME).<br>
c_str(),
autofd::combine_paths(FILENAME(key), FILEMAPNAME).c_str(),
rsa_key,<br>
NULL );<br>
}<br>
}<br>
<br>
return ret;<br>
}<br>
</p>
<p><br>
</p>
<p>Probably some extra logic to be added to only write translation
file in case of lstat error, not in case of other errors.</p>
<p><br>
</p>
<p>regards,</p>
<p>Johan<br>
</p>
<blockquote type="cite"> <br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Rsyncrypto-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Rsy...@li..." moz-do-not-send="true">Rsy...@li...</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/rsyncrypto-devel" moz-do-not-send="true">https://lists.sourceforge.net/lists/listinfo/rsyncrypto-devel</a>
</pre>
</blockquote>
<p><br>
</p>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Rsyncrypto-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Rsy...@li...">Rsy...@li...</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/rsyncrypto-devel">https://lists.sourceforge.net/lists/listinfo/rsyncrypto-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>
|