]> Cypherpunks.ru repositories - nncp.git/commitdiff
Skip non-regular files in nncp-file
authorSergey Matveev <stargrave@stargrave.org>
Tue, 25 Jan 2022 17:42:29 +0000 (20:42 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 25 Jan 2022 18:27:36 +0000 (21:27 +0300)
doc/cmd/nncp-file.texi
doc/news.ru.texi
doc/news.texi
src/tx.go

index 0a80a4c5996b20163e91257354f8d62d6082b2ba..802e817fb0010121bb03d5f80eaa37ef35d7553f 100644 (file)
@@ -18,13 +18,16 @@ encrypted packet.
 If @file{SRC} equals to @file{-}, to data is read from @code{stdin}.
 
 If @file{SRC} points to directory, then
-@url{https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_01, pax archive}
-will be created on the fly with directory contents and destination
-filename @file{.tar} appended. It @strong{won't} contain any entities
-metainformation, but modification time with the names. UID/GID are set
-to zero. Directories have 777 permissions, files have 666, for being
-friendly with @command{umask}. Also each entity will have comment like
-@verb{|Autogenerated by NNCP version X.Y.Z built with goXXX|}.
+@url{https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_01,
+pax archive} will be created on the fly with directory contents and
+destination filename @file{.tar} appended. It @strong{won't} contain any
+entities metainformation, except for modification time with the names.
+UID/GID are set to zero. Directories have 777 permissions, files have
+666, for being friendly with @command{umask}. Everything except
+directories and regulars files is skipped. Also each entity will have
+comment like @verb{|Autogenerated by NNCP version X.Y.Z built with goXXX|}.
+For more precise metainformation and various file objects storage use
+external @command{tar} command piped in.
 
 If @option{-chunked} is specified, then source file will be split
 @ref{Chunked, on chunks}. @option{INT} is the desired chunk size in
index 1a65bfa033f968916563b0ed7348358d90303cf6..61db7628a9b46e264c1dd3e3236788e4cd7835c9 100644 (file)
 У @command{nncp-call} команды появился @option{-mcd-wait} аргумент,
 позволяющий дожидаться multicast сообщения об адресе ноды.
 
+@item
+@command{nncp-file} команда пропускает всё что не является регулярным
+файлом или директорией во время создания pax-архива.
+
 @end itemize
 
 @node Релиз 8.3.0
index 6922d4bfe30584745612dd57496b44f83c6e8de5..fbb1d463bace4ba89fd22b1867f3949395b4cd4e 100644 (file)
@@ -16,6 +16,10 @@ configuration options) are now regular expressions. By default
 @command{nncp-call} command has @option{-mcd-wait} option to wait for
 multicast packet about node's address.
 
+@item
+@command{nncp-file} command skips everything that is neither regular
+file nor directory during pax-archive creation.
+
 @end itemize
 
 @node Release 8_3_0
index b0377ed9d34b3a7f91c67e451ee2b4683b22c0d6..77db5928d852daffe12e70b0414da3d2d336c8ec 100644 (file)
--- a/src/tx.go
+++ b/src/tx.go
@@ -330,11 +330,11 @@ func prepareTxFile(srcPath string) (
                if err != nil {
                        return err
                }
-               if info.IsDir() {
+               if info.Mode().IsDir() {
                        // directory header, PAX record header+contents
                        srcSize += TarBlockSize + 2*TarBlockSize
                        dirs = append(dirs, einfo{path: path, modTime: info.ModTime()})
-               } else {
+               } else if info.Mode().IsRegular() {
                        // file header, PAX record header+contents, file content
                        srcSize += TarBlockSize + 2*TarBlockSize + info.Size()
                        if n := info.Size() % TarBlockSize; n != 0 {