From 523ac7e7dd5a2f97711fa369f7a73e43ff7b49bc Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sat, 29 Apr 2023 12:49:53 +0300 Subject: [PATCH] Fixed nncp-reass's badSize calculation --- doc/news.ru.texi | 13 +++++++++++++ doc/news.texi | 13 +++++++++++++ src/cmd/nncp-reass/main.go | 3 ++- src/nncp.go | 2 +- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/doc/news.ru.texi b/doc/news.ru.texi index 49e7778..bc331a8 100644 --- a/doc/news.ru.texi +++ b/doc/news.ru.texi @@ -1,6 +1,19 @@ @node Новости @section Новости +@node Релиз 8.8.3 +@subsection Релиз 8.8.3 +@itemize + +@item +Исправлена @command{nncp-reass} команда, которая некорректно сообщала о +плохом размере последнего куска файла если он был кратен размеру chunk-а. + +@item +Обновлены зависимости. Теперь требуется Go 1.20+. + +@end itemize + @node Релиз 8.8.2 @subsection Релиз 8.8.2 @itemize diff --git a/doc/news.texi b/doc/news.texi index 50f675b..fa97340 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -4,6 +4,19 @@ See also this page @ref{Новости, on russian}. +@node Release 8_8_3 +@section Release 8.8.3 +@itemize + +@item +Fixed @command{nncp-reass} command, that incorrectly reported about +wrong last chunk's size if it is multiple of the chunk-size. + +@item +Updated dependencies. Go 1.20+ is required now. + +@end itemize + @node Release 8_8_2 @section Release 8.8.2 @itemize diff --git a/src/cmd/nncp-reass/main.go b/src/cmd/nncp-reass/main.go index ac52eeb..e92a2e5 100644 --- a/src/cmd/nncp-reass/main.go +++ b/src/cmd/nncp-reass/main.go @@ -125,7 +125,8 @@ func process(ctx *nncp.Ctx, path string, keep, dryRun, stdout, dumpMeta bool) bo } var badSize bool if chunkNum+1 == len(chunksPaths) { - badSize = uint64(fi.Size()) != metaPkt.FileSize%metaPkt.ChunkSize + left := metaPkt.FileSize % metaPkt.ChunkSize + badSize = left != 0 && uint64(fi.Size()) != left } else { badSize = uint64(fi.Size()) != metaPkt.ChunkSize } diff --git a/src/nncp.go b/src/nncp.go index b4ce4d8..dde9bcb 100644 --- a/src/nncp.go +++ b/src/nncp.go @@ -40,7 +40,7 @@ along with this program. If not, see .` const Base32Encoded32Len = 52 var ( - Version string = "8.8.2" + Version string = "8.8.3" Base32Codec *base32.Encoding = base32.StdEncoding.WithPadding(base32.NoPadding) ) -- 2.44.0