]> Cypherpunks.ru repositories - nncp.git/commitdiff
Fixed nncp-bundle workability with Go 1.10+
authorSergey Matveev <stargrave@stargrave.org>
Sat, 2 Jun 2018 15:13:30 +0000 (18:13 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sat, 2 Jun 2018 15:13:30 +0000 (18:13 +0300)
VERSION
doc/news.ru.texi
doc/news.texi
src/cypherpunks.ru/nncp/cmd/nncp-bundle/main.go

diff --git a/VERSION b/VERSION
index 8c50098d8aed57b02fd10f40a670a7c673b7c5a5..a3ec5a4bd3d7209b4a687a77cad49b945339994b 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.1
+3.2
index 5061c81da743dbe38045814bc0f3bf0e5ad9587d..0cc0e7a37f41cf88de3925e2fd523d4d5ac92dd3 100644 (file)
@@ -1,6 +1,18 @@
 @node Новости
 @section Новости
 
+@node Релиз 3.2
+@subsection Релиз 3.2
+@itemize
+@item
+@strong{Несовместимое} изменение формата @emph{bundle} архивов и
+работоспособность @command{nncp-bundle} команды с Go 1.10+. Bundle
+должен быть корректным tar архивом, но Go 1.9 делал его недействительным
+из-за длинных путей внутри. NNCP нечаянно был зависим от этой баги.
+Явное добавление @file{NNCP/} директории в архив восстанавливает
+работоспособность с корректными tar архивами.
+@end itemize
+
 @node Релиз 3.1
 @subsection Релиз 3.1
 @itemize
index f3116d89c653c127b19b4317be2f434d5f1f838d..ae4c1a94abb586bcf46b85a9e85fe470c8747ccb 100644 (file)
@@ -3,6 +3,18 @@
 
 See also this page @ref{Новости, on russian}.
 
+@node Release 3.2
+@section Release 3.2
+@itemize
+@item
+@strong{Incompatible} @emph{bundle} archive format changes and
+@command{nncp-bundle} workability with Go 1.10+. Bundles must be
+valid tar archives, but Go 1.9 made them invalid because of long paths
+inside. NNCP accidentally was dependant on that bug. Explicit adding of
+@file{NNCP/} directory in archive restores workability with valid tar
+archives.
+@end itemize
+
 @node Release 3.1
 @section Release 3.1
 @itemize
index f6e0d46acf6d98d0fc62def4380e6ff70d51b563..1e5f8f2b190f9dd1b288597a391fcc7aad6158ea 100644 (file)
@@ -119,6 +119,14 @@ func main() {
                                        job.Fd.Close()
                                        continue
                                }
+                               if err = tarWr.WriteHeader(&tar.Header{
+                                       Format:   tar.FormatUSTAR,
+                                       Name:     nncp.NNCPBundlePrefix,
+                                       Mode:     0700,
+                                       Typeflag: tar.TypeDir,
+                               }); err != nil {
+                                       log.Fatalln("Error writing tar header:", err)
+                               }
                                if err = tarWr.WriteHeader(&tar.Header{
                                        Format: tar.FormatPAX,
                                        Name: strings.Join([]string{
@@ -195,6 +203,21 @@ func main() {
                                }
                                continue
                        }
+                       if entry.Typeflag != tar.TypeDir {
+                               ctx.LogD("nncp-bundle", sds, "Expected NNCP/")
+                               continue
+                       }
+                       entry, err = tarR.Next()
+                       if err != nil {
+                               if err != io.EOF {
+                                       ctx.LogD(
+                                               "nncp-bundle",
+                                               nncp.SdsAdd(sds, nncp.SDS{"err": err}),
+                                               "error reading tar",
+                                       )
+                               }
+                               continue
+                       }
                        sds["pkt"] = entry.Name
                        if entry.Size < nncp.PktEncOverhead {
                                ctx.LogD("nncp-bundle", sds, "Too small packet")