* [pbs-devel] [PATCH proxmox-backup] pxar/create: fix endless loop for shrinking files
@ 2020-11-05 8:17 Dominik Csapak
2020-11-05 9:34 ` [pbs-devel] applied: " Wolfgang Bumiller
0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2020-11-05 8:17 UTC (permalink / raw)
To: pbs-devel
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@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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pbs-devel] applied: [PATCH proxmox-backup] pxar/create: fix endless loop for shrinking files
2020-11-05 8:17 [pbs-devel] [PATCH proxmox-backup] pxar/create: fix endless loop for shrinking files Dominik Csapak
@ 2020-11-05 9:34 ` Wolfgang Bumiller
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Bumiller @ 2020-11-05 9:34 UTC (permalink / raw)
To: Dominik Csapak; +Cc: pbs-devel
On Thu, Nov 05, 2020 at 09:17:43AM +0100, Dominik Csapak wrote:
> 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@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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-05 9:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 8:17 [pbs-devel] [PATCH proxmox-backup] pxar/create: fix endless loop for shrinking files Dominik Csapak
2020-11-05 9:34 ` [pbs-devel] applied: " Wolfgang Bumiller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox