]> Cypherpunks.ru repositories - nncp.git/commitdiff
Dotted duplicate filenames
authorSergey Matveev <stargrave@stargrave.org>
Thu, 7 Nov 2019 12:51:40 +0000 (15:51 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 10 Nov 2019 15:48:30 +0000 (18:48 +0300)
doc/news.ru.texi
doc/news.texi
src/cmd/nncp-reass/main.go
src/toss.go
src/toss_test.go

index 71a0b8e4f12c5f8ddc803ad81ef16e69bebf90a3..a4bffeb3f14221b51bd51440401514debca5d883 100644 (file)
@@ -4,6 +4,8 @@
 @node Релиз 4.2.0
 @subsection Релиз 4.2.0
 @itemize
+@item Дубликаты имён файлов имеют суффикс @file{.CTR}, вместо
+    @file{CTR}, чтобы избежать возможных коллизий с @file{.nncp.chunkCTR}.
 @item По умолчанию файлы и директории создаются с 666/777 правами
     доступа, позволяя управлять ими @command{umask}-ом.
 @item Обновлены зависимости.
index 7a8b9b94896d6eb51b360eb2b4881c609a174c08..440d103747dd5765f30f4af6644b1c0343086ae1 100644 (file)
@@ -6,6 +6,8 @@ See also this page @ref{Новости, on russian}.
 @node Release 4.2.0
 @section Release 4.2.0
 @itemize
+@item Duplicate filenames have @file{.CTR} suffix, instead of
+    @file{CTR}, to avoid possible collisions with @file{.nncp.chunkCTR}.
 @item Files and directories are created with 666/777 permissions by
     default, allowing control with @command{umask}.
 @item Updated dependencies.
index bc8f0348b2b96cdadfd689bc4592d1c3c57d4e3e..e1cb5b89f00ebffdf85487c46535ba93d52d82ff 100644 (file)
@@ -232,7 +232,7 @@ func process(ctx *nncp.Ctx, path string, keep, dryRun, stdout, dumpMeta bool) bo
                        }
                        log.Fatalln(err)
                }
-               dstPath = dstPathOrig + strconv.Itoa(dstPathCtr)
+               dstPath = dstPathOrig + "." + strconv.Itoa(dstPathCtr)
                dstPathCtr++
        }
        if err = os.Rename(tmp.Name(), dstPath); err != nil {
index 6422ac7a8ccb7e575f923262fb6e9dd122bdedcb..81661387681db4d1bd9b0e4b40a9e5390bc3bf90 100644 (file)
@@ -221,7 +221,7 @@ func (ctx *Ctx) Toss(
                                                isBad = true
                                                goto Closing
                                        }
-                                       dstPath = dstPathOrig + strconv.Itoa(dstPathCtr)
+                                       dstPath = dstPathOrig + "." + strconv.Itoa(dstPathCtr)
                                        dstPathCtr++
                                }
                                if err = os.Rename(tmp.Name(), dstPath); err != nil {
index 48149c49f2d807fec138143d5be6f325206aba30..a96f78bd68afb6f28141ee361e37eaa1e802a4be 100644 (file)
@@ -285,7 +285,7 @@ func TestTossFileSameName(t *testing.T) {
                expected := make(map[string]struct{})
                expected["samefile"] = struct{}{}
                for i := 0; i < files-1; i++ {
-                       expected["samefile"+strconv.Itoa(i)] = struct{}{}
+                       expected["samefile."+strconv.Itoa(i)] = struct{}{}
                }
                for _, filename := range dirFiles(incomingPath) {
                        if _, exists := expected[filename]; !exists {