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.
This commit is contained in:
Adam Dinwoodie 2024-10-25 10:31:02 +01:00
parent 72f06bcc4b
commit f4f0a29607
4 changed files with 32 additions and 1 deletions

View File

@ -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 {
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")

View File

@ -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")

View File

@ -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")

View File

@ -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).