[pbs-devel] [PATCH proxmox-backup] pxar/create: fix endless loop for shrinking files

Dominik Csapak d.csapak at proxmox.com
Thu Nov 5 09:17:43 CET 2020


when a file shrunk during backup, we endlessly looped, reading/copying 0 bytes
we already have code that handles shrunk files, but we forgot to
break from the read loop

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/pxar/create.rs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/pxar/create.rs b/src/pxar/create.rs
index 6ba6f15c..f4c735d0 100644
--- a/src/pxar/create.rs
+++ b/src/pxar/create.rs
@@ -661,6 +661,8 @@ impl<'a, 'b> Archiver<'a, 'b> {
             if got as u64 > remaining {
                 self.report_file_grew_while_reading()?;
                 got = remaining as usize;
+            } else if got == 0 {
+                break; // we reached eof
             }
             out.write_all(&self.file_copy_buffer[..got])?;
             remaining -= got as u64;
-- 
2.20.1






More information about the pbs-devel mailing list