From f4f0a296077247dfb8dc301c2c49105491efc34b Mon Sep 17 00:00:00 2001 From: Adam Dinwoodie Date: Fri, 25 Oct 2024 10:31:02 +0100 Subject: [PATCH] local: add --skip-specials to ignore special files Give users a way to explicitly acknowledge that pipes, sockets and block devices are to be ignored without warnings. This follows the precedent set in commit 6152bab28 (local: add --skip-links to suppress symlink warnings, 2017-07-21) for ignoring warnings about symlinks. --- backend/local/local.go | 16 +++++++++++++++- docs/content/commands/rclone.md | 1 + docs/content/flags.md | 1 + docs/content/local.md | 15 +++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/backend/local/local.go b/backend/local/local.go index 1a96d8036..8697a5999 100644 --- a/backend/local/local.go +++ b/backend/local/local.go @@ -117,6 +117,17 @@ points, as you explicitly acknowledge that they should be skipped.`, NoPrefix: true, Advanced: true, }, + { + Name: "skip_specials", + Help: `Don't warn about skipped pipes, sockets and device objects. + +This flag disables warning messages on skipped pipes, sockets and +device objects, as you explicitly acknowledge that they should be +skipped.`, + Default: false, + NoPrefix: true, + Advanced: true, + }, { Name: "zero_size_links", Help: `Assume the Stat size of links is zero (and read them instead) (deprecated). @@ -324,6 +335,7 @@ type Options struct { FollowSymlinks bool `config:"copy_links"` TranslateSymlinks bool `config:"links"` SkipSymlinks bool `config:"skip_links"` + SkipSpecials bool `config:"skip_specials"` UTFNorm bool `config:"unicode_normalization"` NoCheckUpdated bool `config:"no_check_updated"` NoUNC bool `config:"nounc"` @@ -1201,7 +1213,9 @@ func (o *Object) Storable() bool { } return false } else if mode&(os.ModeNamedPipe|os.ModeSocket|os.ModeDevice) != 0 { - fs.Logf(o, "Can't transfer non file/directory") + if !o.fs.opt.SkipSpecials { + fs.Logf(o, "Can't transfer non file/directory") + } return false } else if mode&os.ModeDir != 0 { // fs.Debugf(o, "Skipping directory") diff --git a/docs/content/commands/rclone.md b/docs/content/commands/rclone.md index 2a39a39f8..a266dd51b 100644 --- a/docs/content/commands/rclone.md +++ b/docs/content/commands/rclone.md @@ -834,6 +834,7 @@ rclone [flags] --sia-user-agent string Siad User Agent (default "Sia-Agent") --size-only Skip based on size only, not modtime or checksum --skip-links Don't warn about skipped symlinks + --skip-specials Don't warn about skipped pipes, sockets and device objects --smb-case-insensitive Whether the server is configured to be case-insensitive (default true) --smb-description string Description of the remote --smb-domain string Domain name for NTLM authentication (default "WORKGROUP") diff --git a/docs/content/flags.md b/docs/content/flags.md index c2908561a..a044f11f6 100644 --- a/docs/content/flags.md +++ b/docs/content/flags.md @@ -975,6 +975,7 @@ Backend-only flags (these can be set in the config file also). --sia-encoding Encoding The encoding for the backend (default Slash,Question,Hash,Percent,Del,Ctl,InvalidUtf8,Dot) --sia-user-agent string Siad User Agent (default "Sia-Agent") --skip-links Don't warn about skipped symlinks + --skip-specials Don't warn about skipped pipes, sockets and device objects --smb-case-insensitive Whether the server is configured to be case-insensitive (default true) --smb-description string Description of the remote --smb-domain string Domain name for NTLM authentication (default "WORKGROUP") diff --git a/docs/content/local.md b/docs/content/local.md index 9d5c8363c..fc900b414 100644 --- a/docs/content/local.md +++ b/docs/content/local.md @@ -386,6 +386,21 @@ Properties: - Type: bool - Default: false +#### --skip-specials + +Don't warn about skipped pipes, sockets and device objects. + +This flag disables warning messages on skipped pipes, sockets and +device objects, as you explicitly acknowledge that they should be +skipped.`, + +Properties: + +- Config: skip_specials +- Env Var: RCLONE_LOCAL_SKIP_SPECIALS +- Type: bool +- Default: false + #### --local-zero-size-links Assume the Stat size of links is zero (and read them instead) (deprecated).