Compare commits

..
Author SHA1 Message Date
Nick Craig-Wood ab8be2663f Version v1.60.1 2022-11-17 13:56:19 +00:00
asdffdsazqqq 9e2aaa0f67 docs: faq: how to use a proxy server that requires a username and password - fixes #6565 2022-11-17 13:44:24 +00:00
Nick Craig-Wood f8997b8336 webdav: fix Move/Copy/DirMove when using -server-side-across-configs
Before this change, when using -server-side-across-configs rclone
would direct Move/Copy/DirMove to the destination server.

However this should be directed to the source server. This is a little
unclear in the RFC, but the name of the parameter "Destination:" seems
clear and this is how dCache and Rucio have implemented it.

See: https://forum.rclone.org/t/webdav-copy-request-implemented-incorrectly/34072/
2022-11-17 13:44:02 +00:00
Nick Craig-Wood 567d8fc8d1 smb: fix Failed to sync: context canceled at the end of syncs
Before this change we were putting connections into the connection
pool which had a local context in.

This meant that when the operation had finished the context was
cancelled and the connection became unusable.

See: https://forum.rclone.org/t/failed-to-sync-context-canceled/34017/
2022-11-16 10:56:09 +00:00
Nick Craig-Wood 4ffe9dcfef vfs: fix deadlock caused by cache cleaner and upload finishing
Before this patch a deadlock could occur if the cache cleaner was
running when an object upload finished.

This fixes the problem by delaying marking the object as clean until
we have notified the VFS layer. This means that the cache cleaner
won't consider the object until **after** the VFS layer has been
notified, thus avoiding the deadlock.

See: https://forum.rclone.org/t/rclone-mount-deadlock-when-dir-cache-time-strikes/33486/
2022-11-15 18:01:46 +00:00
techknowlogick 6d0824954b s3: Add additional Wasabi locations 2022-11-15 09:02:48 +00:00
Aaron Gokaslan 1a5160c7aa s3: fix for unchecked err value in s3 listv2 2022-11-15 09:02:25 +00:00
Nick Craig-Wood 5012f78c45 local: fix -L/--copy-links with filters missing directories
In this commit

8d1fff9a82 local: obey file filters in listing to fix errors on excluded files

We introduced the concept of local backend filters.

Unfortunately the filters were being applied before we had resolved
the symlink to point to a directory. This meant that symlinks pointing
to directories were filtered out when they shouldn't have been.

This was fixed by moving the filter check until after the symlink had
been resolved.

See: https://forum.rclone.org/t/copy-links-not-following-symlinks-on-1-60-0/34073/7
2022-11-15 09:00:08 +00:00
Nick Craig-Wood 8f3741419f mailru: allow timestamps to be before the epoch 1970-01-01
Fixes #6547
2022-11-10 11:27:50 +00:00
Nick Craig-Wood 91afa14d28 lib/cache: fix alias backend shutting down too soon
Before this patch, when an alias backend was created it would be
renamed to be canonical and in the process Shutdown would be called on
it. This was particularly noticeable with the dropbox backend which
gave this error when uploading files after the backend was Shutdown.

    Failed to copy: upload failed: batcher is shutting down

This patch fixes the cache Rename code not to finalize objects if the
object that is being overwritten is the same as the existing object.

See: https://forum.rclone.org/t/upload-failed-batcher-is-shutting-down/33900
2022-11-09 16:30:33 +00:00
Nick Craig-Wood 4038c2c316 mailru: note that an app password is now needed - fixes #6398 2022-11-08 20:33:33 +00:00
Nick Craig-Wood ed7c286ef6 docs: remove link to rclone slack as it is no longer supported 2022-11-08 16:12:02 +00:00
Nick Craig-Wood 0866a7b6e2 s3: allow Storj to server side copy since it seems to work now - fixes #6550 2022-11-08 16:08:29 +00:00
João Henrique Franco ac38744e69 wasm: fix walltime link error by adding up-to-date wasm_exec.js
Solves link error while running rclone's wasm version. Go's `walltime1` function was renamed to `walltime`. This commit updates wasm_exec.js with the new name.
2022-11-08 16:08:29 +00:00
Clément Notin dfc21a5b9e docs: fix character that was incorrectly interpreted as markdown 2022-11-08 16:08:29 +00:00
Joda Stößer ff408f5309 docs: fix typo remove in rclone_serve_restic command 2022-11-08 16:08:29 +00:00
Nick Craig-Wood e2d2a05361 s3: add provider quirk --s3-might-gzip to fix corrupted on transfer: sizes differ
Before this change, some files were giving this error when downloaded
from Cloudflare and other providers.

    ERROR corrupted on transfer: sizes differ NNN vs MMM

This is because these providers auto gzips the object when rclone
wasn't expecting it to. (AWS does not gzip objects without their being
uploaded gzipped).

This patch adds a quirk to for fix the problem and a flag to control
it. The quirk `might_gzip` is set to `true` for all providers except
AWS.

See: https://forum.rclone.org/t/s3-error-corrupted-on-transfer-sizes-differ-nnn-vs-mmm/33694/
Fixes: #6533
2022-11-04 17:01:03 +00:00
albertony e8002c66a9 docs: add direct download link for windows arm64 2022-11-04 17:01:03 +00:00
coultonluke 6f207668c2 docs: corrected download links in windows install docs 2022-11-04 17:01:03 +00:00
Manoj Ghosh a2491719a1 oracle-object-storage: doc fix
See #6521
2022-11-04 17:01:03 +00:00
albertony 29e1c68ee0 local: clean absolute paths - fixes #6493 2022-11-04 17:01:03 +00:00
Samuel Johnson 05040cc504 docs: Update faq.md with bisync
Updated FAQ to clarify that experimental bi-sync is now available.
2022-11-04 17:01:03 +00:00
Nick Craig-Wood 6944f28dc2 Start v1.60.1-DEV development 2022-11-04 16:57:08 +00:00
153 changed files with 1327 additions and 1247 deletions

No files matched your search

+10 -22
View File
@@ -30,7 +30,7 @@ jobs:
include:
- job_name: linux
os: ubuntu-latest
go: '1.19'
go: '1.19.x'
gotags: cmount
build_flags: '-include "^linux/"'
check: true
@@ -41,14 +41,14 @@ jobs:
- job_name: linux_386
os: ubuntu-latest
go: '1.19'
go: '1.19.x'
goarch: 386
gotags: cmount
quicktest: true
- job_name: mac_amd64
os: macos-11
go: '1.19'
go: '1.19.x'
gotags: 'cmount'
build_flags: '-include "^darwin/amd64" -cgo'
quicktest: true
@@ -57,14 +57,14 @@ jobs:
- job_name: mac_arm64
os: macos-11
go: '1.19'
go: '1.19.x'
gotags: 'cmount'
build_flags: '-include "^darwin/arm64" -cgo -macos-arch arm64 -cgo-cflags=-I/usr/local/include -cgo-ldflags=-L/usr/local/lib'
deploy: true
- job_name: windows
os: windows-latest
go: '1.19'
go: '1.19.x'
gotags: cmount
cgo: '0'
build_flags: '-include "^windows/"'
@@ -74,20 +74,20 @@ jobs:
- job_name: other_os
os: ubuntu-latest
go: '1.19'
go: '1.19.x'
build_flags: '-exclude "^(windows/|darwin/|linux/)"'
compile_all: true
deploy: true
- job_name: go1.17
os: ubuntu-latest
go: '1.17'
go: '1.17.x'
quicktest: true
racequicktest: true
- job_name: go1.18
os: ubuntu-latest
go: '1.18'
go: '1.18.x'
quicktest: true
racequicktest: true
@@ -104,6 +104,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
stable: 'false'
go-version: ${{ matrix.go }}
check-latest: true
@@ -233,19 +234,6 @@ jobs:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
# Run govulncheck on the latest go version, the one we build binaries with
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19
check-latest: true
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Scan for vulnerabilities
run: govulncheck ./...
android:
if: ${{ github.repository == 'rclone/rclone' || github.event.inputs.manual }}
timeout-minutes: 30
@@ -262,7 +250,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.19.x
- name: Go module cache
uses: actions/cache@v3
Generated
+129 -12
View File
@@ -19,7 +19,7 @@
<header id="title-block-header">
<h1 class="title">rclone(1) User Manual</h1>
<p class="author">Nick Craig-Wood</p>
<p class="date">Oct 21, 2022</p>
<p class="date">Nov 17, 2022</p>
</header>
<h1 id="rclone-syncs-your-files-to-cloud-storage">Rclone syncs your files to cloud storage</h1>
<p><img width="50%" src="https://rclone.org/img/logo_on_light__horizontal_color.svg" alt="rclone logo" style="float:right; padding: 5px;" ></p>
@@ -227,9 +227,9 @@ macOS cannot verify that this app is free from malware.</code></pre>
<h3 id="windows-precompiled">Precompiled binary</h3>
<p>Fetch the correct binary for your processor type by clicking on these links. If not sure, use the first link.</p>
<ul>
<li><a href="https://downloads.rclone.org/rclone-current-linux-amd64.zip">Intel/AMD - 64 Bit</a></li>
<li><a href="https://downloads.rclone.org/rclone-current-linux-386.zip">Intel/AMD - 32 Bit</a></li>
<li><a href="https://downloads.rclone.org/rclone-current-linux-arm64.zip">ARM - 64 Bit</a></li>
<li><a href="https://downloads.rclone.org/rclone-current-windows-amd64.zip">Intel/AMD - 64 Bit</a></li>
<li><a href="https://downloads.rclone.org/rclone-current-windows-386.zip">Intel/AMD - 32 Bit</a></li>
<li><a href="https://downloads.rclone.org/rclone-current-windows-arm64.zip">ARM - 64 Bit</a></li>
</ul>
<p>Open this file in the Explorer and extract <code>rclone.exe</code>. Rclone is a portable executable so you can place it wherever is convenient.</p>
<p>Open a CMD window (or powershell) and run the binary. Note that rclone does not launch a GUI by default, it runs in the CMD Window.</p>
@@ -8081,13 +8081,13 @@ Showing nodes accounting for 1537.03kB, 100% of 1537.03kB total
</tr>
<tr class="odd">
<td>Oracle Object Storage</td>
<td style="text-align: center;">Yes</td>
<td style="text-align: center;">No</td>
<td style="text-align: center;">Yes</td>
<td style="text-align: center;">No</td>
<td style="text-align: center;">No</td>
<td style="text-align: center;">Yes</td>
<td style="text-align: center;">Yes</td>
<td style="text-align: center;">No</td>
<td style="text-align: center;">Yes</td>
<td style="text-align: center;">No</td>
<td style="text-align: center;">No</td>
<td style="text-align: center;">No</td>
@@ -8471,7 +8471,7 @@ Showing nodes accounting for 1537.03kB, 100% of 1537.03kB total
--use-json-log Use json log format
--use-mmap Use mmap allocator (see docs)
--use-server-modtime Use server modified time instead of object metadata
--user-agent string Set the user-agent to a specified string (default &quot;rclone/v1.60.0&quot;)
--user-agent string Set the user-agent to a specified string (default &quot;rclone/v1.60.1&quot;)
-v, --verbose count Print lots more stuff (repeat for more)</code></pre>
<h2 id="backend-flags">Backend Flags</h2>
<p>These flags are available for every command. They control the backends and may be set in the config file.</p>
@@ -8848,6 +8848,7 @@ Showing nodes accounting for 1537.03kB, 100% of 1537.03kB total
--s3-max-upload-parts int Maximum number of parts in a multipart upload (default 10000)
--s3-memory-pool-flush-time Duration How often internal memory buffer pools will be flushed (default 1m0s)
--s3-memory-pool-use-mmap Whether to use mmap buffers in internal memory pool
--s3-might-gzip Tristate Set this if the backend might gzip objects (default unset)
--s3-no-check-bucket If set, don&#39;t attempt to check the bucket exists or create it
--s3-no-head If set, don&#39;t HEAD uploaded objects to check integrity
--s3-no-head-object If set, do not do HEAD before GET when getting objects
@@ -12315,15 +12316,39 @@ $ rclone -q --s3-versions ls s3:cleanup-test
</ul></li>
<li>"s3.wasabisys.com"
<ul>
<li>Wasabi US East endpoint</li>
<li>Wasabi US East 1 (N. Virginia)</li>
</ul></li>
<li>"s3.us-east-2.wasabisys.com"
<ul>
<li>Wasabi US East 2 (N. Virginia)</li>
</ul></li>
<li>"s3.us-central-1.wasabisys.com"
<ul>
<li>Wasabi US Central 1 (Texas)</li>
</ul></li>
<li>"s3.us-west-1.wasabisys.com"
<ul>
<li>Wasabi US West endpoint</li>
<li>Wasabi US West 1 (Oregon)</li>
</ul></li>
<li>"s3.ca-central-1.wasabisys.com"
<ul>
<li>Wasabi CA Central 1 (Toronto)</li>
</ul></li>
<li>"s3.eu-central-1.wasabisys.com"
<ul>
<li>Wasabi EU Central endpoint</li>
<li>Wasabi EU Central 1 (Amsterdam)</li>
</ul></li>
<li>"s3.eu-central-2.wasabisys.com"
<ul>
<li>Wasabi EU Central 2 (Frankfurt)</li>
</ul></li>
<li>"s3.eu-west-1.wasabisys.com"
<ul>
<li>Wasabi EU West 1 (London)</li>
</ul></li>
<li>"s3.eu-west-2.wasabisys.com"
<ul>
<li>Wasabi EU West 2 (Paris)</li>
</ul></li>
<li>"s3.ap-northeast-1.wasabisys.com"
<ul>
@@ -12333,6 +12358,14 @@ $ rclone -q --s3-versions ls s3:cleanup-test
<ul>
<li>Wasabi AP Northeast 2 (Osaka) endpoint</li>
</ul></li>
<li>"s3.ap-southeast-1.wasabisys.com"
<ul>
<li>Wasabi AP Southeast 1 (Singapore)</li>
</ul></li>
<li>"s3.ap-southeast-2.wasabisys.com"
<ul>
<li>Wasabi AP Southeast 2 (Sydney)</li>
</ul></li>
<li>"s3.ir-thr-at1.arvanstorage.com"
<ul>
<li>ArvanCloud Tehran Iran (Asiatech) endpoint</li>
@@ -13673,6 +13706,21 @@ Windows: &quot;%USERPROFILE%\.aws\credentials&quot;</code></pre>
<li>Type: bool</li>
<li>Default: false</li>
</ul>
<h4 id="s3-might-gzip">--s3-might-gzip</h4>
<p>Set this if the backend might gzip objects.</p>
<p>Normally providers will not alter objects when they are downloaded. If an object was not uploaded with <code>Content-Encoding: gzip</code> then it won't be set on download.</p>
<p>However some providers may gzip objects even if they weren't uploaded with <code>Content-Encoding: gzip</code> (eg Cloudflare).</p>
<p>A symptom of this would be receiving errors like</p>
<pre><code>ERROR corrupted on transfer: sizes differ NNN vs MMM</code></pre>
<p>If you set this flag and rclone downloads an object with Content-Encoding: gzip set and chunked transfer encoding, then rclone will decompress the object on the fly.</p>
<p>If this is set to unset (the default) then rclone will choose according to the provider setting what to apply, but you can override rclone's choice here.</p>
<p>Properties:</p>
<ul>
<li>Config: might_gzip</li>
<li>Env Var: RCLONE_S3_MIGHT_GZIP</li>
<li>Type: Tristate</li>
<li>Default: unset</li>
</ul>
<h4 id="s3-no-system-metadata">--s3-no-system-metadata</h4>
<p>Suppress setting and reading of system metadata</p>
<p>Properties:</p>
@@ -22458,7 +22506,17 @@ y/e/d&gt; y</code></pre>
<li>If a particular file is already present in storage, one can quickly submit file hash instead of long file upload (this optimization is supported by rclone)</li>
</ul>
<h2 id="configuration-24">Configuration</h2>
<p>Here is an example of making a mailru configuration. First create a Mail.ru Cloud account and choose a tariff, then run</p>
<p>Here is an example of making a mailru configuration.</p>
<p>First create a Mail.ru Cloud account and choose a tariff.</p>
<p>You will need to log in and create an app password for rclone. Rclone <strong>will not work</strong> with your normal username and password - it will give an error like <code>oauth2: server response missing access_token</code>.</p>
<ul>
<li>Click on your user icon in the top right</li>
<li>Go to Security / "Пароль и безопасность"</li>
<li>Click password for apps / "Пароли для внешних приложений"</li>
<li>Add the password - give it a name - eg "rclone"</li>
<li>Copy the password and use this password below - your normal login password won't work.</li>
</ul>
<p>Now run</p>
<pre><code>rclone config</code></pre>
<p>This will guide you through an interactive setup process:</p>
<pre><code>No remotes found, make a new one?
@@ -22480,6 +22538,10 @@ User name (usually email)
Enter a string value. Press Enter for the default (&quot;&quot;).
user&gt; username@mail.ru
Password
This must be an app password - rclone will not work with your normal
password. See the Configuration section in the docs for how to make an
app password.
y) Yes type in my own password
g) Generate random password
y/g&gt; y
@@ -22598,6 +22660,7 @@ y/e/d&gt; y</code></pre>
</ul>
<h4 id="mailru-pass">--mailru-pass</h4>
<p>Password.</p>
<p>This must be an app password - rclone will not work with your normal password. See the Configuration section in the docs for how to make an app password.</p>
<p><strong>NB</strong> Input to this must be obscured - see <a href="https://rclone.org/commands/rclone_obscure/">rclone obscure</a>.</p>
<p>Properties:</p>
<ul>
@@ -28967,6 +29030,55 @@ $ tree /tmp/b
<li>"error": return an error based on option value</li>
</ul>
<h1 id="changelog">Changelog</h1>
<h2 id="v1.60.1---2022-11-17">v1.60.1 - 2022-11-17</h2>
<p><a href="https://github.com/rclone/rclone/compare/v1.60.0...v1.60.1">See commits</a></p>
<ul>
<li>Bug Fixes
<ul>
<li>lib/cache: Fix alias backend shutting down too soon (Nick Craig-Wood)</li>
<li>wasm: Fix walltime link error by adding up-to-date wasm_exec.js (João Henrique Franco)</li>
<li>docs
<ul>
<li>Update faq.md with bisync (Samuel Johnson)</li>
<li>Corrected download links in windows install docs (coultonluke)</li>
<li>Add direct download link for windows arm64 (albertony)</li>
<li>Remove link to rclone slack as it is no longer supported (Nick Craig-Wood)</li>
<li>Faq: how to use a proxy server that requires a username and password (asdffdsazqqq)</li>
<li>Oracle-object-storage: doc fix (Manoj Ghosh)</li>
<li>Fix typo <code>remove</code> in rclone_serve_restic command (Joda Stößer)</li>
<li>Fix character that was incorrectly interpreted as markdown (Clément Notin)</li>
</ul></li>
</ul></li>
<li>VFS
<ul>
<li>Fix deadlock caused by cache cleaner and upload finishing (Nick Craig-Wood)</li>
</ul></li>
<li>Local
<ul>
<li>Clean absolute paths (albertony)</li>
<li>Fix -L/--copy-links with filters missing directories (Nick Craig-Wood)</li>
</ul></li>
<li>Mailru
<ul>
<li>Note that an app password is now needed (Nick Craig-Wood)</li>
<li>Allow timestamps to be before the epoch 1970-01-01 (Nick Craig-Wood)</li>
</ul></li>
<li>S3
<ul>
<li>Add provider quirk <code>--s3-might-gzip</code> to fix corrupted on transfer: sizes differ (Nick Craig-Wood)</li>
<li>Allow Storj to server side copy since it seems to work now (Nick Craig-Wood)</li>
<li>Fix for unchecked err value in s3 listv2 (Aaron Gokaslan)</li>
<li>Add additional Wasabi locations (techknowlogick)</li>
</ul></li>
<li>Smb
<ul>
<li>Fix <code>Failed to sync: context canceled</code> at the end of syncs (Nick Craig-Wood)</li>
</ul></li>
<li>WebDAV
<ul>
<li>Fix Move/Copy/DirMove when using -server-side-across-configs (Nick Craig-Wood)</li>
</ul></li>
</ul>
<h2 id="v1.60.0---2022-10-21">v1.60.0 - 2022-10-21</h2>
<p><a href="https://github.com/rclone/rclone/compare/v1.59.0...v1.60.0">See commits</a></p>
<ul>
@@ -35170,7 +35282,7 @@ Server B&gt; rclone copy /tmp/whatever remote:Backup</code></pre>
<p>It would be possible to make a sync system which stored binary diffs instead of whole objects like rclone does, but that would break the 1:1 mapping of files on your hard disk to objects in the remote cloud storage system.</p>
<p>All the cloud storage systems support partial downloads of content, so it would be possible to make partial downloads work. However to make this work efficiently this would require storing a significant amount of metadata, which breaks the desired 1:1 mapping of files to objects.</p>
<h3 id="can-rclone-do-bi-directional-sync">Can rclone do bi-directional sync?</h3>
<p>No, not at present. rclone only does uni-directional sync from A -&gt; B. It may do in the future though since it has all the primitives - it just requires writing the algorithm to do it.</p>
<p>Yes, since rclone v1.58.0, <a href="https://rclone.org/bisync/">bidirectional cloud sync</a> is available.</p>
<h3 id="can-i-use-rclone-with-an-http-proxy">Can I use rclone with an HTTP proxy?</h3>
<p>Yes. rclone will follow the standard environment variables for proxies, similar to cURL and other programs.</p>
<p>In general the variables are called <code>http_proxy</code> (for services reached over <code>http</code>) and <code>https_proxy</code> (for services reached over <code>https</code>). Most public services will be using <code>https</code>, but you may wish to set both.</p>
@@ -35180,6 +35292,11 @@ Server B&gt; rclone copy /tmp/whatever remote:Backup</code></pre>
export https_proxy=$http_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy</code></pre>
<p>Note: If the proxy server requires a username and password, then use</p>
<pre><code>export http_proxy=http://username:password@proxyserver:12345
export https_proxy=$http_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy</code></pre>
<p>The <code>NO_PROXY</code> allows you to disable the proxy for specific hosts. Hosts must be comma separated, and can contain domains or parts. For instance "foo.com" also matches "bar.foo.com".</p>
<p>e.g.</p>
<pre><code>export no_proxy=localhost,127.0.0.0/8,my.host.name
Generated
+125 -14
View File
@@ -1,6 +1,6 @@
% rclone(1) User Manual
% Nick Craig-Wood
% Oct 21, 2022
% Nov 17, 2022
# Rclone syncs your files to cloud storage
@@ -315,9 +315,9 @@ The simplest fix is to run
Fetch the correct binary for your processor type by clicking on these
links. If not sure, use the first link.
- [Intel/AMD - 64 Bit](https://downloads.rclone.org/rclone-current-linux-amd64.zip)
- [Intel/AMD - 32 Bit](https://downloads.rclone.org/rclone-current-linux-386.zip)
- [ARM - 64 Bit](https://downloads.rclone.org/rclone-current-linux-arm64.zip)
- [Intel/AMD - 64 Bit](https://downloads.rclone.org/rclone-current-windows-amd64.zip)
- [Intel/AMD - 32 Bit](https://downloads.rclone.org/rclone-current-windows-386.zip)
- [ARM - 64 Bit](https://downloads.rclone.org/rclone-current-windows-arm64.zip)
Open this file in the Explorer and extract `rclone.exe`. Rclone is a
portable executable so you can place it wherever is convenient.
@@ -14241,7 +14241,7 @@ upon backend-specific capabilities.
| Microsoft OneDrive | Yes | Yes | Yes | Yes | Yes | No | No | Yes | Yes | Yes |
| OpenDrive | Yes | Yes | Yes | Yes | No | No | No | No | No | Yes |
| OpenStack Swift | Yes † | Yes | No | No | No | Yes | Yes | No | Yes | No |
| Oracle Object Storage | Yes | Yes | No | No | Yes | Yes | No | No | No | No |
| Oracle Object Storage | No | Yes | No | No | Yes | Yes | Yes | No | No | No |
| pCloud | Yes | Yes | Yes | Yes | Yes | No | No | Yes | Yes | Yes |
| premiumize.me | Yes | No | Yes | Yes | No | No | No | Yes | Yes | Yes |
| put.io | Yes | No | Yes | Yes | Yes | No | Yes | No | Yes | Yes |
@@ -14501,7 +14501,7 @@ These flags are available for every command.
--use-json-log Use json log format
--use-mmap Use mmap allocator (see docs)
--use-server-modtime Use server modified time instead of object metadata
--user-agent string Set the user-agent to a specified string (default "rclone/v1.60.0")
--user-agent string Set the user-agent to a specified string (default "rclone/v1.60.1")
-v, --verbose count Print lots more stuff (repeat for more)
```
@@ -14884,6 +14884,7 @@ and may be set in the config file.
--s3-max-upload-parts int Maximum number of parts in a multipart upload (default 10000)
--s3-memory-pool-flush-time Duration How often internal memory buffer pools will be flushed (default 1m0s)
--s3-memory-pool-use-mmap Whether to use mmap buffers in internal memory pool
--s3-might-gzip Tristate Set this if the backend might gzip objects (default unset)
--s3-no-check-bucket If set, don't attempt to check the bucket exists or create it
--s3-no-head If set, don't HEAD uploaded objects to check integrity
--s3-no-head-object If set, do not do HEAD before GET when getting objects
@@ -18940,15 +18941,31 @@ Properties:
- "s3.ap-southeast-1.lyvecloud.seagate.com"
- Seagate Lyve Cloud AP Southeast 1 (Singapore)
- "s3.wasabisys.com"
- Wasabi US East endpoint
- Wasabi US East 1 (N. Virginia)
- "s3.us-east-2.wasabisys.com"
- Wasabi US East 2 (N. Virginia)
- "s3.us-central-1.wasabisys.com"
- Wasabi US Central 1 (Texas)
- "s3.us-west-1.wasabisys.com"
- Wasabi US West endpoint
- Wasabi US West 1 (Oregon)
- "s3.ca-central-1.wasabisys.com"
- Wasabi CA Central 1 (Toronto)
- "s3.eu-central-1.wasabisys.com"
- Wasabi EU Central endpoint
- Wasabi EU Central 1 (Amsterdam)
- "s3.eu-central-2.wasabisys.com"
- Wasabi EU Central 2 (Frankfurt)
- "s3.eu-west-1.wasabisys.com"
- Wasabi EU West 1 (London)
- "s3.eu-west-2.wasabisys.com"
- Wasabi EU West 2 (Paris)
- "s3.ap-northeast-1.wasabisys.com"
- Wasabi AP Northeast 1 (Tokyo) endpoint
- "s3.ap-northeast-2.wasabisys.com"
- Wasabi AP Northeast 2 (Osaka) endpoint
- "s3.ap-southeast-1.wasabisys.com"
- Wasabi AP Southeast 1 (Singapore)
- "s3.ap-southeast-2.wasabisys.com"
- Wasabi AP Southeast 2 (Sydney)
- "s3.ir-thr-at1.arvanstorage.com"
- ArvanCloud Tehran Iran (Asiatech) endpoint
@@ -20167,6 +20184,37 @@ Properties:
- Type: bool
- Default: false
#### --s3-might-gzip
Set this if the backend might gzip objects.
Normally providers will not alter objects when they are downloaded. If
an object was not uploaded with `Content-Encoding: gzip` then it won't
be set on download.
However some providers may gzip objects even if they weren't uploaded
with `Content-Encoding: gzip` (eg Cloudflare).
A symptom of this would be receiving errors like
ERROR corrupted on transfer: sizes differ NNN vs MMM
If you set this flag and rclone downloads an object with
Content-Encoding: gzip set and chunked transfer encoding, then rclone
will decompress the object on the fly.
If this is set to unset (the default) then rclone will choose
according to the provider setting what to apply, but you can override
rclone's choice here.
Properties:
- Config: might_gzip
- Env Var: RCLONE_S3_MIGHT_GZIP
- Type: Tristate
- Default: unset
#### --s3-no-system-metadata
Suppress setting and reading of system metadata
@@ -32271,8 +32319,21 @@ Currently it is recommended to disable 2FA on Mail.ru accounts intended for rclo
## Configuration
Here is an example of making a mailru configuration. First create a Mail.ru Cloud
account and choose a tariff, then run
Here is an example of making a mailru configuration.
First create a Mail.ru Cloud account and choose a tariff.
You will need to log in and create an app password for rclone. Rclone
**will not work** with your normal username and password - it will
give an error like `oauth2: server response missing access_token`.
- Click on your user icon in the top right
- Go to Security / "Пароль и безопасность"
- Click password for apps / "Пароли для внешних приложений"
- Add the password - give it a name - eg "rclone"
- Copy the password and use this password below - your normal login password won't work.
Now run
rclone config
@@ -32298,6 +32359,10 @@ User name (usually email)
Enter a string value. Press Enter for the default ("").
user> username@mail.ru
Password
This must be an app password - rclone will not work with your normal
password. See the Configuration section in the docs for how to make an
app password.
y) Yes type in my own password
g) Generate random password
y/g> y
@@ -32420,6 +32485,11 @@ Properties:
Password.
This must be an app password - rclone will not work with your normal
password. See the Configuration section in the docs for how to make an
app password.
**NB** Input to this must be obscured - see [rclone obscure](https://rclone.org/commands/rclone_obscure/).
Properties:
@@ -40954,6 +41024,40 @@ Options:
# Changelog
## v1.60.1 - 2022-11-17
[See commits](https://github.com/rclone/rclone/compare/v1.60.0...v1.60.1)
* Bug Fixes
* lib/cache: Fix alias backend shutting down too soon (Nick Craig-Wood)
* wasm: Fix walltime link error by adding up-to-date wasm_exec.js (João Henrique Franco)
* docs
* Update faq.md with bisync (Samuel Johnson)
* Corrected download links in windows install docs (coultonluke)
* Add direct download link for windows arm64 (albertony)
* Remove link to rclone slack as it is no longer supported (Nick Craig-Wood)
* Faq: how to use a proxy server that requires a username and password (asdffdsazqqq)
* Oracle-object-storage: doc fix (Manoj Ghosh)
* Fix typo `remove` in rclone_serve_restic command (Joda Stößer)
* Fix character that was incorrectly interpreted as markdown (Clément Notin)
* VFS
* Fix deadlock caused by cache cleaner and upload finishing (Nick Craig-Wood)
* Local
* Clean absolute paths (albertony)
* Fix -L/--copy-links with filters missing directories (Nick Craig-Wood)
* Mailru
* Note that an app password is now needed (Nick Craig-Wood)
* Allow timestamps to be before the epoch 1970-01-01 (Nick Craig-Wood)
* S3
* Add provider quirk `--s3-might-gzip` to fix corrupted on transfer: sizes differ (Nick Craig-Wood)
* Allow Storj to server side copy since it seems to work now (Nick Craig-Wood)
* Fix for unchecked err value in s3 listv2 (Aaron Gokaslan)
* Add additional Wasabi locations (techknowlogick)
* Smb
* Fix `Failed to sync: context canceled` at the end of syncs (Nick Craig-Wood)
* WebDAV
* Fix Move/Copy/DirMove when using -server-side-across-configs (Nick Craig-Wood)
## v1.60.0 - 2022-10-21
[See commits](https://github.com/rclone/rclone/compare/v1.59.0...v1.60.0)
@@ -45237,9 +45341,8 @@ of metadata, which breaks the desired 1:1 mapping of files to objects.
### Can rclone do bi-directional sync? ###
No, not at present. rclone only does uni-directional sync from A ->
B. It may do in the future though since it has all the primitives - it
just requires writing the algorithm to do it.
Yes, since rclone v1.58.0, [bidirectional cloud sync](https://rclone.org/bisync/) is
available.
### Can I use rclone with an HTTP proxy? ###
@@ -45264,6 +45367,14 @@ possibilities. So, on Linux, you may end up with code similar to
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
Note: If the proxy server requires a username and password, then use
export http_proxy=http://username:password@proxyserver:12345
export https_proxy=$http_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
The `NO_PROXY` allows you to disable the proxy for specific hosts.
Hosts must be comma separated, and can contain domains or parts.
For instance "foo.com" also matches "bar.foo.com".
Generated
+132 -11
View File
@@ -1,6 +1,6 @@
rclone(1) User Manual
Nick Craig-Wood
Oct 21, 2022
Nov 17, 2022
Rclone syncs your files to cloud storage
@@ -13781,7 +13781,7 @@ upon backend-specific capabilities.
Microsoft OneDrive Yes Yes Yes Yes Yes No No Yes Yes Yes
OpenDrive Yes Yes Yes Yes No No No No No Yes
OpenStack Swift Yes † Yes No No No Yes Yes No Yes No
Oracle Object Storage Yes Yes No No Yes Yes No No No No
Oracle Object Storage No Yes No No Yes Yes Yes No No No
pCloud Yes Yes Yes Yes Yes No No Yes Yes Yes
premiumize.me Yes No Yes Yes No No No Yes Yes Yes
put.io Yes No Yes Yes Yes No Yes No Yes Yes
@@ -14038,7 +14038,7 @@ These flags are available for every command.
--use-json-log Use json log format
--use-mmap Use mmap allocator (see docs)
--use-server-modtime Use server modified time instead of object metadata
--user-agent string Set the user-agent to a specified string (default "rclone/v1.60.0")
--user-agent string Set the user-agent to a specified string (default "rclone/v1.60.1")
-v, --verbose count Print lots more stuff (repeat for more)
Backend Flags
@@ -14419,6 +14419,7 @@ and may be set in the config file.
--s3-max-upload-parts int Maximum number of parts in a multipart upload (default 10000)
--s3-memory-pool-flush-time Duration How often internal memory buffer pools will be flushed (default 1m0s)
--s3-memory-pool-use-mmap Whether to use mmap buffers in internal memory pool
--s3-might-gzip Tristate Set this if the backend might gzip objects (default unset)
--s3-no-check-bucket If set, don't attempt to check the bucket exists or create it
--s3-no-head If set, don't HEAD uploaded objects to check integrity
--s3-no-head-object If set, do not do HEAD before GET when getting objects
@@ -18425,15 +18426,31 @@ Properties:
- "s3.ap-southeast-1.lyvecloud.seagate.com"
- Seagate Lyve Cloud AP Southeast 1 (Singapore)
- "s3.wasabisys.com"
- Wasabi US East endpoint
- Wasabi US East 1 (N. Virginia)
- "s3.us-east-2.wasabisys.com"
- Wasabi US East 2 (N. Virginia)
- "s3.us-central-1.wasabisys.com"
- Wasabi US Central 1 (Texas)
- "s3.us-west-1.wasabisys.com"
- Wasabi US West endpoint
- Wasabi US West 1 (Oregon)
- "s3.ca-central-1.wasabisys.com"
- Wasabi CA Central 1 (Toronto)
- "s3.eu-central-1.wasabisys.com"
- Wasabi EU Central endpoint
- Wasabi EU Central 1 (Amsterdam)
- "s3.eu-central-2.wasabisys.com"
- Wasabi EU Central 2 (Frankfurt)
- "s3.eu-west-1.wasabisys.com"
- Wasabi EU West 1 (London)
- "s3.eu-west-2.wasabisys.com"
- Wasabi EU West 2 (Paris)
- "s3.ap-northeast-1.wasabisys.com"
- Wasabi AP Northeast 1 (Tokyo) endpoint
- "s3.ap-northeast-2.wasabisys.com"
- Wasabi AP Northeast 2 (Osaka) endpoint
- "s3.ap-southeast-1.wasabisys.com"
- Wasabi AP Southeast 1 (Singapore)
- "s3.ap-southeast-2.wasabisys.com"
- Wasabi AP Southeast 2 (Sydney)
- "s3.ir-thr-at1.arvanstorage.com"
- ArvanCloud Tehran Iran (Asiatech) endpoint
@@ -19665,6 +19682,36 @@ Properties:
- Type: bool
- Default: false
--s3-might-gzip
Set this if the backend might gzip objects.
Normally providers will not alter objects when they are downloaded. If
an object was not uploaded with Content-Encoding: gzip then it won't be
set on download.
However some providers may gzip objects even if they weren't uploaded
with Content-Encoding: gzip (eg Cloudflare).
A symptom of this would be receiving errors like
ERROR corrupted on transfer: sizes differ NNN vs MMM
If you set this flag and rclone downloads an object with
Content-Encoding: gzip set and chunked transfer encoding, then rclone
will decompress the object on the fly.
If this is set to unset (the default) then rclone will choose according
to the provider setting what to apply, but you can override rclone's
choice here.
Properties:
- Config: might_gzip
- Env Var: RCLONE_S3_MIGHT_GZIP
- Type: Tristate
- Default: unset
--s3-no-system-metadata
Suppress setting and reading of system metadata
@@ -31679,8 +31726,22 @@ Features highlights
Configuration
Here is an example of making a mailru configuration. First create a
Mail.ru Cloud account and choose a tariff, then run
Here is an example of making a mailru configuration.
First create a Mail.ru Cloud account and choose a tariff.
You will need to log in and create an app password for rclone. Rclone
will not work with your normal username and password - it will give an
error like oauth2: server response missing access_token.
- Click on your user icon in the top right
- Go to Security / "Пароль и безопасность"
- Click password for apps / "Пароли для внешних приложений"
- Add the password - give it a name - eg "rclone"
- Copy the password and use this password below - your normal login
password won't work.
Now run
rclone config
@@ -31705,6 +31766,10 @@ This will guide you through an interactive setup process:
Enter a string value. Press Enter for the default ("").
user> username@mail.ru
Password
This must be an app password - rclone will not work with your normal
password. See the Configuration section in the docs for how to make an
app password.
y) Yes type in my own password
g) Generate random password
y/g> y
@@ -31826,6 +31891,10 @@ Properties:
Password.
This must be an app password - rclone will not work with your normal
password. See the Configuration section in the docs for how to make an
app password.
NB Input to this must be obscured - see rclone obscure.
Properties:
@@ -40428,6 +40497,53 @@ Options:
Changelog
v1.60.1 - 2022-11-17
See commits
- Bug Fixes
- lib/cache: Fix alias backend shutting down too soon (Nick
Craig-Wood)
- wasm: Fix walltime link error by adding up-to-date wasm_exec.js
(João Henrique Franco)
- docs
- Update faq.md with bisync (Samuel Johnson)
- Corrected download links in windows install docs
(coultonluke)
- Add direct download link for windows arm64 (albertony)
- Remove link to rclone slack as it is no longer supported
(Nick Craig-Wood)
- Faq: how to use a proxy server that requires a username and
password (asdffdsazqqq)
- Oracle-object-storage: doc fix (Manoj Ghosh)
- Fix typo remove in rclone_serve_restic command (Joda Stößer)
- Fix character that was incorrectly interpreted as markdown
(Clément Notin)
- VFS
- Fix deadlock caused by cache cleaner and upload finishing (Nick
Craig-Wood)
- Local
- Clean absolute paths (albertony)
- Fix -L/--copy-links with filters missing directories (Nick
Craig-Wood)
- Mailru
- Note that an app password is now needed (Nick Craig-Wood)
- Allow timestamps to be before the epoch 1970-01-01 (Nick
Craig-Wood)
- S3
- Add provider quirk --s3-might-gzip to fix corrupted on transfer:
sizes differ (Nick Craig-Wood)
- Allow Storj to server side copy since it seems to work now (Nick
Craig-Wood)
- Fix for unchecked err value in s3 listv2 (Aaron Gokaslan)
- Add additional Wasabi locations (techknowlogick)
- Smb
- Fix Failed to sync: context canceled at the end of syncs (Nick
Craig-Wood)
- WebDAV
- Fix Move/Copy/DirMove when using -server-side-across-configs
(Nick Craig-Wood)
v1.60.0 - 2022-10-21
See commits
@@ -45966,9 +46082,7 @@ metadata, which breaks the desired 1:1 mapping of files to objects.
Can rclone do bi-directional sync?
No, not at present. rclone only does uni-directional sync from A -> B.
It may do in the future though since it has all the primitives - it just
requires writing the algorithm to do it.
Yes, since rclone v1.58.0, bidirectional cloud sync is available.
Can I use rclone with an HTTP proxy?
@@ -45993,6 +46107,13 @@ set all possibilities. So, on Linux, you may end up with code similar to
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
Note: If the proxy server requires a username and password, then use
export http_proxy=http://username:password@proxyserver:12345
export https_proxy=$http_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
The NO_PROXY allows you to disable the proxy for specific hosts. Hosts
must be comma separated, and can contain domains or parts. For instance
"foo.com" also matches "bar.foo.com".
+1 -1
View File
@@ -1 +1 @@
v1.61.0
v1.60.1
+3 -31
View File
@@ -12,9 +12,9 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"path"
"strconv"
"strings"
@@ -595,15 +595,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
)
switch {
case opt.UseEmulator:
var actualEmulatorAccount = emulatorAccount
if opt.Account != "" {
actualEmulatorAccount = opt.Account
}
var actualEmulatorKey = emulatorAccountKey
if opt.Key != "" {
actualEmulatorKey = opt.Key
}
credential, err := azblob.NewSharedKeyCredential(actualEmulatorAccount, actualEmulatorKey)
credential, err := azblob.NewSharedKeyCredential(emulatorAccount, emulatorAccountKey)
if err != nil {
return nil, fmt.Errorf("failed to parse credentials: %w", err)
}
@@ -725,7 +717,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
return nil, fmt.Errorf("failed to make azure storage url from account and endpoint: %w", err)
}
// Try loading service principal credentials from file.
loadedCreds, err := os.ReadFile(env.ShellExpand(opt.ServicePrincipalFile))
loadedCreds, err := ioutil.ReadFile(env.ShellExpand(opt.ServicePrincipalFile))
if err != nil {
return nil, fmt.Errorf("error opening service principal credentials file: %w", err)
}
@@ -1685,26 +1677,6 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
}
}
// Apply upload options (also allows one to overwrite content-type)
for _, option := range options {
key, value := option.Header()
lowerKey := strings.ToLower(key)
switch lowerKey {
case "":
// ignore
case "cache-control":
httpHeaders.CacheControl = value
case "content-disposition":
httpHeaders.ContentDisposition = value
case "content-encoding":
httpHeaders.ContentEncoding = value
case "content-language":
httpHeaders.ContentLanguage = value
case "content-type":
httpHeaders.ContentType = value
}
}
uploadParts := maxUploadParts
if uploadParts < 1 {
uploadParts = 1
+4 -3
View File
@@ -9,6 +9,7 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"github.com/Azure/go-autorest/autorest/adal"
@@ -96,7 +97,7 @@ func GetMSIToken(ctx context.Context, identity *userMSI) (adal.Token, error) {
return result, fmt.Errorf("MSI is not enabled on this VM: %w", err)
}
defer func() { // resp and Body should not be nil
_, err = io.Copy(io.Discard, resp.Body)
_, err = io.Copy(ioutil.Discard, resp.Body)
if err != nil {
fs.Debugf(nil, "Unable to drain IMDS response: %v", err)
}
@@ -111,12 +112,12 @@ func GetMSIToken(ctx context.Context, identity *userMSI) (adal.Token, error) {
case 200, 201, 202:
break
default:
body, _ := io.ReadAll(resp.Body)
body, _ := ioutil.ReadAll(resp.Body)
fs.Errorf(nil, "Couldn't obtain OAuth token from IMDS; server returned status code %d and body: %v", resp.StatusCode, string(body))
return result, httpError{Response: resp}
}
b, err := io.ReadAll(resp.Body)
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
return result, fmt.Errorf("couldn't read IMDS response: %w", err)
}
+2 -2
View File
@@ -17,9 +17,9 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"path"
"strconv"
"strings"
@@ -183,7 +183,7 @@ func refreshJWTToken(ctx context.Context, jsonFile string, boxSubType string, na
}
func getBoxConfig(configFile string) (boxConfig *api.ConfigJSON, err error) {
file, err := os.ReadFile(configFile)
file, err := ioutil.ReadFile(configFile)
if err != nil {
return nil, fmt.Errorf("box: failed to read Box config: %w", err)
}
+4 -3
View File
@@ -11,6 +11,7 @@ import (
goflag "flag"
"fmt"
"io"
"io/ioutil"
"log"
"math/rand"
"os"
@@ -166,7 +167,7 @@ func TestInternalVfsCache(t *testing.T) {
li2 := [2]string{path.Join("test", "one"), path.Join("test", "second")}
for _, r := range li2 {
var err error
ci, err := os.ReadDir(path.Join(runInstance.chunkPath, runInstance.encryptRemoteIfNeeded(t, path.Join(id, r))))
ci, err := ioutil.ReadDir(path.Join(runInstance.chunkPath, runInstance.encryptRemoteIfNeeded(t, path.Join(id, r))))
if err != nil || len(ci) == 0 {
log.Printf("========== '%v' not in cache", r)
} else {
@@ -840,7 +841,7 @@ func newRun() *run {
}
if uploadDir == "" {
r.tmpUploadDir, err = os.MkdirTemp("", "rclonecache-tmp")
r.tmpUploadDir, err = ioutil.TempDir("", "rclonecache-tmp")
if err != nil {
panic(fmt.Sprintf("Failed to create temp dir: %v", err))
}
@@ -983,7 +984,7 @@ func (r *run) randomReader(t *testing.T, size int64) io.ReadCloser {
chunk := int64(1024)
cnt := size / chunk
left := size % chunk
f, err := os.CreateTemp("", "rclonecache-tempfile")
f, err := ioutil.TempFile("", "rclonecache-tempfile")
require.NoError(t, err)
for i := 0; i < int(cnt); i++ {
+2 -2
View File
@@ -8,7 +8,7 @@ import (
"crypto/tls"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strings"
@@ -167,7 +167,7 @@ func (p *plexConnector) listenWebsocket() {
continue
}
var data []byte
data, err = io.ReadAll(resp.Body)
data, err = ioutil.ReadAll(resp.Body)
if err != nil {
continue
}
+3 -2
View File
@@ -9,6 +9,7 @@ import (
"encoding/binary"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path"
"strconv"
@@ -472,7 +473,7 @@ func (b *Persistent) GetChunk(cachedObject *Object, offset int64) ([]byte, error
var data []byte
fp := path.Join(b.dataPath, cachedObject.abs(), strconv.FormatInt(offset, 10))
data, err := os.ReadFile(fp)
data, err := ioutil.ReadFile(fp)
if err != nil {
return nil, err
}
@@ -485,7 +486,7 @@ func (b *Persistent) AddChunk(fp string, data []byte, offset int64) error {
_ = os.MkdirAll(path.Join(b.dataPath, fp), os.ModePerm)
filePath := path.Join(b.dataPath, fp, strconv.FormatInt(offset, 10))
err := os.WriteFile(filePath, data, os.ModePerm)
err := ioutil.WriteFile(filePath, data, os.ModePerm)
if err != nil {
return err
}
+3 -2
View File
@@ -12,6 +12,7 @@ import (
"fmt"
gohash "hash"
"io"
"io/ioutil"
"math/rand"
"path"
"regexp"
@@ -1037,7 +1038,7 @@ func (o *Object) readMetadata(ctx context.Context) error {
if err != nil {
return err
}
metadata, err := io.ReadAll(reader)
metadata, err := ioutil.ReadAll(reader)
_ = reader.Close() // ensure file handle is freed on windows
if err != nil {
return err
@@ -1096,7 +1097,7 @@ func (o *Object) readXactID(ctx context.Context) (xactID string, err error) {
if err != nil {
return "", err
}
data, err := io.ReadAll(reader)
data, err := ioutil.ReadAll(reader)
_ = reader.Close() // ensure file handle is freed on windows
if err != nil {
return "", err
+8 -8
View File
@@ -5,7 +5,7 @@ import (
"context"
"flag"
"fmt"
"io"
"io/ioutil"
"path"
"regexp"
"strings"
@@ -413,7 +413,7 @@ func testSmallFileInternals(t *testing.T, f *Fs) {
if r == nil {
return
}
data, err := io.ReadAll(r)
data, err := ioutil.ReadAll(r)
assert.NoError(t, err)
assert.Equal(t, contents, string(data))
_ = r.Close()
@@ -538,7 +538,7 @@ func testPreventCorruption(t *testing.T, f *Fs) {
assert.NoError(t, err)
var chunkContents []byte
assert.NotPanics(t, func() {
chunkContents, err = io.ReadAll(r)
chunkContents, err = ioutil.ReadAll(r)
_ = r.Close()
})
assert.NoError(t, err)
@@ -573,7 +573,7 @@ func testPreventCorruption(t *testing.T, f *Fs) {
r, err = willyChunk.Open(ctx)
assert.NoError(t, err)
assert.NotPanics(t, func() {
_, err = io.ReadAll(r)
_, err = ioutil.ReadAll(r)
_ = r.Close()
})
assert.NoError(t, err)
@@ -672,7 +672,7 @@ func testMetadataInput(t *testing.T, f *Fs) {
assert.NoError(t, err, "open "+description)
assert.NotNil(t, r, "open stream of "+description)
if err == nil && r != nil {
data, err := io.ReadAll(r)
data, err := ioutil.ReadAll(r)
assert.NoError(t, err, "read all of "+description)
assert.Equal(t, contents, string(data), description+" contents is ok")
_ = r.Close()
@@ -758,8 +758,8 @@ func testFutureProof(t *testing.T, f *Fs) {
assert.Error(t, err)
// Rcat must fail
in := io.NopCloser(bytes.NewBufferString("abc"))
robj, err := operations.Rcat(ctx, f, file, in, modTime, nil)
in := ioutil.NopCloser(bytes.NewBufferString("abc"))
robj, err := operations.Rcat(ctx, f, file, in, modTime)
assert.Nil(t, robj)
assert.NotNil(t, err)
if err != nil {
@@ -854,7 +854,7 @@ func testChunkerServerSideMove(t *testing.T, f *Fs) {
r, err := dstFile.Open(ctx)
assert.NoError(t, err)
assert.NotNil(t, r)
data, err := io.ReadAll(r)
data, err := ioutil.ReadAll(r)
assert.NoError(t, err)
assert.Equal(t, contents, string(data))
_ = r.Close()
+4 -3
View File
@@ -13,6 +13,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"regexp"
"strings"
@@ -467,7 +468,7 @@ func (f *Fs) rcat(ctx context.Context, dstFileName string, in io.ReadCloser, mod
}
fs.Debugf(f, "Target remote doesn't support streaming uploads, creating temporary local file")
tempFile, err := os.CreateTemp("", "rclone-press-")
tempFile, err := ioutil.TempFile("", "rclone-press-")
defer func() {
// these errors should be relatively uncritical and the upload should've succeeded so it's okay-ish
// to ignore them
@@ -545,8 +546,8 @@ func (f *Fs) putCompress(ctx context.Context, in io.Reader, src fs.ObjectInfo, o
}
// Transfer the data
o, err := f.rcat(ctx, makeDataName(src.Remote(), src.Size(), f.mode), io.NopCloser(wrappedIn), src.ModTime(ctx), options)
//o, err := operations.Rcat(ctx, f.Fs, makeDataName(src.Remote(), src.Size(), f.mode), io.NopCloser(wrappedIn), src.ModTime(ctx))
o, err := f.rcat(ctx, makeDataName(src.Remote(), src.Size(), f.mode), ioutil.NopCloser(wrappedIn), src.ModTime(ctx), options)
//o, err := operations.Rcat(ctx, f.Fs, makeDataName(src.Remote(), src.Size(), f.mode), ioutil.NopCloser(wrappedIn), src.ModTime(ctx))
if err != nil {
if o != nil {
removeErr := o.Remove(ctx)
+16 -15
View File
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"strings"
"testing"
@@ -1072,7 +1073,7 @@ func testEncryptDecrypt(t *testing.T, bufSize int, copySize int64) {
source := newRandomSource(copySize)
encrypted, err := c.newEncrypter(source, nil)
assert.NoError(t, err)
decrypted, err := c.newDecrypter(io.NopCloser(encrypted))
decrypted, err := c.newDecrypter(ioutil.NopCloser(encrypted))
assert.NoError(t, err)
sink := newRandomSource(copySize)
n, err := io.CopyBuffer(sink, decrypted, buf)
@@ -1143,15 +1144,15 @@ func TestEncryptData(t *testing.T) {
buf := bytes.NewBuffer(test.in)
encrypted, err := c.EncryptData(buf)
assert.NoError(t, err)
out, err := io.ReadAll(encrypted)
out, err := ioutil.ReadAll(encrypted)
assert.NoError(t, err)
assert.Equal(t, test.expected, out)
// Check we can decode the data properly too...
buf = bytes.NewBuffer(out)
decrypted, err := c.DecryptData(io.NopCloser(buf))
decrypted, err := c.DecryptData(ioutil.NopCloser(buf))
assert.NoError(t, err)
out, err = io.ReadAll(decrypted)
out, err = ioutil.ReadAll(decrypted)
assert.NoError(t, err)
assert.Equal(t, test.in, out)
}
@@ -1186,7 +1187,7 @@ func TestNewEncrypterErrUnexpectedEOF(t *testing.T) {
fh, err := c.newEncrypter(in, nil)
assert.NoError(t, err)
n, err := io.CopyN(io.Discard, fh, 1e6)
n, err := io.CopyN(ioutil.Discard, fh, 1e6)
assert.Equal(t, io.ErrUnexpectedEOF, err)
assert.Equal(t, int64(32), n)
}
@@ -1256,12 +1257,12 @@ func TestNewDecrypterErrUnexpectedEOF(t *testing.T) {
in2 := &readers.ErrorReader{Err: io.ErrUnexpectedEOF}
in1 := bytes.NewBuffer(file16)
in := io.NopCloser(io.MultiReader(in1, in2))
in := ioutil.NopCloser(io.MultiReader(in1, in2))
fh, err := c.newDecrypter(in)
assert.NoError(t, err)
n, err := io.CopyN(io.Discard, fh, 1e6)
n, err := io.CopyN(ioutil.Discard, fh, 1e6)
assert.Equal(t, io.ErrUnexpectedEOF, err)
assert.Equal(t, int64(16), n)
}
@@ -1273,14 +1274,14 @@ func TestNewDecrypterSeekLimit(t *testing.T) {
// Make random data
const dataSize = 150000
plaintext, err := io.ReadAll(newRandomSource(dataSize))
plaintext, err := ioutil.ReadAll(newRandomSource(dataSize))
assert.NoError(t, err)
// Encrypt the data
buf := bytes.NewBuffer(plaintext)
encrypted, err := c.EncryptData(buf)
assert.NoError(t, err)
ciphertext, err := io.ReadAll(encrypted)
ciphertext, err := ioutil.ReadAll(encrypted)
assert.NoError(t, err)
trials := []int{0, 1, 2, 3, 4, 5, 7, 8, 9, 15, 16, 17, 31, 32, 33, 63, 64, 65,
@@ -1299,7 +1300,7 @@ func TestNewDecrypterSeekLimit(t *testing.T) {
end = len(ciphertext)
}
}
reader = io.NopCloser(bytes.NewBuffer(ciphertext[int(underlyingOffset):end]))
reader = ioutil.NopCloser(bytes.NewBuffer(ciphertext[int(underlyingOffset):end]))
return reader, nil
}
@@ -1489,7 +1490,7 @@ func TestDecrypterRead(t *testing.T) {
assert.NoError(t, err, what)
continue
}
_, err = io.ReadAll(fh)
_, err = ioutil.ReadAll(fh)
var expectedErr error
switch {
case i == fileHeaderSize:
@@ -1513,7 +1514,7 @@ func TestDecrypterRead(t *testing.T) {
cd := newCloseDetector(in)
fh, err := c.newDecrypter(cd)
assert.NoError(t, err)
_, err = io.ReadAll(fh)
_, err = ioutil.ReadAll(fh)
assert.Error(t, err, "potato")
assert.Equal(t, 0, cd.closed)
@@ -1523,13 +1524,13 @@ func TestDecrypterRead(t *testing.T) {
copy(file16copy, file16)
for i := range file16copy {
file16copy[i] ^= 0xFF
fh, err := c.newDecrypter(io.NopCloser(bytes.NewBuffer(file16copy)))
fh, err := c.newDecrypter(ioutil.NopCloser(bytes.NewBuffer(file16copy)))
if i < fileMagicSize {
assert.Error(t, err, ErrorEncryptedBadMagic.Error())
assert.Nil(t, fh)
} else {
assert.NoError(t, err)
_, err = io.ReadAll(fh)
_, err = ioutil.ReadAll(fh)
assert.Error(t, err, ErrorEncryptedFileBadHeader.Error())
}
file16copy[i] ^= 0xFF
@@ -1564,7 +1565,7 @@ func TestDecrypterClose(t *testing.T) {
assert.Equal(t, 0, cd.closed)
// close after reading
out, err := io.ReadAll(fh)
out, err := ioutil.ReadAll(fh)
assert.NoError(t, err)
assert.Equal(t, []byte{1}, out)
assert.Equal(t, io.EOF, fh.err)
+3 -3
View File
@@ -14,9 +14,9 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"mime"
"net/http"
"os"
"path"
"regexp"
"sort"
@@ -1108,7 +1108,7 @@ func createOAuthClient(ctx context.Context, opt *Options, name string, m configm
// try loading service account credentials from env variable, then from a file
if len(opt.ServiceAccountCredentials) == 0 && opt.ServiceAccountFile != "" {
loadedCreds, err := os.ReadFile(env.ShellExpand(opt.ServiceAccountFile))
loadedCreds, err := ioutil.ReadFile(env.ShellExpand(opt.ServiceAccountFile))
if err != nil {
return nil, fmt.Errorf("error opening service account credentials file: %w", err)
}
@@ -3800,7 +3800,7 @@ func (o *linkObject) Open(ctx context.Context, options ...fs.OpenOption) (in io.
data = data[:limit]
}
return io.NopCloser(bytes.NewReader(data)), nil
return ioutil.NopCloser(bytes.NewReader(data)), nil
}
func (o *baseObject) update(ctx context.Context, updateInfo *drive.File, uploadMimeType string, in io.Reader,
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"mime"
"os"
"path"
@@ -77,7 +78,7 @@ var additionalMimeTypes = map[string]string{
// Load the example export formats into exportFormats for testing
func TestInternalLoadExampleFormats(t *testing.T) {
fetchFormatsOnce.Do(func() {})
buf, err := os.ReadFile(filepath.FromSlash("test/about.json"))
buf, err := ioutil.ReadFile(filepath.FromSlash("test/about.json"))
var about struct {
ExportFormats map[string][]string `json:"exportFormats,omitempty"`
ImportFormats map[string][]string `json:"importFormats,omitempty"`
+2 -1
View File
@@ -20,6 +20,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"path"
@@ -1185,7 +1186,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
return nil, errors.New("can't download - no id")
}
if o.contentType == emptyMimeType {
return io.NopCloser(bytes.NewReader([]byte{})), nil
return ioutil.NopCloser(bytes.NewReader([]byte{})), nil
}
fs.FixRangeOption(options, o.size)
resp, err := o.fs.rpc(ctx, "getFile", params{
@@ -19,8 +19,8 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path"
"strconv"
"strings"
@@ -487,7 +487,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
// try loading service account credentials from env variable, then from a file
if opt.ServiceAccountCredentials == "" && opt.ServiceAccountFile != "" {
loadedCreds, err := os.ReadFile(env.ShellExpand(opt.ServiceAccountFile))
loadedCreds, err := ioutil.ReadFile(env.ShellExpand(opt.ServiceAccountFile))
if err != nil {
return nil, fmt.Errorf("error opening service account credentials file: %w", err)
}
+2 -2
View File
@@ -3,7 +3,7 @@ package googlephotos
import (
"context"
"fmt"
"io"
"io/ioutil"
"net/http"
"path"
"testing"
@@ -99,7 +99,7 @@ func TestIntegration(t *testing.T) {
t.Run("ObjectOpen", func(t *testing.T) {
in, err := dstObj.Open(ctx)
require.NoError(t, err)
buf, err := io.ReadAll(in)
buf, err := ioutil.ReadAll(in)
require.NoError(t, err)
require.NoError(t, in.Close())
assert.True(t, len(buf) > 1000)
+2 -1
View File
@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"path"
"time"
@@ -117,7 +118,7 @@ func (o *Object) updateHashes(ctx context.Context) error {
defer func() {
_ = r.Close()
}()
if _, err = io.Copy(io.Discard, r); err != nil {
if _, err = io.Copy(ioutil.Discard, r); err != nil {
fs.Infof(o, "update failed (copy): %v", err)
return err
}
+15 -14
View File
@@ -13,6 +13,7 @@ import (
"net/http"
"net/url"
"path"
"strconv"
"strings"
"sync"
"time"
@@ -304,7 +305,7 @@ func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) {
fs: f,
remote: remote,
}
err := o.head(ctx)
err := o.stat(ctx)
if err != nil {
return nil, err
}
@@ -316,6 +317,15 @@ func (f *Fs) url(remote string) string {
return f.endpointURL + rest.URLPathEscape(remote)
}
// parse s into an int64, on failure return def
func parseInt64(s string, def int64) int64 {
n, e := strconv.ParseInt(s, 10, 64)
if e != nil {
return def
}
return n
}
// Errors returned by parseName
var (
errURLJoinFailed = errors.New("URLJoin failed")
@@ -490,7 +500,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
fs: f,
remote: remote,
}
switch err := file.head(ctx); err {
switch err := file.stat(ctx); err {
case nil:
add(file)
case fs.ErrorNotAFile:
@@ -569,8 +579,8 @@ func (o *Object) url() string {
return o.fs.url(o.remote)
}
// head sends a HEAD request to update info fields in the Object
func (o *Object) head(ctx context.Context) error {
// stat updates the info field in the Object
func (o *Object) stat(ctx context.Context) error {
if o.fs.opt.NoHead {
o.size = -1
o.modTime = timeUnset
@@ -591,19 +601,13 @@ func (o *Object) head(ctx context.Context) error {
if err != nil {
return fmt.Errorf("failed to stat: %w", err)
}
return o.decodeMetadata(ctx, res)
}
// decodeMetadata updates info fields in the Object according to HTTP response headers
func (o *Object) decodeMetadata(ctx context.Context, res *http.Response) error {
t, err := http.ParseTime(res.Header.Get("Last-Modified"))
if err != nil {
t = timeUnset
}
o.size = parseInt64(res.Header.Get("Content-Length"), -1)
o.modTime = t
o.contentType = res.Header.Get("Content-Type")
o.size = rest.ParseSizeFromHeaders(res.Header)
// If NoSlash is set then check ContentType to see if it is a directory
if o.fs.opt.NoSlash {
mediaType, _, err := mime.ParseMediaType(o.contentType)
@@ -649,9 +653,6 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
if err != nil {
return nil, fmt.Errorf("Open failed: %w", err)
}
if err = o.decodeMetadata(ctx, res); err != nil {
return nil, fmt.Errorf("decodeMetadata failed: %w", err)
}
return res.Body, nil
}
+24 -59
View File
@@ -3,7 +3,7 @@ package http
import (
"context"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
@@ -41,12 +41,12 @@ func prepareServer(t *testing.T) (configmap.Simple, func()) {
// verify the file path is correct, and also check which line endings
// are used to get sizes right ("\n" except on Windows, but even there
// we may have "\n" or "\r\n" depending on git crlf setting)
fileList, err := os.ReadDir(filesPath)
fileList, err := ioutil.ReadDir(filesPath)
require.NoError(t, err)
require.Greater(t, len(fileList), 0)
for _, file := range fileList {
if !file.IsDir() {
data, _ := os.ReadFile(filepath.Join(filesPath, file.Name()))
data, _ := ioutil.ReadFile(filepath.Join(filesPath, file.Name()))
if strings.HasSuffix(string(data), "\r\n") {
lineEndSize = 2
}
@@ -194,66 +194,31 @@ func TestNewObject(t *testing.T) {
}
func TestOpen(t *testing.T) {
m, tidy := prepareServer(t)
f, tidy := prepare(t)
defer tidy()
for _, head := range []bool{false, true} {
if !head {
m.Set("no_head", "true")
}
f, err := NewFs(context.Background(), remoteName, "", m)
require.NoError(t, err)
o, err := f.NewObject(context.Background(), "four/under four.txt")
require.NoError(t, err)
for _, rangeRead := range []bool{false, true} {
o, err := f.NewObject(context.Background(), "four/under four.txt")
require.NoError(t, err)
if !head {
// Test mod time is still indeterminate
tObj := o.ModTime(context.Background())
assert.Equal(t, time.Duration(0), time.Unix(0, 0).Sub(tObj))
// Test file size is still indeterminate
assert.Equal(t, int64(-1), o.Size())
}
var data []byte
if !rangeRead {
// Test normal read
fd, err := o.Open(context.Background())
require.NoError(t, err)
data, err = io.ReadAll(fd)
require.NoError(t, err)
require.NoError(t, fd.Close())
if lineEndSize == 2 {
assert.Equal(t, "beetroot\r\n", string(data))
} else {
assert.Equal(t, "beetroot\n", string(data))
}
} else {
// Test with range request
fd, err := o.Open(context.Background(), &fs.RangeOption{Start: 1, End: 5})
require.NoError(t, err)
data, err = io.ReadAll(fd)
require.NoError(t, err)
require.NoError(t, fd.Close())
assert.Equal(t, "eetro", string(data))
}
fi, err := os.Stat(filepath.Join(filesPath, "four", "under four.txt"))
require.NoError(t, err)
tFile := fi.ModTime()
// Test the time is always correct on the object after file open
tObj := o.ModTime(context.Background())
fstest.AssertTimeEqualWithPrecision(t, o.Remote(), tFile, tObj, time.Second)
if !rangeRead {
// Test the file size
assert.Equal(t, int64(len(data)), o.Size())
}
}
// Test normal read
fd, err := o.Open(context.Background())
require.NoError(t, err)
data, err := ioutil.ReadAll(fd)
require.NoError(t, err)
require.NoError(t, fd.Close())
if lineEndSize == 2 {
assert.Equal(t, "beetroot\r\n", string(data))
} else {
assert.Equal(t, "beetroot\n", string(data))
}
// Test with range request
fd, err = o.Open(context.Background(), &fs.RangeOption{Start: 1, End: 5})
require.NoError(t, err)
data, err = ioutil.ReadAll(fd)
require.NoError(t, err)
require.NoError(t, fd.Close())
assert.Equal(t, "eetro", string(data))
}
func TestMimeType(t *testing.T) {
+6 -5
View File
@@ -12,6 +12,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"math/rand"
"net/http"
"net/url"
@@ -821,7 +822,7 @@ func (f *Fs) allocatePathRaw(file string, absolute bool) string {
func grantTypeFilter(req *http.Request) {
if legacyTokenURL == req.URL.String() {
// read the entire body
refreshBody, err := io.ReadAll(req.Body)
refreshBody, err := ioutil.ReadAll(req.Body)
if err != nil {
return
}
@@ -831,7 +832,7 @@ func grantTypeFilter(req *http.Request) {
refreshBody = []byte(strings.Replace(string(refreshBody), "grant_type=refresh_token", "grant_type=REFRESH_TOKEN", 1))
// set the new ReadCloser (with a dummy Close())
req.Body = io.NopCloser(bytes.NewReader(refreshBody))
req.Body = ioutil.NopCloser(bytes.NewReader(refreshBody))
}
}
@@ -1788,7 +1789,7 @@ func readMD5(in io.Reader, size, threshold int64) (md5sum string, out io.Reader,
var tempFile *os.File
// create the cache file
tempFile, err = os.CreateTemp("", cachePrefix)
tempFile, err = ioutil.TempFile("", cachePrefix)
if err != nil {
return
}
@@ -1816,7 +1817,7 @@ func readMD5(in io.Reader, size, threshold int64) (md5sum string, out io.Reader,
} else {
// that's a small file, just read it into memory
var inData []byte
inData, err = io.ReadAll(teeReader)
inData, err = ioutil.ReadAll(teeReader)
if err != nil {
return
}
@@ -1913,7 +1914,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
// copy the already uploaded bytes into the trash :)
var result api.UploadResponse
_, err = io.CopyN(io.Discard, in, response.ResumePos)
_, err = io.CopyN(ioutil.Discard, in, response.ResumePos)
if err != nil {
return err
}
+5 -4
View File
@@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"path/filepath"
@@ -123,8 +124,8 @@ routine so this flag shouldn't normally be used.`,
Help: `Don't check to see if the files change during upload.
Normally rclone checks the size and modification time of files as they
are being uploaded and aborts with a message which starts "can't copy -
source file is being updated" if the file changes during upload.
are being uploaded and aborts with a message which starts "can't copy
- source file is being updated" if the file changes during upload.
However on some file systems this modification time check may fail (e.g.
[Glusterfs #2206](https://github.com/rclone/rclone/issues/2206)) so this
@@ -645,7 +646,7 @@ func (f *Fs) readPrecision() (precision time.Duration) {
precision = time.Second
// Create temporary file and test it
fd, err := os.CreateTemp("", "rclone")
fd, err := ioutil.TempFile("", "rclone")
if err != nil {
// If failed return 1s
// fmt.Println("Failed to create temp file", err)
@@ -1072,7 +1073,7 @@ func (o *Object) openTranslatedLink(offset, limit int64) (lrc io.ReadCloser, err
if err != nil {
return nil, err
}
return readers.NewLimitedReadCloser(io.NopCloser(strings.NewReader(linkdst[offset:])), limit), nil
return readers.NewLimitedReadCloser(ioutil.NopCloser(strings.NewReader(linkdst[offset:])), limit), nil
}
// Open an object for read
+3 -3
View File
@@ -4,7 +4,7 @@ import (
"bytes"
"context"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"path/filepath"
@@ -150,7 +150,7 @@ func TestSymlink(t *testing.T) {
// Check reading the object
in, err := o.Open(ctx)
require.NoError(t, err)
contents, err := io.ReadAll(in)
contents, err := ioutil.ReadAll(in)
require.NoError(t, err)
require.Equal(t, "file.txt", string(contents))
require.NoError(t, in.Close())
@@ -158,7 +158,7 @@ func TestSymlink(t *testing.T) {
// Check reading the object with range
in, err = o.Open(ctx, &fs.RangeOption{Start: 2, End: 5})
require.NoError(t, err)
contents, err = io.ReadAll(in)
contents, err = ioutil.ReadAll(in)
require.NoError(t, err)
require.Equal(t, "file.txt"[2:5+1], string(contents))
require.NoError(t, in.Close())
+2 -1
View File
@@ -1,6 +1,7 @@
package local
import (
"io/ioutil"
"os"
"sync"
"testing"
@@ -12,7 +13,7 @@ import (
// Check we can remove an open file
func TestRemove(t *testing.T) {
fd, err := os.CreateTemp("", "rclone-remove-test")
fd, err := ioutil.TempFile("", "rclone-remove-test")
require.NoError(t, err)
name := fd.Name()
defer func() {
+4 -3
View File
@@ -18,6 +18,7 @@ import (
"encoding/hex"
"encoding/json"
"io/ioutil"
"net/http"
"net/url"
@@ -1659,7 +1660,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
// Attempt to put by calculating hash in memory
if trySpeedup && size <= int64(o.fs.opt.SpeedupMaxMem) {
fileBuf, err = io.ReadAll(in)
fileBuf, err = ioutil.ReadAll(in)
if err != nil {
return err
}
@@ -1702,7 +1703,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
if size <= mrhash.Size {
// Optimize upload: skip extra request if data fits in the hash buffer.
if fileBuf == nil {
fileBuf, err = io.ReadAll(wrapIn)
fileBuf, err = ioutil.ReadAll(wrapIn)
}
if fileHash == nil && err == nil {
fileHash = mrhash.Sum(fileBuf)
@@ -2213,7 +2214,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
fs.Debugf(o, "Server returned full content instead of range")
if start > 0 {
// Discard the beginning of the data
_, err = io.CopyN(io.Discard, wrapStream, start)
_, err = io.CopyN(ioutil.Discard, wrapStream, start)
if err != nil {
closeBody(res)
return nil, err
+3 -2
View File
@@ -8,6 +8,7 @@ import (
"encoding/hex"
"fmt"
"io"
"io/ioutil"
"path"
"strings"
"sync"
@@ -574,7 +575,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
}
data = data[:limit]
}
return io.NopCloser(bytes.NewBuffer(data)), nil
return ioutil.NopCloser(bytes.NewBuffer(data)), nil
}
// Update the object with the contents of the io.Reader, modTime and size
@@ -582,7 +583,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
// The new object may have been created if an error is returned
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {
bucket, bucketPath := o.split()
data, err := io.ReadAll(in)
data, err := ioutil.ReadAll(in)
if err != nil {
return fmt.Errorf("failed to update memory object: %w", err)
}
+3 -2
View File
@@ -12,6 +12,7 @@ import (
"fmt"
gohash "hash"
"io"
"io/ioutil"
"math/rand"
"net/http"
"net/url"
@@ -971,7 +972,7 @@ func (o *Object) netStorageUploadRequest(ctx context.Context, in io.Reader, src
URL = o.fs.url(src.Remote())
}
if strings.HasSuffix(URL, ".rclonelink") {
bits, err := io.ReadAll(in)
bits, err := ioutil.ReadAll(in)
if err != nil {
return err
}
@@ -1057,7 +1058,7 @@ func (o *Object) netStorageDownloadRequest(ctx context.Context, options []fs.Ope
if strings.HasSuffix(URL, ".rclonelink") && o.target != "" {
fs.Infof(nil, "Converting a symlink to the rclonelink file on download %q", URL)
reader := strings.NewReader(o.target)
readcloser := io.NopCloser(reader)
readcloser := ioutil.NopCloser(reader)
return readcloser, nil
}
+35 -32
View File
@@ -15,6 +15,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"path"
@@ -25,8 +26,6 @@ import (
"sync"
"time"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/corehandlers"
@@ -1570,11 +1569,7 @@ This ACL is used for creating objects and if bucket_acl isn't set, for creating
For more info visit https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl
Note that this ACL is applied when server-side copying objects as S3
doesn't copy the ACL from the source but rather writes a fresh one.
If the acl is an empty string then no X-Amz-Acl: header is added and
the default (private) will be used.
`,
doesn't copy the ACL from the source but rather writes a fresh one.`,
Provider: "!Storj,Cloudflare",
Examples: []fs.OptionExample{{
Value: "default",
@@ -1628,11 +1623,7 @@ the default (private) will be used.
For more info visit https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl
Note that this ACL is applied when only when creating buckets. If it
isn't set then "acl" is used instead.
If the "acl" and "bucket_acl" are empty strings then no X-Amz-Acl:
header is added and the default (private) will be used.
`,
isn't set then "acl" is used instead.`,
Advanced: true,
Examples: []fs.OptionExample{{
Value: "private",
@@ -2855,14 +2846,6 @@ func (f *Fs) setRoot(root string) {
f.rootBucket, f.rootDirectory = bucket.Split(f.root)
}
// return a pointer to the string if non empty or nil if it is empty
func stringPointerOrNil(s string) *string {
if s == "" {
return nil
}
return &s
}
// NewFs constructs an Fs from the path, bucket:path
func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error) {
// Parse config into Options struct
@@ -2882,6 +2865,9 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
if opt.Versions && opt.VersionAt.IsSet() {
return nil, errors.New("s3: cant use --s3-versions and --s3-version-at at the same time")
}
if opt.ACL == "" {
opt.ACL = "private"
}
if opt.BucketACL == "" {
opt.BucketACL = opt.ACL
}
@@ -3071,13 +3057,19 @@ func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) {
// Gets the bucket location
func (f *Fs) getBucketLocation(ctx context.Context, bucket string) (string, error) {
region, err := s3manager.GetBucketRegion(ctx, f.ses, bucket, "", func(r *request.Request) {
r.Config.S3ForcePathStyle = aws.Bool(f.opt.ForcePathStyle)
req := s3.GetBucketLocationInput{
Bucket: &bucket,
}
var resp *s3.GetBucketLocationOutput
var err error
err = f.pacer.Call(func() (bool, error) {
resp, err = f.c.GetBucketLocation(&req)
return f.shouldRetry(ctx, err)
})
if err != nil {
return "", err
}
return region, nil
return s3.NormalizeBucketLocation(aws.StringValue(resp.LocationConstraint)), nil
}
// Updates the region for the bucket by reading the region from the
@@ -3752,7 +3744,7 @@ func (f *Fs) makeBucket(ctx context.Context, bucket string) error {
return f.cache.Create(bucket, func() error {
req := s3.CreateBucketInput{
Bucket: &bucket,
ACL: stringPointerOrNil(f.opt.BucketACL),
ACL: &f.opt.BucketACL,
}
if f.opt.LocationConstraint != "" {
req.CreateBucketConfiguration = &s3.CreateBucketConfiguration{
@@ -3817,7 +3809,7 @@ func pathEscape(s string) string {
// method
func (f *Fs) copy(ctx context.Context, req *s3.CopyObjectInput, dstBucket, dstPath, srcBucket, srcPath string, src *Object) error {
req.Bucket = &dstBucket
req.ACL = stringPointerOrNil(f.opt.ACL)
req.ACL = &f.opt.ACL
req.Key = &dstPath
source := pathEscape(path.Join(srcBucket, srcPath))
if src.versionID != nil {
@@ -4795,12 +4787,23 @@ func (o *Object) downloadFromURL(ctx context.Context, bucketPath string, options
return nil, err
}
contentLength := rest.ParseSizeFromHeaders(resp.Header)
if contentLength < 0 {
fs.Debugf(o, "Failed to parse file size from headers")
contentLength := &resp.ContentLength
if resp.Header.Get("Content-Range") != "" {
var contentRange = resp.Header.Get("Content-Range")
slash := strings.IndexRune(contentRange, '/')
if slash >= 0 {
i, err := strconv.ParseInt(contentRange[slash+1:], 10, 64)
if err == nil {
contentLength = &i
} else {
fs.Debugf(o, "Failed to find parse integer from in %q: %v", contentRange, err)
}
} else {
fs.Debugf(o, "Failed to find length in %q", contentRange)
}
}
lastModified, err := http.ParseTime(resp.Header.Get("Last-Modified"))
lastModified, err := time.Parse(time.RFC1123, resp.Header.Get("Last-Modified"))
if err != nil {
fs.Debugf(o, "Failed to parse last modified from string %s, %v", resp.Header.Get("Last-Modified"), err)
}
@@ -4824,7 +4827,7 @@ func (o *Object) downloadFromURL(ctx context.Context, bucketPath string, options
var head = s3.HeadObjectOutput{
ETag: header("Etag"),
ContentLength: &contentLength,
ContentLength: contentLength,
LastModified: &lastModified,
Metadata: metaData,
CacheControl: header("Cache-Control"),
@@ -5170,7 +5173,7 @@ func (o *Object) uploadSinglepartPutObject(ctx context.Context, req *s3.PutObjec
// Can't upload zero length files like this for some reason
r.Body = bytes.NewReader([]byte{})
} else {
r.SetStreamingBody(io.NopCloser(in))
r.SetStreamingBody(ioutil.NopCloser(in))
}
r.SetContext(ctx)
r.HTTPRequest.Header.Set("X-Amz-Content-Sha256", "UNSIGNED-PAYLOAD")
@@ -5284,7 +5287,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
req := s3.PutObjectInput{
Bucket: &bucket,
ACL: stringPointerOrNil(o.fs.opt.ACL),
ACL: &o.fs.opt.ACL,
Key: &bucketPath,
}
+2 -1
View File
@@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"path"
@@ -632,7 +633,7 @@ func (f *Fs) download(ctx context.Context, url string, size int64, options ...fs
})
if start > 0 {
// We need to read and discard the beginning of the data...
_, err = io.CopyN(io.Discard, resp.Body, start)
_, err = io.CopyN(ioutil.Discard, resp.Body, start)
if err != nil {
return nil, err
}
+14 -78
View File
@@ -10,6 +10,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"regexp"
@@ -122,10 +123,7 @@ This enables the use of the following insecure ciphers and key exchange methods:
- diffie-hellman-group-exchange-sha256
- diffie-hellman-group-exchange-sha1
Those algorithms are insecure and may allow plaintext data to be recovered by an attacker.
This must be false if you use either ciphers or key_exchange advanced options.
`,
Those algorithms are insecure and may allow plaintext data to be recovered by an attacker.`,
Default: false,
Examples: []fs.OptionExample{
{
@@ -327,46 +325,6 @@ and pass variables with spaces in in quotes, eg
"VAR3=value with space" "VAR4=value with space" VAR5=nospacehere
`,
Advanced: true,
}, {
Name: "ciphers",
Default: fs.SpaceSepList{},
Help: `Space separated list of ciphers to be used for session encryption, ordered by preference.
At least one must match with server configuration. This can be checked for example using ssh -Q cipher.
This must not be set if use_insecure_cipher is true.
Example:
aes128-ctr aes192-ctr aes256-ctr aes128-gcm@openssh.com aes256-gcm@openssh.com
`,
Advanced: true,
}, {
Name: "key_exchange",
Default: fs.SpaceSepList{},
Help: `Space separated list of key exchange algorithms, ordered by preference.
At least one must match with server configuration. This can be checked for example using ssh -Q kex.
This must not be set if use_insecure_cipher is true.
Example:
sntrup761x25519-sha512@openssh.com curve25519-sha256 curve25519-sha256@libssh.org ecdh-sha2-nistp256
`,
Advanced: true,
}, {
Name: "macs",
Default: fs.SpaceSepList{},
Help: `Space separated list of MACs (message authentication code) algorithms, ordered by preference.
At least one must match with server configuration. This can be checked for example using ssh -Q mac.
Example:
umac-64-etm@openssh.com umac-128-etm@openssh.com hmac-sha2-256-etm@openssh.com
`,
Advanced: true,
}},
@@ -404,9 +362,6 @@ type Options struct {
ChunkSize fs.SizeSuffix `config:"chunk_size"`
Concurrency int `config:"concurrency"`
SetEnv fs.SpaceSepList `config:"set_env"`
Ciphers fs.SpaceSepList `config:"ciphers"`
KeyExchange fs.SpaceSepList `config:"key_exchange"`
MACs fs.SpaceSepList `config:"macs"`
}
// Fs stores the interface to the remote SFTP files
@@ -747,25 +702,10 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
sshConfig.HostKeyCallback = hostcallback
}
if opt.UseInsecureCipher && (opt.Ciphers != nil || opt.KeyExchange != nil) {
return nil, fmt.Errorf("use_insecure_cipher must be false if ciphers or key_exchange are set in advanced configuration")
}
sshConfig.Config.SetDefaults()
if opt.UseInsecureCipher {
sshConfig.Config.SetDefaults()
sshConfig.Config.Ciphers = append(sshConfig.Config.Ciphers, "aes128-cbc", "aes192-cbc", "aes256-cbc", "3des-cbc")
sshConfig.Config.KeyExchanges = append(sshConfig.Config.KeyExchanges, "diffie-hellman-group-exchange-sha1", "diffie-hellman-group-exchange-sha256")
} else {
if opt.Ciphers != nil {
sshConfig.Config.Ciphers = opt.Ciphers
}
if opt.KeyExchange != nil {
sshConfig.Config.KeyExchanges = opt.KeyExchange
}
}
if opt.MACs != nil {
sshConfig.Config.MACs = opt.MACs
}
keyFile := env.ShellExpand(opt.KeyFile)
@@ -782,7 +722,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
return nil, fmt.Errorf("couldn't read ssh agent signers: %w", err)
}
if keyFile != "" {
pubBytes, err := os.ReadFile(keyFile + ".pub")
pubBytes, err := ioutil.ReadFile(keyFile + ".pub")
if err != nil {
return nil, fmt.Errorf("failed to read public key file: %w", err)
}
@@ -811,7 +751,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
if keyFile != "" || opt.KeyPem != "" {
var key []byte
if opt.KeyPem == "" {
key, err = os.ReadFile(keyFile)
key, err = ioutil.ReadFile(keyFile)
if err != nil {
return nil, fmt.Errorf("failed to read private key file: %w", err)
}
@@ -842,7 +782,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
// If a public key has been specified then use that
if pubkeyFile != "" {
certfile, err := os.ReadFile(pubkeyFile)
certfile, err := ioutil.ReadFile(pubkeyFile)
if err != nil {
return nil, fmt.Errorf("unable to read cert file: %w", err)
}
@@ -975,24 +915,20 @@ func NewFsWithConnection(ctx context.Context, f *Fs, name string, root string, m
fs.Debugf(f, "Running shell type detection remote command: %s", shellCmd)
err = session.Run(shellCmd)
_ = session.Close()
f.shellType = defaultShellType
if err != nil {
f.shellType = defaultShellType
fs.Debugf(f, "Remote command failed: %v (stdout=%v) (stderr=%v)", err, bytes.TrimSpace(stdout.Bytes()), bytes.TrimSpace(stderr.Bytes()))
} else {
outBytes := stdout.Bytes()
fs.Debugf(f, "Remote command result: %s", outBytes)
outString := string(bytes.TrimSpace(stdout.Bytes()))
if outString != "" {
if strings.HasPrefix(outString, "Microsoft.PowerShell") { // PowerShell: "Microsoft.PowerShell%ComSpec%"
f.shellType = "powershell"
} else if !strings.HasSuffix(outString, "%ComSpec%") { // Command Prompt: "${ShellId}C:\WINDOWS\system32\cmd.exe"
// Additional positive test, to avoid misdetection on unpredicted Unix shell variants
s := strings.ToLower(outString)
if strings.Contains(s, ".exe") || strings.Contains(s, ".com") {
f.shellType = "cmd"
}
} // POSIX-based Unix shell: "%ComSpec%"
} // fish Unix shell: ""
if strings.HasPrefix(outString, "Microsoft.PowerShell") { // If PowerShell: "Microsoft.PowerShell%ComSpec%"
f.shellType = "powershell"
} else if !strings.HasSuffix(outString, "%ComSpec%") { // If Command Prompt: "${ShellId}C:\WINDOWS\system32\cmd.exe"
f.shellType = "cmd"
} else { // If Unix: "%ComSpec%"
f.shellType = "unix"
}
}
}
// Save permanently in config to avoid the extra work next time
+2 -1
View File
@@ -77,6 +77,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"path"
@@ -478,7 +479,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
if err != nil {
return nil, fmt.Errorf("failed to open timezone db: %w", err)
}
tzdata, err := io.ReadAll(timezone)
tzdata, err := ioutil.ReadAll(timezone)
if err != nil {
return nil, fmt.Errorf("failed to read timezone: %w", err)
}
+2 -1
View File
@@ -10,6 +10,7 @@ import (
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
pathpkg "path"
@@ -118,7 +119,7 @@ func (f *vfsgen۰CompressedFile) Read(p []byte) (n int, err error) {
}
if f.grPos < f.seekPos {
// Fast-forward.
_, err = io.CopyN(io.Discard, f.gr, f.seekPos-f.grPos)
_, err = io.CopyN(ioutil.Discard, f.gr, f.seekPos-f.grPos)
if err != nil {
return 0, err
}
+4
View File
@@ -103,6 +103,10 @@ func (f *Fs) getSessions() int32 {
// Open a new connection to the SMB server.
func (f *Fs) newConnection(ctx context.Context, share string) (c *conn, err error) {
// As we are pooling these connections we need to decouple
// them from the current context
ctx = context.Background()
c, err = f.dial(ctx, "tcp", f.opt.Host+":"+f.opt.Port)
if err != nil {
return nil, fmt.Errorf("couldn't connect SMB: %w", err)
+2 -2
View File
@@ -2,7 +2,7 @@ package sugarsync
import (
"bytes"
"io"
"io/ioutil"
"net/http"
"testing"
@@ -48,7 +48,7 @@ func TestErrorHandler(t *testing.T) {
} {
t.Run(test.name, func(t *testing.T) {
resp := http.Response{
Body: io.NopCloser(bytes.NewBufferString(test.body)),
Body: ioutil.NopCloser(bytes.NewBufferString(test.body)),
StatusCode: test.code,
Status: test.status,
}
+2 -1
View File
@@ -6,6 +6,7 @@ import (
"context"
"errors"
"io"
"io/ioutil"
"testing"
"github.com/ncw/swift/v2"
@@ -135,7 +136,7 @@ func (f *Fs) testWithChunkFail(t *testing.T) {
buf := bytes.NewBufferString(contents[:errPosition])
errMessage := "potato"
er := &readers.ErrorReader{Err: errors.New(errMessage)}
in := io.NopCloser(io.MultiReader(buf, er))
in := ioutil.NopCloser(io.MultiReader(buf, er))
file.Size = contentSize
obji := object.NewStaticObjectInfo(file.Path, file.ModTime, file.Size, true, nil, nil)
+2 -1
View File
@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"sync"
"time"
@@ -86,7 +87,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
errs[i] = fmt.Errorf("%s: %w", o.UpstreamFs().Name(), err)
if len(entries) > 1 {
// Drain the input buffer to allow other uploads to continue
_, _ = io.Copy(io.Discard, readers[i])
_, _ = io.Copy(ioutil.Discard, readers[i])
}
}
} else {
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"path"
"path/filepath"
"strings"
@@ -500,7 +501,7 @@ func (f *Fs) put(ctx context.Context, in io.Reader, src fs.ObjectInfo, stream bo
errs[i] = fmt.Errorf("%s: %w", u.Name(), err)
if len(upstreams) > 1 {
// Drain the input buffer to allow other uploads to continue
_, _ = io.Copy(io.Discard, readers[i])
_, _ = io.Copy(ioutil.Discard, readers[i])
}
return
}
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"path"
@@ -238,7 +239,7 @@ func NewFs(ctx context.Context, name string, root string, config configmap.Mappe
func (f *Fs) decodeError(resp *http.Response, response interface{}) (err error) {
defer fs.CheckClose(resp.Body, &err)
body, err := io.ReadAll(resp.Body)
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
+9 -6
View File
@@ -991,6 +991,7 @@ func (f *Fs) copyOrMove(ctx context.Context, src fs.Object, remote string, metho
}
return nil, fs.ErrorCantMove
}
srcFs := srcObj.fs
dstPath := f.filePath(remote)
err := f.mkParentDir(ctx, dstPath)
if err != nil {
@@ -1013,9 +1014,10 @@ func (f *Fs) copyOrMove(ctx context.Context, src fs.Object, remote string, metho
if f.useOCMtime {
opts.ExtraHeaders["X-OC-Mtime"] = fmt.Sprintf("%d", src.ModTime(ctx).Unix())
}
err = f.pacer.Call(func() (bool, error) {
resp, err = f.srv.Call(ctx, &opts)
return f.shouldRetry(ctx, resp, err)
// Direct the MOVE/COPY to the source server
err = srcFs.pacer.Call(func() (bool, error) {
resp, err = srcFs.srv.Call(ctx, &opts)
return srcFs.shouldRetry(ctx, resp, err)
})
if err != nil {
return nil, fmt.Errorf("Copy call failed: %w", err)
@@ -1109,9 +1111,10 @@ func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string
"Overwrite": "F",
},
}
err = f.pacer.Call(func() (bool, error) {
resp, err = f.srv.Call(ctx, &opts)
return f.shouldRetry(ctx, resp, err)
// Direct the MOVE/COPY to the source server
err = srcFs.pacer.Call(func() (bool, error) {
resp, err = srcFs.srv.Call(ctx, &opts)
return srcFs.shouldRetry(ctx, resp, err)
})
if err != nil {
return fmt.Errorf("DirMove MOVE call failed: %w", err)
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"path"
@@ -1218,7 +1219,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
if partialContent && resp.StatusCode == 200 {
if start > 0 {
// We need to read and discard the beginning of the data...
_, err = io.CopyN(io.Discard, resp.Body, start)
_, err = io.CopyN(ioutil.Discard, resp.Body, start)
if err != nil {
if resp != nil {
_ = resp.Body.Close()
+3 -2
View File
@@ -9,6 +9,7 @@ import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
@@ -239,7 +240,7 @@ func buildWindowsResourceSyso(goarch string, versionTag string) string {
log.Printf("Failed to resolve path: %v", err)
return ""
}
err = os.WriteFile(jsonPath, bs, 0644)
err = ioutil.WriteFile(jsonPath, bs, 0644)
if err != nil {
log.Printf("Failed to write %s: %v", jsonPath, err)
return ""
@@ -475,7 +476,7 @@ func main() {
run("mkdir", "build")
}
chdir("build")
err := os.WriteFile("version.txt", []byte(fmt.Sprintf("rclone %s\n", version)), 0666)
err := ioutil.WriteFile("version.txt", []byte(fmt.Sprintf("rclone %s\n", version)), 0666)
if err != nil {
log.Fatalf("Couldn't write version.txt: %v", err)
}
+2 -1
View File
@@ -16,6 +16,7 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"net/url"
@@ -167,7 +168,7 @@ func defaultBinDir() string {
// read the body or an error message
func readBody(in io.Reader) string {
data, err := io.ReadAll(in)
data, err := ioutil.ReadAll(in)
if err != nil {
return fmt.Sprintf("Error reading body: %v", err.Error())
}
+2 -1
View File
@@ -5,6 +5,7 @@ import (
"bytes"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
@@ -55,7 +56,7 @@ func main() {
log.Fatalf("Syntax: %s", os.Args[0])
}
// v1.54.0
versionBytes, err := os.ReadFile("VERSION")
versionBytes, err := ioutil.ReadFile("VERSION")
if err != nil {
log.Fatalf("Failed to read version: %v", err)
}
+3 -2
View File
@@ -5,6 +5,7 @@ package bilib
import (
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"regexp"
@@ -105,7 +106,7 @@ func CopyDir(src string, dst string) (err error) {
return
}
entries, err := os.ReadDir(src)
entries, err := ioutil.ReadDir(src)
if err != nil {
return
}
@@ -121,7 +122,7 @@ func CopyDir(src string, dst string) (err error) {
}
} else {
// Skip symlinks.
if entry.Type()&os.ModeSymlink != 0 {
if entry.Mode()&os.ModeSymlink != 0 {
continue
}
+2 -2
View File
@@ -2,7 +2,7 @@ package bilib
import (
"bytes"
"os"
"io/ioutil"
"sort"
"strconv"
)
@@ -57,5 +57,5 @@ func SaveList(list []string, path string) error {
_, _ = buf.WriteString(strconv.Quote(s))
_ = buf.WriteByte('\n')
}
return os.WriteFile(path, buf.Bytes(), PermSecure)
return ioutil.WriteFile(path, buf.Bytes(), PermSecure)
}
+7 -6
View File
@@ -10,6 +10,7 @@ import (
"errors"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"path"
@@ -302,7 +303,7 @@ func (b *bisyncTest) runTestCase(ctx context.Context, t *testing.T, testCase str
// Execute test scenario
scenFile := filepath.Join(b.testDir, "scenario.txt")
scenBuf, err := os.ReadFile(scenFile)
scenBuf, err := ioutil.ReadFile(scenFile)
scenReplacer := b.newReplacer(false)
require.NoError(b.t, err)
b.step = 0
@@ -902,8 +903,8 @@ func (b *bisyncTest) compareResults() int {
// save mangled logs so difference is easier on eyes
goldenFile := filepath.Join(b.logDir, "mangled.golden.log")
resultFile := filepath.Join(b.logDir, "mangled.result.log")
require.NoError(b.t, os.WriteFile(goldenFile, []byte(goldenText), bilib.PermSecure))
require.NoError(b.t, os.WriteFile(resultFile, []byte(resultText), bilib.PermSecure))
require.NoError(b.t, ioutil.WriteFile(goldenFile, []byte(goldenText), bilib.PermSecure))
require.NoError(b.t, ioutil.WriteFile(resultFile, []byte(resultText), bilib.PermSecure))
}
if goldenText == resultText {
@@ -973,7 +974,7 @@ func (b *bisyncTest) storeGolden() {
goldName := b.toGolden(fileName)
goldPath := filepath.Join(b.goldenDir, goldName)
err := os.WriteFile(goldPath, []byte(text), bilib.PermSecure)
err := ioutil.WriteFile(goldPath, []byte(text), bilib.PermSecure)
assert.NoError(b.t, err, "writing golden file %s", goldName)
if goldName != fileName {
@@ -985,7 +986,7 @@ func (b *bisyncTest) storeGolden() {
// mangleResult prepares test logs or listings for comparison
func (b *bisyncTest) mangleResult(dir, file string, golden bool) string {
buf, err := os.ReadFile(filepath.Join(dir, file))
buf, err := ioutil.ReadFile(filepath.Join(dir, file))
require.NoError(b.t, err)
text := string(buf)
@@ -1204,7 +1205,7 @@ func (b *bisyncTest) ensureDir(parent, dir string, optional bool) string {
}
func (b *bisyncTest) listDir(dir string) (names []string) {
files, err := os.ReadDir(dir)
files, err := ioutil.ReadDir(dir)
require.NoError(b.t, err)
for _, file := range files {
names = append(names, filepath.Base(file.Name()))
+3 -2
View File
@@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
@@ -197,7 +198,7 @@ func (opt *Options) applyFilters(ctx context.Context) (context.Context, error) {
_ = f.Close()
hashFile := filtersFile + ".md5"
wantHash, err := os.ReadFile(hashFile)
wantHash, err := ioutil.ReadFile(hashFile)
if err != nil && !opt.Resync {
return ctx, fmt.Errorf("filters file md5 hash not found (must run --resync): %s", filtersFile)
}
@@ -208,7 +209,7 @@ func (opt *Options) applyFilters(ctx context.Context) (context.Context, error) {
if opt.Resync {
fs.Infof(nil, "Storing filters file hash to %s", hashFile)
if err := os.WriteFile(hashFile, []byte(gotHash), bilib.PermSecure); err != nil {
if err := ioutil.WriteFile(hashFile, []byte(gotHash), bilib.PermSecure); err != nil {
return ctx, err
}
}
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"context"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
@@ -80,7 +81,7 @@ func Bisync(ctx context.Context, fs1, fs2 fs.Fs, optArg *Options) (err error) {
}
pidStr := []byte(strconv.Itoa(os.Getpid()))
if err = os.WriteFile(lockFile, pidStr, bilib.PermSecure); err != nil {
if err = ioutil.WriteFile(lockFile, pidStr, bilib.PermSecure); err != nil {
return fmt.Errorf("cannot create lock file: %s: %w", lockFile, err)
}
fs.Debugf(nil, "Lock file created: %s", lockFile)
+2 -1
View File
@@ -4,6 +4,7 @@ package cat
import (
"context"
"io"
"io/ioutil"
"log"
"os"
"strings"
@@ -76,7 +77,7 @@ Note that if offset is negative it will count from the end, so
fsrc := cmd.NewFsSrc(args)
var w io.Writer = os.Stdout
if discard {
w = io.Discard
w = ioutil.Discard
}
cmd.Run(false, false, command, func() error {
return operations.Cat(context.Background(), fsrc, w, offset, count)
+13 -12
View File
@@ -1,6 +1,7 @@
package genautocomplete
import (
"io/ioutil"
"os"
"testing"
@@ -8,7 +9,7 @@ import (
)
func TestCompletionBash(t *testing.T) {
tempFile, err := os.CreateTemp("", "completion_bash")
tempFile, err := ioutil.TempFile("", "completion_bash")
assert.NoError(t, err)
defer func() {
_ = tempFile.Close()
@@ -17,14 +18,14 @@ func TestCompletionBash(t *testing.T) {
bashCommandDefinition.Run(bashCommandDefinition, []string{tempFile.Name()})
bs, err := os.ReadFile(tempFile.Name())
bs, err := ioutil.ReadFile(tempFile.Name())
assert.NoError(t, err)
assert.NotEmpty(t, string(bs))
}
func TestCompletionBashStdout(t *testing.T) {
originalStdout := os.Stdout
tempFile, err := os.CreateTemp("", "completion_zsh")
tempFile, err := ioutil.TempFile("", "completion_zsh")
assert.NoError(t, err)
defer func() {
_ = tempFile.Close()
@@ -36,13 +37,13 @@ func TestCompletionBashStdout(t *testing.T) {
bashCommandDefinition.Run(bashCommandDefinition, []string{"-"})
output, err := os.ReadFile(tempFile.Name())
output, err := ioutil.ReadFile(tempFile.Name())
assert.NoError(t, err)
assert.NotEmpty(t, string(output))
}
func TestCompletionZsh(t *testing.T) {
tempFile, err := os.CreateTemp("", "completion_zsh")
tempFile, err := ioutil.TempFile("", "completion_zsh")
assert.NoError(t, err)
defer func() {
_ = tempFile.Close()
@@ -51,14 +52,14 @@ func TestCompletionZsh(t *testing.T) {
zshCommandDefinition.Run(zshCommandDefinition, []string{tempFile.Name()})
bs, err := os.ReadFile(tempFile.Name())
bs, err := ioutil.ReadFile(tempFile.Name())
assert.NoError(t, err)
assert.NotEmpty(t, string(bs))
}
func TestCompletionZshStdout(t *testing.T) {
originalStdout := os.Stdout
tempFile, err := os.CreateTemp("", "completion_zsh")
tempFile, err := ioutil.TempFile("", "completion_zsh")
assert.NoError(t, err)
defer func() {
_ = tempFile.Close()
@@ -69,13 +70,13 @@ func TestCompletionZshStdout(t *testing.T) {
defer func() { os.Stdout = originalStdout }()
zshCommandDefinition.Run(zshCommandDefinition, []string{"-"})
output, err := os.ReadFile(tempFile.Name())
output, err := ioutil.ReadFile(tempFile.Name())
assert.NoError(t, err)
assert.NotEmpty(t, string(output))
}
func TestCompletionFish(t *testing.T) {
tempFile, err := os.CreateTemp("", "completion_fish")
tempFile, err := ioutil.TempFile("", "completion_fish")
assert.NoError(t, err)
defer func() {
_ = tempFile.Close()
@@ -84,14 +85,14 @@ func TestCompletionFish(t *testing.T) {
fishCommandDefinition.Run(fishCommandDefinition, []string{tempFile.Name()})
bs, err := os.ReadFile(tempFile.Name())
bs, err := ioutil.ReadFile(tempFile.Name())
assert.NoError(t, err)
assert.NotEmpty(t, string(bs))
}
func TestCompletionFishStdout(t *testing.T) {
originalStdout := os.Stdout
tempFile, err := os.CreateTemp("", "completion_zsh")
tempFile, err := ioutil.TempFile("", "completion_zsh")
assert.NoError(t, err)
defer func() {
_ = tempFile.Close()
@@ -103,7 +104,7 @@ func TestCompletionFishStdout(t *testing.T) {
fishCommandDefinition.Run(fishCommandDefinition, []string{"-"})
output, err := os.ReadFile(tempFile.Name())
output, err := ioutil.ReadFile(tempFile.Name())
assert.NoError(t, err)
assert.NotEmpty(t, string(output))
}
+4 -3
View File
@@ -3,6 +3,7 @@ package gendocs
import (
"bytes"
"io/ioutil"
"log"
"os"
"path"
@@ -70,7 +71,7 @@ rclone.org website.`,
if err != nil {
return err
}
err = os.WriteFile(filepath.Join(root, "flags.md"), buf.Bytes(), 0777)
err = ioutil.WriteFile(filepath.Join(root, "flags.md"), buf.Bytes(), 0777)
if err != nil {
return err
}
@@ -128,7 +129,7 @@ rclone.org website.`,
return err
}
if !info.IsDir() {
b, err := os.ReadFile(path)
b, err := ioutil.ReadFile(path)
if err != nil {
return err
}
@@ -139,7 +140,7 @@ See the [global flags page](/flags/) for global options not listed here.
### SEE ALSO`, 1)
// outdent all the titles by one
doc = outdentTitle.ReplaceAllString(doc, `$1`)
err = os.WriteFile(path, []byte(doc), 0777)
err = ioutil.WriteFile(path, []byte(doc), 0777)
if err != nil {
return err
}
+3 -2
View File
@@ -8,6 +8,7 @@ import (
"bytes"
"flag"
"io"
"io/ioutil"
"log"
"math/rand"
"os"
@@ -59,11 +60,11 @@ func randomSeekTest(size int64, in1, in2 *os.File, file1, file2 string) {
if !bytes.Equal(buf1, buf2) {
log.Printf("Dumping different blocks")
err = os.WriteFile("/tmp/z1", buf1, 0777)
err = ioutil.WriteFile("/tmp/z1", buf1, 0777)
if err != nil {
log.Fatalf("Failed to write /tmp/z1: %v", err)
}
err = os.WriteFile("/tmp/z2", buf2, 0777)
err = ioutil.WriteFile("/tmp/z2", buf2, 0777)
if err != nil {
log.Fatalf("Failed to write /tmp/z2: %v", err)
}
+2 -1
View File
@@ -2,6 +2,7 @@ package mountlib_test
import (
"context"
"io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -35,7 +36,7 @@ func TestRc(t *testing.T) {
assert.NotNil(t, getMountTypes)
localDir := t.TempDir()
err := os.WriteFile(filepath.Join(localDir, "file.txt"), []byte("hello"), 0666)
err := ioutil.WriteFile(filepath.Join(localDir, "file.txt"), []byte("hello"), 0666)
require.NoError(t, err)
mountPoint := t.TempDir()
+11 -48
View File
@@ -89,12 +89,11 @@ func helpText() (tr []string) {
" ↑,↓ or k,j to Move",
" →,l to enter",
" ←,h to return",
" g toggle graph",
" c toggle counts",
" g toggle graph",
" a toggle average size in directory",
" m toggle modified time",
" u toggle human-readable format",
" n,s,C,A,M sort by name,size,count,asize,mtime",
" n,s,C,A sort by name,size,count,average size",
" d delete file/directory",
" v select file/directory",
" V enter visual select mode",
@@ -132,14 +131,12 @@ type UI struct {
showGraph bool // toggle showing graph
showCounts bool // toggle showing counts
showDirAverageSize bool // toggle average size
showModTime bool // toggle showing timestamps
humanReadable bool // toggle human-readable format
visualSelectMode bool // toggle visual selection mode
sortByName int8 // +1 for normal (lexical), 0 for off, -1 for reverse
sortBySize int8 // +1 for normal (largest first), 0 for off, -1 for reverse (smallest first)
sortByName int8 // +1 for normal, 0 for off, -1 for reverse
sortBySize int8
sortByCount int8
sortByAverageSize int8
sortByModTime int8 // +1 for normal (newest first), 0 for off, -1 for reverse (oldest first)
dirPosMap map[string]dirPos // store for directory positions
selectedEntries map[string]dirPos // selected entries of current directory
}
@@ -335,7 +332,6 @@ func (u *UI) hasEmptyDir() bool {
// Draw the current screen
func (u *UI) Draw() error {
ctx := context.Background()
w, h := termbox.Size()
u.dirListHeight = h - 3
@@ -369,13 +365,7 @@ func (u *UI) Draw() error {
if y >= h-1 {
break
}
var attrs scan.Attrs
var err error
if u.showModTime {
attrs, err = u.d.AttrWithModTimeI(ctx, u.sortPerm[n])
} else {
attrs, err = u.d.AttrI(u.sortPerm[n])
}
attrs, err := u.d.AttrI(u.sortPerm[n])
_, isSelected := u.selectedEntries[entry.String()]
fg := termbox.ColorWhite
if attrs.EntriesHaveErrors {
@@ -431,9 +421,6 @@ func (u *UI) Draw() error {
extras += strings.Repeat(" ", len(ss))
}
}
if u.showModTime {
extras += attrs.ModTime.Local().Format("2006-01-02 15:04:05") + " "
}
if showEmptyDir {
if attrs.IsDir && attrs.Count == 0 && fileFlag == ' ' {
fileFlag = 'e'
@@ -669,15 +656,8 @@ type ncduSort struct {
// Less is part of sort.Interface.
func (ds *ncduSort) Less(i, j int) bool {
var iAvgSize, jAvgSize float64
var iattrs, jattrs scan.Attrs
if ds.u.sortByModTime != 0 {
ctx := context.Background()
iattrs, _ = ds.d.AttrWithModTimeI(ctx, ds.sortPerm[i])
jattrs, _ = ds.d.AttrWithModTimeI(ctx, ds.sortPerm[j])
} else {
iattrs, _ = ds.d.AttrI(ds.sortPerm[i])
jattrs, _ = ds.d.AttrI(ds.sortPerm[j])
}
iattrs, _ := ds.d.AttrI(ds.sortPerm[i])
jattrs, _ := ds.d.AttrI(ds.sortPerm[j])
iname, jname := ds.entries[ds.sortPerm[i]].Remote(), ds.entries[ds.sortPerm[j]].Remote()
if iattrs.Count > 0 {
iAvgSize = iattrs.AverageSize()
@@ -699,14 +679,6 @@ func (ds *ncduSort) Less(i, j int) bool {
if iattrs.Size != jattrs.Size {
return iattrs.Size > jattrs.Size
}
case ds.u.sortByModTime < 0:
if iattrs.ModTime != jattrs.ModTime {
return iattrs.ModTime.Before(jattrs.ModTime)
}
case ds.u.sortByModTime > 0:
if iattrs.ModTime != jattrs.ModTime {
return iattrs.ModTime.After(jattrs.ModTime)
}
case ds.u.sortByCount < 0:
if iattrs.Count != jattrs.Count {
return iattrs.Count < jattrs.Count
@@ -720,17 +692,13 @@ func (ds *ncduSort) Less(i, j int) bool {
return iAvgSize < jAvgSize
}
// if avgSize is equal, sort by size
if iattrs.Size != jattrs.Size {
return iattrs.Size < jattrs.Size
}
return iattrs.Size < jattrs.Size
case ds.u.sortByAverageSize > 0:
if iAvgSize != jAvgSize {
return iAvgSize > jAvgSize
}
// if avgSize is equal, sort by size
if iattrs.Size != jattrs.Size {
return iattrs.Size > jattrs.Size
}
return iattrs.Size > jattrs.Size
}
// if everything equal, sort by name
return iname < jname
@@ -875,9 +843,8 @@ func NewUI(f fs.Fs) *UI {
showCounts: false,
showDirAverageSize: false,
humanReadable: true,
sortByName: 0,
sortBySize: 1, // Sort by largest first
sortByModTime: 0,
sortByName: 0, // +1 for normal, 0 for off, -1 for reverse
sortBySize: 1,
sortByCount: 0,
dirPosMap: make(map[string]dirPos),
selectedEntries: make(map[string]dirPos),
@@ -966,8 +933,6 @@ outer:
u.enter()
case 'c':
u.showCounts = !u.showCounts
case 'm':
u.showModTime = !u.showModTime
case 'g':
u.showGraph = !u.showGraph
case 'a':
@@ -976,8 +941,6 @@ outer:
u.toggleSort(&u.sortByName)
case 's':
u.toggleSort(&u.sortBySize)
case 'M':
u.toggleSort(&u.sortByModTime)
case 'v':
u.toggleSelectForCursor()
case 'V':
+9 -24
View File
@@ -6,7 +6,6 @@ import (
"fmt"
"path"
"sync"
"time"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/fs/walk"
@@ -32,7 +31,6 @@ type Dir struct {
// in the total count. They are not included in the size, i.e. treated
// as empty files, which means the size may be underestimated.
type Attrs struct {
ModTime time.Time
Size int64
Count int64
CountUnknownSize int64
@@ -195,33 +193,20 @@ func (d *Dir) Attr() (size int64, count int64) {
return d.size, d.count
}
// attrI returns the size, count and flags for the i-th directory entry
func (d *Dir) attrI(i int) (attrs Attrs, err error) {
subDir, isDir := d.getDir(i)
if !isDir {
return Attrs{time.Time{}, d.entries[i].Size(), 0, 0, false, true, d.entriesHaveErrors}, d.readError
}
if subDir == nil {
return Attrs{time.Time{}, 0, 0, 0, true, false, false}, nil
}
size, count := subDir.Attr()
return Attrs{time.Time{}, size, count, subDir.countUnknownSize, true, true, subDir.entriesHaveErrors}, subDir.readError
}
// AttrI returns the size, count and flags for the i-th directory entry
func (d *Dir) AttrI(i int) (attrs Attrs, err error) {
d.mu.Lock()
defer d.mu.Unlock()
return d.attrI(i)
}
subDir, isDir := d.getDir(i)
// AttrWithModTimeI returns the modtime, size, count and flags for the i-th directory entry
func (d *Dir) AttrWithModTimeI(ctx context.Context, i int) (attrs Attrs, err error) {
d.mu.Lock()
defer d.mu.Unlock()
attrs, err = d.attrI(i)
attrs.ModTime = d.entries[i].ModTime(ctx)
return
if !isDir {
return Attrs{d.entries[i].Size(), 0, 0, false, true, d.entriesHaveErrors}, d.readError
}
if subDir == nil {
return Attrs{0, 0, 0, true, false, false}, nil
}
size, count := subDir.Attr()
return Attrs{size, count, subDir.countUnknownSize, true, true, subDir.entriesHaveErrors}, subDir.readError
}
// Scan the Fs passed in, returning a root directory channel and an
+2 -2
View File
@@ -7,7 +7,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"strings"
@@ -204,7 +204,7 @@ func doCall(ctx context.Context, path string, in rc.Params) (out rc.Params, err
if resp.StatusCode != http.StatusOK {
var body []byte
body, err = io.ReadAll(resp.Body)
body, err = ioutil.ReadAll(resp.Body)
var bodyString string
if err == nil {
bodyString = string(body)
+1 -1
View File
@@ -66,7 +66,7 @@ a lot of data, you're better off caching locally and then
fdst, dstFileName := cmd.NewFsDstFile(args)
cmd.Run(false, false, command, func() error {
_, err := operations.RcatSize(context.Background(), fdst, dstFileName, os.Stdin, size, time.Now(), nil)
_, err := operations.RcatSize(context.Background(), fdst, dstFileName, os.Stdin, size, time.Now())
return err
})
},
+4 -3
View File
@@ -14,6 +14,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
@@ -226,7 +227,7 @@ func InstallUpdate(ctx context.Context, opt *Options) error {
}
func installPackage(ctx context.Context, beta bool, version, siteURL, packageFormat string) error {
tempFile, err := os.CreateTemp("", "rclone.*."+packageFormat)
tempFile, err := ioutil.TempFile("", "rclone.*."+packageFormat)
if err != nil {
return fmt.Errorf("unable to write temporary package: %w", err)
}
@@ -356,7 +357,7 @@ func downloadUpdate(ctx context.Context, beta bool, version, siteURL, newFile, p
}
if packageFormat == "deb" || packageFormat == "rpm" {
if err := os.WriteFile(newFile, archiveBuf, 0644); err != nil {
if err := ioutil.WriteFile(newFile, archiveBuf, 0644); err != nil {
return fmt.Errorf("cannot write temporary .%s: %w", packageFormat, err)
}
return nil
@@ -470,5 +471,5 @@ func downloadFile(ctx context.Context, url string) ([]byte, error) {
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("failed with %s downloading %s", resp.Status, url)
}
return io.ReadAll(resp.Body)
return ioutil.ReadAll(resp.Body)
}
+6 -5
View File
@@ -5,6 +5,7 @@ package selfupdate
import (
"context"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -85,7 +86,7 @@ func TestInstallOnLinux(t *testing.T) {
assert.NoError(t, InstallUpdate(ctx, &Options{Beta: true, Output: path, Version: fs.Version}))
// Must fail on non-writable file
assert.NoError(t, os.WriteFile(path, []byte("test"), 0644))
assert.NoError(t, ioutil.WriteFile(path, []byte("test"), 0644))
assert.NoError(t, os.Chmod(path, 0000))
err = (InstallUpdate(ctx, &Options{Beta: true, Output: path}))
assert.Error(t, err)
@@ -100,7 +101,7 @@ func TestInstallOnLinux(t *testing.T) {
assert.Equal(t, os.FileMode(0644), info.Mode().Perm())
// Must remove temporary files
files, err := os.ReadDir(testDir)
files, err := ioutil.ReadDir(testDir)
assert.NoError(t, err)
assert.Equal(t, 1, len(files))
@@ -140,7 +141,7 @@ func TestRenameOnWindows(t *testing.T) {
// Must not create temporary files when target doesn't exist
assert.NoError(t, InstallUpdate(ctx, &Options{Beta: true, Output: path}))
files, err := os.ReadDir(testDir)
files, err := ioutil.ReadDir(testDir)
assert.NoError(t, err)
assert.Equal(t, 1, len(files))
@@ -151,7 +152,7 @@ func TestRenameOnWindows(t *testing.T) {
assert.NoError(t, cmdWait.Start())
assert.NoError(t, InstallUpdate(ctx, &Options{Beta: false, Output: path}))
files, err = os.ReadDir(testDir)
files, err = ioutil.ReadDir(testDir)
assert.NoError(t, err)
assert.Equal(t, 2, len(files))
@@ -188,7 +189,7 @@ func TestRenameOnWindows(t *testing.T) {
// Updating when the "old" executable is running must produce a random "old" file
assert.NoError(t, InstallUpdate(ctx, &Options{Beta: true, Output: path}))
files, err = os.ReadDir(testDir)
files, err = ioutil.ReadDir(testDir)
assert.NoError(t, err)
assert.Equal(t, 3, len(files))
+2 -1
View File
@@ -9,6 +9,7 @@ import (
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
pathpkg "path"
@@ -151,7 +152,7 @@ func (f *vfsgen۰CompressedFile) Read(p []byte) (n int, err error) {
}
if f.grPos < f.seekPos {
// Fast-forward.
_, err = io.CopyN(io.Discard, f.gr, f.seekPos-f.grPos)
_, err = io.CopyN(ioutil.Discard, f.gr, f.seekPos-f.grPos)
if err != nil {
return 0, err
}
+2 -2
View File
@@ -6,7 +6,7 @@ package data
import (
"fmt"
"io"
"io/ioutil"
"text/template"
"github.com/rclone/rclone/fs"
@@ -21,7 +21,7 @@ func GetTemplate() (tpl *template.Template, err error) {
defer fs.CheckClose(templateFile, &err)
templateBytes, err := io.ReadAll(templateFile)
templateBytes, err := ioutil.ReadAll(templateFile)
if err != nil {
return nil, fmt.Errorf("get template read: %w", err)
}
+8 -8
View File
@@ -5,7 +5,7 @@ import (
"context"
"fmt"
"html"
"io"
"io/ioutil"
"net/http"
"os"
"strings"
@@ -60,7 +60,7 @@ func TestRootSCPD(t *testing.T) {
resp, err := http.DefaultClient.Do(req)
require.NoError(t, err)
assert.Equal(t, http.StatusOK, resp.StatusCode)
body, err := io.ReadAll(resp.Body)
body, err := ioutil.ReadAll(resp.Body)
require.NoError(t, err)
// Make sure that the SCPD contains a CDS service.
require.Contains(t, string(body),
@@ -80,7 +80,7 @@ func TestServeContent(t *testing.T) {
require.NoError(t, err)
defer fs.CheckClose(resp.Body, &err)
assert.Equal(t, http.StatusOK, resp.StatusCode)
actualContents, err := io.ReadAll(resp.Body)
actualContents, err := ioutil.ReadAll(resp.Body)
assert.NoError(t, err)
// Now compare the contents with the golden file.
@@ -90,7 +90,7 @@ func TestServeContent(t *testing.T) {
goldenReader, err := goldenFile.Open(os.O_RDONLY)
assert.NoError(t, err)
defer fs.CheckClose(goldenReader, &err)
goldenContents, err := io.ReadAll(goldenReader)
goldenContents, err := ioutil.ReadAll(goldenReader)
assert.NoError(t, err)
require.Equal(t, goldenContents, actualContents)
@@ -119,7 +119,7 @@ func TestContentDirectoryBrowseMetadata(t *testing.T) {
resp, err := http.DefaultClient.Do(req)
require.NoError(t, err)
assert.Equal(t, http.StatusOK, resp.StatusCode)
body, err := io.ReadAll(resp.Body)
body, err := ioutil.ReadAll(resp.Body)
require.NoError(t, err)
// should contain an appropriate URN
require.Contains(t, string(body), "urn:schemas-upnp-org:service:ContentDirectory:1")
@@ -145,7 +145,7 @@ func TestMediaReceiverRegistrarService(t *testing.T) {
resp, err := http.DefaultClient.Do(req)
require.NoError(t, err)
assert.Equal(t, http.StatusOK, resp.StatusCode)
body, err := io.ReadAll(resp.Body)
body, err := ioutil.ReadAll(resp.Body)
require.NoError(t, err)
require.Contains(t, string(body), "<RegistrationRespMsg>")
}
@@ -173,7 +173,7 @@ func TestContentDirectoryBrowseDirectChildren(t *testing.T) {
resp, err := http.DefaultClient.Do(req)
require.NoError(t, err)
assert.Equal(t, http.StatusOK, resp.StatusCode)
body, err := io.ReadAll(resp.Body)
body, err := ioutil.ReadAll(resp.Body)
require.NoError(t, err)
// expect video.mp4, video.srt, video.en.srt URLs to be in the DIDL
require.Contains(t, string(body), "/r/video.mp4")
@@ -201,7 +201,7 @@ func TestContentDirectoryBrowseDirectChildren(t *testing.T) {
resp, err = http.DefaultClient.Do(req)
require.NoError(t, err)
assert.Equal(t, http.StatusOK, resp.StatusCode)
body, err = io.ReadAll(resp.Body)
body, err = ioutil.ReadAll(resp.Body)
require.NoError(t, err)
// expect video.mp4, video.srt, URLs to be in the DIDL
require.Contains(t, string(body), "/r/subdir/video.mp4")
+4 -4
View File
@@ -8,7 +8,7 @@ import (
"context"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"os"
@@ -280,7 +280,7 @@ func (a *APIClient) request(path string, in, out interface{}, wantErr bool) {
}
assert.Equal(t, wantStatus, res.StatusCode)
dataOut, err = io.ReadAll(res.Body)
dataOut, err = ioutil.ReadAll(res.Body)
require.NoError(t, err)
err = res.Body.Close()
require.NoError(t, err)
@@ -389,11 +389,11 @@ func testMountAPI(t *testing.T, sockAddr string) {
assert.Contains(t, res, "volume is in use")
text := []byte("banana")
err = os.WriteFile(filepath.Join(mount1, "txt"), text, 0644)
err = ioutil.WriteFile(filepath.Join(mount1, "txt"), text, 0644)
assert.NoError(t, err)
time.Sleep(tempDelay)
text2, err := os.ReadFile(filepath.Join(path1, "txt"))
text2, err := ioutil.ReadFile(filepath.Join(path1, "txt"))
assert.NoError(t, err)
if runtime.GOOS != "windows" {
// this check sometimes fails on windows - ignore
+3 -2
View File
@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
@@ -328,7 +329,7 @@ func (drv *Driver) saveState() error {
ctx := context.Background()
retries := fs.GetConfig(ctx).LowLevelRetries
for i := 0; i <= retries; i++ {
err = os.WriteFile(drv.statePath, data, 0600)
err = ioutil.WriteFile(drv.statePath, data, 0600)
if err == nil {
return nil
}
@@ -341,7 +342,7 @@ func (drv *Driver) saveState() error {
func (drv *Driver) restoreState(ctx context.Context) error {
fs.Debugf(nil, "Restore state from %s", drv.statePath)
data, err := os.ReadFile(drv.statePath)
data, err := ioutil.ReadFile(drv.statePath)
if os.IsNotExist(err) {
return nil
}
+2 -1
View File
@@ -4,6 +4,7 @@ import (
"context"
"crypto/tls"
"fmt"
"io/ioutil"
"net"
"net/http"
"os"
@@ -92,7 +93,7 @@ func writeSpecFile(addr, proto, specDir string) (string, error) {
}
specFile := filepath.Join(specDir, "rclone.spec")
url := fmt.Sprintf("%s://%s", proto, addr)
if err := os.WriteFile(specFile, []byte(url), 0644); err != nil {
if err := ioutil.WriteFile(specFile, []byte(url), 0644); err != nil {
return "", err
}
fs.Debugf(nil, "Plugin spec has been written to %s", specFile)
+2 -1
View File
@@ -10,6 +10,7 @@ import (
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
pathpkg "path"
@@ -111,7 +112,7 @@ func (f *vfsgen۰CompressedFile) Read(p []byte) (n int, err error) {
}
if f.grPos < f.seekPos {
// Fast-forward.
_, err = io.CopyN(io.Discard, f.gr, f.seekPos-f.grPos)
_, err = io.CopyN(ioutil.Discard, f.gr, f.seekPos-f.grPos)
if err != nil {
return 0, err
}
+3 -4
View File
@@ -7,8 +7,7 @@ package data
import (
"fmt"
"html/template"
"io"
"os"
"io/ioutil"
"time"
"github.com/spf13/pflag"
@@ -71,7 +70,7 @@ func GetTemplate(tmpl string) (tpl *template.Template, err error) {
defer fs.CheckClose(templateFile, &err)
templateBytes, err := io.ReadAll(templateFile)
templateBytes, err := ioutil.ReadAll(templateFile)
if err != nil {
return nil, fmt.Errorf("get template read: %w", err)
}
@@ -79,7 +78,7 @@ func GetTemplate(tmpl string) (tpl *template.Template, err error) {
templateString = string(templateBytes)
} else {
templateFile, err := os.ReadFile(tmpl)
templateFile, err := ioutil.ReadFile(tmpl)
if err != nil {
return nil, fmt.Errorf("get template open: %w", err)
}
+4 -5
View File
@@ -3,9 +3,8 @@ package http
import (
"context"
"flag"
"io"
"io/ioutil"
"net/http"
"os"
"strings"
"testing"
"time"
@@ -92,10 +91,10 @@ func TestInit(t *testing.T) {
func checkGolden(t *testing.T, fileName string, got []byte) {
if *updateGolden {
t.Logf("Updating golden file %q", fileName)
err := os.WriteFile(fileName, got, 0666)
err := ioutil.WriteFile(fileName, got, 0666)
require.NoError(t, err)
} else {
want, err := os.ReadFile(fileName)
want, err := ioutil.ReadFile(fileName)
require.NoError(t, err)
wants := strings.Split(string(want), "\n")
gots := strings.Split(string(got), "\n")
@@ -211,7 +210,7 @@ func TestGET(t *testing.T) {
resp, err := http.DefaultClient.Do(req)
require.NoError(t, err)
assert.Equal(t, test.Status, resp.StatusCode, test.Golden)
body, err := io.ReadAll(resp.Body)
body, err := ioutil.ReadAll(resp.Body)
require.NoError(t, err)
// Check we got a Last-Modified header and that it is a valid date
+2 -2
View File
@@ -10,10 +10,10 @@ import (
"encoding/base64"
"fmt"
"html/template"
"io/ioutil"
"log"
"net"
"net/http"
"os"
"strings"
"time"
@@ -315,7 +315,7 @@ func NewServer(handler http.Handler, opt *Options) *Server {
log.Fatalf("Can't use --client-ca without --cert and --key")
}
certpool := x509.NewCertPool()
pem, err := os.ReadFile(s.Opt.ClientCA)
pem, err := ioutil.ReadFile(s.Opt.ClientCA)
if err != nil {
log.Fatalf("Failed to read client certificate authority: %v", err)
}
+1 -1
View File
@@ -295,7 +295,7 @@ func (s *Server) postObject(w http.ResponseWriter, r *http.Request, remote strin
}
}
o, err := operations.RcatSize(r.Context(), s.f, remote, r.Body, r.ContentLength, time.Now(), nil)
o, err := operations.RcatSize(r.Context(), s.f, remote, r.Body, r.ContentLength, time.Now())
if err != nil {
err = accounting.Stats(r.Context()).Error(err)
fs.Errorf(remote, "Post request rcat error: %v", err)
+6 -5
View File
@@ -17,6 +17,7 @@ import (
"encoding/pem"
"errors"
"fmt"
"io/ioutil"
"net"
"os"
"path/filepath"
@@ -310,7 +311,7 @@ func (s *server) Close() {
}
func loadPrivateKey(keyPath string) (ssh.Signer, error) {
privateBytes, err := os.ReadFile(keyPath)
privateBytes, err := ioutil.ReadFile(keyPath)
if err != nil {
return nil, fmt.Errorf("failed to load private key: %w", err)
}
@@ -325,7 +326,7 @@ func loadPrivateKey(keyPath string) (ssh.Signer, error) {
// the public key of a received connection
// with the entries in the authorized_keys file.
func loadAuthorizedKeys(authorizedKeysPath string) (authorizedKeysMap map[string]struct{}, err error) {
authorizedKeysBytes, err := os.ReadFile(authorizedKeysPath)
authorizedKeysBytes, err := ioutil.ReadFile(authorizedKeysPath)
if err != nil {
return nil, fmt.Errorf("failed to load authorized keys: %w", err)
}
@@ -368,7 +369,7 @@ func makeRSASSHKeyPair(bits int, pubKeyPath, privateKeyPath string) (err error)
if err != nil {
return err
}
return os.WriteFile(pubKeyPath, ssh.MarshalAuthorizedKey(pub), 0644)
return ioutil.WriteFile(pubKeyPath, ssh.MarshalAuthorizedKey(pub), 0644)
}
// makeECDSASSHKeyPair make a pair of public and private keys for ECDSA SSH access.
@@ -400,7 +401,7 @@ func makeECDSASSHKeyPair(pubKeyPath, privateKeyPath string) (err error) {
if err != nil {
return err
}
return os.WriteFile(pubKeyPath, ssh.MarshalAuthorizedKey(pub), 0644)
return ioutil.WriteFile(pubKeyPath, ssh.MarshalAuthorizedKey(pub), 0644)
}
// makeEd25519SSHKeyPair make a pair of public and private keys for Ed25519 SSH access.
@@ -432,5 +433,5 @@ func makeEd25519SSHKeyPair(pubKeyPath, privateKeyPath string) (err error) {
if err != nil {
return err
}
return os.WriteFile(pubKeyPath, ssh.MarshalAuthorizedKey(pub), 0644)
return ioutil.WriteFile(pubKeyPath, ssh.MarshalAuthorizedKey(pub), 0644)
}
+4 -4
View File
@@ -11,7 +11,7 @@ package webdav
import (
"context"
"flag"
"io"
"io/ioutil"
"net/http"
"os"
"strings"
@@ -134,10 +134,10 @@ func TestHTTPFunction(t *testing.T) {
func checkGolden(t *testing.T, fileName string, got []byte) {
if *updateGolden {
t.Logf("Updating golden file %q", fileName)
err := os.WriteFile(fileName, got, 0666)
err := ioutil.WriteFile(fileName, got, 0666)
require.NoError(t, err)
} else {
want, err := os.ReadFile(fileName)
want, err := ioutil.ReadFile(fileName)
require.NoError(t, err, "problem")
wants := strings.Split(string(want), "\n")
gots := strings.Split(string(got), "\n")
@@ -253,7 +253,7 @@ func HelpTestGET(t *testing.T, testURL string) {
resp, err := http.DefaultClient.Do(req)
require.NoError(t, err)
assert.Equal(t, test.Status, resp.StatusCode, test.Golden)
body, err := io.ReadAll(resp.Body)
body, err := ioutil.ReadAll(resp.Body)
require.NoError(t, err)
checkGolden(t, test.Golden, body)
+2 -2
View File
@@ -1,5 +1,5 @@
//go:build darwin || freebsd || netbsd || dragonfly || openbsd
// +build darwin freebsd netbsd dragonfly openbsd
//go:build darwin
// +build darwin
package cmd
+2 -2
View File
@@ -1,5 +1,5 @@
//go:build !darwin && !freebsd && !netbsd && !dragonfly && !openbsd
// +build !darwin,!freebsd,!netbsd,!dragonfly,!openbsd
//go:build !darwin
// +build !darwin
package cmd
+2 -2
View File
@@ -4,7 +4,7 @@ package version
import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"strings"
"time"
@@ -95,7 +95,7 @@ func GetVersion(url string) (v *semver.Version, vs string, date time.Time, err e
if resp.StatusCode != http.StatusOK {
return v, vs, date, errors.New(resp.Status)
}
bodyBytes, err := io.ReadAll(resp.Body)
bodyBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
return v, vs, date, err
}
+2 -1
View File
@@ -1,6 +1,7 @@
package version
import (
"io/ioutil"
"os"
"runtime"
"testing"
@@ -12,7 +13,7 @@ import (
func TestVersionWorksWithoutAccessibleConfigFile(t *testing.T) {
// create temp config file
tempFile, err := os.CreateTemp("", "unreadable_config.conf")
tempFile, err := ioutil.TempFile("", "unreadable_config.conf")
assert.NoError(t, err)
path := tempFile.Name()
defer func() {
+2 -1
View File
@@ -6,6 +6,7 @@
package cmdtest
import (
"io/ioutil"
"log"
"os"
"os/exec"
@@ -120,7 +121,7 @@ func removeTestEnvironment(t *testing.T) {
// createTestFile creates the file testFolder/name
func createTestFile(name string, t *testing.T) string {
err := os.WriteFile(testFolder+"/"+name, []byte("content_of_"+name), 0666)
err := ioutil.WriteFile(testFolder+"/"+name, []byte("content_of_"+name), 0666)
require.NoError(t, err)
return testFolder + "/" + name
}
-13
View File
@@ -650,16 +650,3 @@ put them back in again.` >}}
* Manoj Ghosh <manoj.ghosh@oracle.com>
* Tom Mombourquette <tom@devnode.com>
* Robert Newson <rnewson@apache.org>
* Samuel Johnson <esamueljohnson@gmail.com>
* coultonluke <luke@luke.org.uk>
* Anthony Pessy <anthony@cogniteev.com>
* Philip Harvey <pharvey@battelleecology.org>
* dgouju <dgouju@users.noreply.github.com>
* Clément Notin <clement.notin@gmail.com>
* x3-apptech <66947598+x3-apptech@users.noreply.github.com>
* Arnie97 <arnie97@gmail.com>
* Roel Arents <2691308+roelarents@users.noreply.github.com>
* Aaron Gokaslan <aaronGokaslan@gmail.com>
* techknowlogick <matti@mdranta.net>
* rkettelerij <richard@mindloops.nl>
* Kamui <fin-kamui@pm.me>
+3 -17
View File
@@ -164,7 +164,7 @@ Here are the Standard options specific to azureblob (Microsoft Azure Blob Storag
Storage Account Name.
Leave blank to use SAS URL.
Leave blank to use SAS URL or Emulator.
Properties:
@@ -198,7 +198,7 @@ Properties:
Storage Account Key.
Leave blank to use SAS URL.
Leave blank to use SAS URL or Emulator.
Properties:
@@ -246,8 +246,6 @@ Uses local storage emulator if provided as 'true'.
Leave blank if using real azure storage endpoint.
Provide `account`, `key`, and `endpoint` if desired to override their _azurite_ defaults.
Properties:
- Config: use_emulator
@@ -514,18 +512,6 @@ Properties:
{{< rem autogenerated options stop >}}
### Custom upload headers
You can set custom upload headers with the `--header-upload` flag.
- Cache-Control
- Content-Disposition
- Content-Encoding
- Content-Language
- Content-Type
Eg `--header-upload "Content-Type: text/potato"`
## Limitations
MD5 sums are only uploaded with chunked files if the source has an MD5
@@ -542,6 +528,6 @@ See [List of backends that do not support rclone about](https://rclone.org/overv
You can run rclone with storage emulator (usually _azurite_).
To do this, just set up a new remote with `rclone config` following instructions described in introduction and set `use_emulator` config as `true`. You do not need to provide default account name neither an account key. But you can override them in the _account_ and _key_ options. (Prior to v1.61 they were hard coded to _azurite_'s `devstoreaccount1`.)
To do this, just set up a new remote with `rclone config` following instructions described in introduction and set `use_emulator` config as `true`. You do not need to provide default account name neither an account key.
Also, if you want to access a storage emulator instance running on a different machine, you can override _Endpoint_ parameter in advanced settings, setting it to `http(s)://<host>:<port>/devstoreaccount1` (e.g. `http://10.254.2.5:10000/devstoreaccount1`).
+34
View File
@@ -5,6 +5,40 @@ description: "Rclone Changelog"
# Changelog
## v1.60.1 - 2022-11-17
[See commits](https://github.com/rclone/rclone/compare/v1.60.0...v1.60.1)
* Bug Fixes
* lib/cache: Fix alias backend shutting down too soon (Nick Craig-Wood)
* wasm: Fix walltime link error by adding up-to-date wasm_exec.js (João Henrique Franco)
* docs
* Update faq.md with bisync (Samuel Johnson)
* Corrected download links in windows install docs (coultonluke)
* Add direct download link for windows arm64 (albertony)
* Remove link to rclone slack as it is no longer supported (Nick Craig-Wood)
* Faq: how to use a proxy server that requires a username and password (asdffdsazqqq)
* Oracle-object-storage: doc fix (Manoj Ghosh)
* Fix typo `remove` in rclone_serve_restic command (Joda Stößer)
* Fix character that was incorrectly interpreted as markdown (Clément Notin)
* VFS
* Fix deadlock caused by cache cleaner and upload finishing (Nick Craig-Wood)
* Local
* Clean absolute paths (albertony)
* Fix -L/--copy-links with filters missing directories (Nick Craig-Wood)
* Mailru
* Note that an app password is now needed (Nick Craig-Wood)
* Allow timestamps to be before the epoch 1970-01-01 (Nick Craig-Wood)
* S3
* Add provider quirk `--s3-might-gzip` to fix corrupted on transfer: sizes differ (Nick Craig-Wood)
* Allow Storj to server side copy since it seems to work now (Nick Craig-Wood)
* Fix for unchecked err value in s3 listv2 (Aaron Gokaslan)
* Add additional Wasabi locations (techknowlogick)
* Smb
* Fix `Failed to sync: context canceled` at the end of syncs (Nick Craig-Wood)
* WebDAV
* Fix Move/Copy/DirMove when using -server-side-across-configs (Nick Craig-Wood)
## v1.60.0 - 2022-10-21
[See commits](https://github.com/rclone/rclone/compare/v1.59.0...v1.60.0)
+1 -1
View File
@@ -11,7 +11,7 @@ Serve the remote for restic's REST API.
## Synopsis
Run a basic web server to serve a remote over restic's REST backend
Run a basic web server to serve a remove over restic's REST backend
API over HTTP. This allows restic to use rclone as a data storage
mechanism for cloud providers that restic does not support directly.
+8
View File
@@ -108,6 +108,14 @@ possibilities. So, on Linux, you may end up with code similar to
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
Note: If the proxy server requires a username and password, then use
export http_proxy=http://username:password@proxyserver:12345
export https_proxy=$http_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
The `NO_PROXY` allows you to disable the proxy for specific hosts.
Hosts must be comma separated, and can contain domains or parts.
For instance "foo.com" also matches "bar.foo.com".
+2 -1
View File
@@ -162,7 +162,7 @@ These flags are available for every command.
--use-json-log Use json log format
--use-mmap Use mmap allocator (see docs)
--use-server-modtime Use server modified time instead of object metadata
--user-agent string Set the user-agent to a specified string (default "rclone/v1.60.0")
--user-agent string Set the user-agent to a specified string (default "rclone/v1.60.1")
-v, --verbose count Print lots more stuff (repeat for more)
```
@@ -545,6 +545,7 @@ and may be set in the config file.
--s3-max-upload-parts int Maximum number of parts in a multipart upload (default 10000)
--s3-memory-pool-flush-time Duration How often internal memory buffer pools will be flushed (default 1m0s)
--s3-memory-pool-use-mmap Whether to use mmap buffers in internal memory pool
--s3-might-gzip Tristate Set this if the backend might gzip objects (default unset)
--s3-no-check-bucket If set, don't attempt to check the bucket exists or create it
--s3-no-head If set, don't HEAD uploaded objects to check integrity
--s3-no-head-object If set, do not do HEAD before GET when getting objects
+2 -2
View File
@@ -428,8 +428,8 @@ Properties:
Don't check to see if the files change during upload.
Normally rclone checks the size and modification time of files as they
are being uploaded and aborts with a message which starts "can't copy -
source file is being updated" if the file changes during upload.
are being uploaded and aborts with a message which starts "can't copy
- source file is being updated" if the file changes during upload.
However on some file systems this modification time check may fail (e.g.
[Glusterfs #2206](https://github.com/rclone/rclone/issues/2206)) so this
+5
View File
@@ -190,6 +190,11 @@ Properties:
Password.
This must be an app password - rclone will not work with your normal
password. See the Configuration section in the docs for how to make an
app password.
**NB** Input to this must be obscured - see [rclone obscure](/commands/rclone_obscure/).
Properties:
+50 -3
View File
@@ -1631,15 +1631,31 @@ Properties:
- "s3.ap-southeast-1.lyvecloud.seagate.com"
- Seagate Lyve Cloud AP Southeast 1 (Singapore)
- "s3.wasabisys.com"
- Wasabi US East endpoint
- Wasabi US East 1 (N. Virginia)
- "s3.us-east-2.wasabisys.com"
- Wasabi US East 2 (N. Virginia)
- "s3.us-central-1.wasabisys.com"
- Wasabi US Central 1 (Texas)
- "s3.us-west-1.wasabisys.com"
- Wasabi US West endpoint
- Wasabi US West 1 (Oregon)
- "s3.ca-central-1.wasabisys.com"
- Wasabi CA Central 1 (Toronto)
- "s3.eu-central-1.wasabisys.com"
- Wasabi EU Central endpoint
- Wasabi EU Central 1 (Amsterdam)
- "s3.eu-central-2.wasabisys.com"
- Wasabi EU Central 2 (Frankfurt)
- "s3.eu-west-1.wasabisys.com"
- Wasabi EU West 1 (London)
- "s3.eu-west-2.wasabisys.com"
- Wasabi EU West 2 (Paris)
- "s3.ap-northeast-1.wasabisys.com"
- Wasabi AP Northeast 1 (Tokyo) endpoint
- "s3.ap-northeast-2.wasabisys.com"
- Wasabi AP Northeast 2 (Osaka) endpoint
- "s3.ap-southeast-1.wasabisys.com"
- Wasabi AP Southeast 1 (Singapore)
- "s3.ap-southeast-2.wasabisys.com"
- Wasabi AP Southeast 2 (Sydney)
- "s3.ir-thr-at1.arvanstorage.com"
- ArvanCloud Tehran Iran (Asiatech) endpoint
@@ -2858,6 +2874,37 @@ Properties:
- Type: bool
- Default: false
#### --s3-might-gzip
Set this if the backend might gzip objects.
Normally providers will not alter objects when they are downloaded. If
an object was not uploaded with `Content-Encoding: gzip` then it won't
be set on download.
However some providers may gzip objects even if they weren't uploaded
with `Content-Encoding: gzip` (eg Cloudflare).
A symptom of this would be receiving errors like
ERROR corrupted on transfer: sizes differ NNN vs MMM
If you set this flag and rclone downloads an object with
Content-Encoding: gzip set and chunked transfer encoding, then rclone
will decompress the object on the fly.
If this is set to unset (the default) then rclone will choose
according to the provider setting what to apply, but you can override
rclone's choice here.
Properties:
- Config: might_gzip
- Env Var: RCLONE_S3_MIGHT_GZIP
- Type: Tristate
- Default: unset
#### --s3-no-system-metadata
Suppress setting and reading of system metadata
+1 -1
View File
@@ -1 +1 @@
v1.61.0
v1.60.1
+14 -13
View File
@@ -5,6 +5,7 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"strings"
"testing"
"unicode/utf8"
@@ -28,7 +29,7 @@ var (
func TestNewAccountSizeName(t *testing.T) {
ctx := context.Background()
in := io.NopCloser(bytes.NewBuffer([]byte{1}))
in := ioutil.NopCloser(bytes.NewBuffer([]byte{1}))
stats := NewStats(ctx)
acc := newAccountSizeName(context.Background(), stats, in, 1, "test")
assert.Equal(t, in, acc.in)
@@ -43,7 +44,7 @@ func TestNewAccountSizeName(t *testing.T) {
func TestAccountWithBuffer(t *testing.T) {
ctx := context.Background()
in := io.NopCloser(bytes.NewBuffer([]byte{1}))
in := ioutil.NopCloser(bytes.NewBuffer([]byte{1}))
stats := NewStats(ctx)
acc := newAccountSizeName(ctx, stats, in, -1, "test")
@@ -67,7 +68,7 @@ func TestAccountGetUpdateReader(t *testing.T) {
ctx := context.Background()
test := func(doClose bool) func(t *testing.T) {
return func(t *testing.T) {
in := io.NopCloser(bytes.NewBuffer([]byte{1}))
in := ioutil.NopCloser(bytes.NewBuffer([]byte{1}))
stats := NewStats(ctx)
acc := newAccountSizeName(ctx, stats, in, 1, "test")
@@ -79,7 +80,7 @@ func TestAccountGetUpdateReader(t *testing.T) {
require.NoError(t, acc.Close())
}
in2 := io.NopCloser(bytes.NewBuffer([]byte{1}))
in2 := ioutil.NopCloser(bytes.NewBuffer([]byte{1}))
acc.UpdateReader(ctx, in2)
assert.Equal(t, in2, acc.GetReader())
@@ -94,7 +95,7 @@ func TestAccountGetUpdateReader(t *testing.T) {
func TestAccountRead(t *testing.T) {
ctx := context.Background()
in := io.NopCloser(bytes.NewBuffer([]byte{1, 2, 3}))
in := ioutil.NopCloser(bytes.NewBuffer([]byte{1, 2, 3}))
stats := NewStats(ctx)
acc := newAccountSizeName(ctx, stats, in, 1, "test")
@@ -136,7 +137,7 @@ func testAccountWriteTo(t *testing.T, withBuffer bool) {
for i := range buf {
buf[i] = byte(i % 251)
}
in := io.NopCloser(bytes.NewBuffer(buf))
in := ioutil.NopCloser(bytes.NewBuffer(buf))
stats := NewStats(ctx)
acc := newAccountSizeName(ctx, stats, in, int64(len(buf)), "test")
if withBuffer {
@@ -177,7 +178,7 @@ func TestAccountWriteToWithBuffer(t *testing.T) {
func TestAccountString(t *testing.T) {
ctx := context.Background()
in := io.NopCloser(bytes.NewBuffer([]byte{1, 2, 3}))
in := ioutil.NopCloser(bytes.NewBuffer([]byte{1, 2, 3}))
stats := NewStats(ctx)
acc := newAccountSizeName(ctx, stats, in, 3, "test")
@@ -198,13 +199,13 @@ func TestAccountString(t *testing.T) {
// Test the Accounter interface methods on Account and accountStream
func TestAccountAccounter(t *testing.T) {
ctx := context.Background()
in := io.NopCloser(bytes.NewBuffer([]byte{1, 2, 3}))
in := ioutil.NopCloser(bytes.NewBuffer([]byte{1, 2, 3}))
stats := NewStats(ctx)
acc := newAccountSizeName(ctx, stats, in, 3, "test")
assert.True(t, in == acc.OldStream())
in2 := io.NopCloser(bytes.NewBuffer([]byte{2, 3, 4}))
in2 := ioutil.NopCloser(bytes.NewBuffer([]byte{2, 3, 4}))
acc.SetStream(in2)
assert.True(t, in2 == acc.OldStream())
@@ -227,7 +228,7 @@ func TestAccountAccounter(t *testing.T) {
assert.Equal(t, []byte{1, 2}, buf[:n])
// Test that we can get another accountstream out
in3 := io.NopCloser(bytes.NewBuffer([]byte{3, 1, 2}))
in3 := ioutil.NopCloser(bytes.NewBuffer([]byte{3, 1, 2}))
r2 := as.WrapStream(in3)
as2, ok := r2.(Accounter)
require.True(t, ok)
@@ -267,7 +268,7 @@ func TestAccountMaxTransfer(t *testing.T) {
ci.CutoffMode = oldMode
}()
in := io.NopCloser(bytes.NewBuffer(make([]byte, 100)))
in := ioutil.NopCloser(bytes.NewBuffer(make([]byte, 100)))
stats := NewStats(ctx)
acc := newAccountSizeName(ctx, stats, in, 1, "test")
@@ -311,7 +312,7 @@ func TestAccountMaxTransferWriteTo(t *testing.T) {
ci.CutoffMode = oldMode
}()
in := io.NopCloser(readers.NewPatternReader(1024))
in := ioutil.NopCloser(readers.NewPatternReader(1024))
stats := NewStats(ctx)
acc := newAccountSizeName(ctx, stats, in, 1, "test")
@@ -325,7 +326,7 @@ func TestAccountMaxTransferWriteTo(t *testing.T) {
func TestAccountReadCtx(t *testing.T) {
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)
in := io.NopCloser(bytes.NewBuffer(make([]byte, 100)))
in := ioutil.NopCloser(bytes.NewBuffer(make([]byte, 100)))
stats := NewStats(ctx)
acc := newAccountSizeName(ctx, stats, in, 1, "test")
+2 -2
View File
@@ -675,7 +675,7 @@ func (s *StatsInfo) RetryAfter() time.Time {
}
// NewCheckingTransfer adds a checking transfer to the stats, from the object.
func (s *StatsInfo) NewCheckingTransfer(obj fs.DirEntry) *Transfer {
func (s *StatsInfo) NewCheckingTransfer(obj fs.Object) *Transfer {
tr := newCheckingTransfer(s, obj)
s.checking.add(tr)
return tr
@@ -697,7 +697,7 @@ func (s *StatsInfo) GetTransfers() int64 {
}
// NewTransfer adds a transfer to the stats from the object.
func (s *StatsInfo) NewTransfer(obj fs.DirEntry) *Transfer {
func (s *StatsInfo) NewTransfer(obj fs.Object) *Transfer {
tr := newTransfer(s, obj)
s.transferring.add(tr)
s.startAverageLoop()
+2 -2
View File
@@ -63,12 +63,12 @@ type Transfer struct {
}
// newCheckingTransfer instantiates new checking of the object.
func newCheckingTransfer(stats *StatsInfo, obj fs.DirEntry) *Transfer {
func newCheckingTransfer(stats *StatsInfo, obj fs.Object) *Transfer {
return newTransferRemoteSize(stats, obj.Remote(), obj.Size(), true)
}
// newTransfer instantiates new transfer.
func newTransfer(stats *StatsInfo, obj fs.DirEntry) *Transfer {
func newTransfer(stats *StatsInfo, obj fs.Object) *Transfer {
return newTransferRemoteSize(stats, obj.Remote(), obj.Size(), false)
}
+9 -8
View File
@@ -6,6 +6,7 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"math/rand"
"strings"
"sync"
@@ -22,7 +23,7 @@ import (
func TestAsyncReader(t *testing.T) {
ctx := context.Background()
buf := io.NopCloser(bytes.NewBufferString("Testbuffer"))
buf := ioutil.NopCloser(bytes.NewBufferString("Testbuffer"))
ar, err := New(ctx, buf, 4)
require.NoError(t, err)
@@ -47,7 +48,7 @@ func TestAsyncReader(t *testing.T) {
require.NoError(t, err)
// Test Close without reading everything
buf = io.NopCloser(bytes.NewBuffer(make([]byte, 50000)))
buf = ioutil.NopCloser(bytes.NewBuffer(make([]byte, 50000)))
ar, err = New(ctx, buf, 4)
require.NoError(t, err)
err = ar.Close()
@@ -58,7 +59,7 @@ func TestAsyncReader(t *testing.T) {
func TestAsyncWriteTo(t *testing.T) {
ctx := context.Background()
buf := io.NopCloser(bytes.NewBufferString("Testbuffer"))
buf := ioutil.NopCloser(bytes.NewBufferString("Testbuffer"))
ar, err := New(ctx, buf, 4)
require.NoError(t, err)
@@ -84,7 +85,7 @@ func TestAsyncReaderErrors(t *testing.T) {
require.Error(t, err)
// invalid buffer number
buf := io.NopCloser(bytes.NewBufferString("Testbuffer"))
buf := ioutil.NopCloser(bytes.NewBufferString("Testbuffer"))
_, err = New(ctx, buf, 0)
require.Error(t, err)
_, err = New(ctx, buf, -1)
@@ -169,7 +170,7 @@ func TestAsyncReaderSizes(t *testing.T) {
bufsize := bufsizes[k]
read := readmaker.fn(strings.NewReader(text))
buf := bufio.NewReaderSize(read, bufsize)
ar, _ := New(ctx, io.NopCloser(buf), l)
ar, _ := New(ctx, ioutil.NopCloser(buf), l)
s := bufreader.fn(ar)
// "timeout" expects the Reader to recover, AsyncReader does not.
if s != text && readmaker.name != "timeout" {
@@ -210,7 +211,7 @@ func TestAsyncReaderWriteTo(t *testing.T) {
bufsize := bufsizes[k]
read := readmaker.fn(strings.NewReader(text))
buf := bufio.NewReaderSize(read, bufsize)
ar, _ := New(ctx, io.NopCloser(buf), l)
ar, _ := New(ctx, ioutil.NopCloser(buf), l)
dst := &bytes.Buffer{}
_, err := ar.WriteTo(dst)
if err != nil && err != io.EOF && err != iotest.ErrTimeout {
@@ -271,7 +272,7 @@ func testAsyncReaderClose(t *testing.T, writeto bool) {
close(started)
if writeto {
// exercise the WriteTo path
copyN, copyErr = a.WriteTo(io.Discard)
copyN, copyErr = a.WriteTo(ioutil.Discard)
} else {
// exercise the Read path
buf := make([]byte, 64*1024)
@@ -326,7 +327,7 @@ func TestAsyncReaderSkipBytes(t *testing.T) {
t.Run(fmt.Sprintf("%d", initialRead), func(t *testing.T) {
for _, skip := range skips {
t.Run(fmt.Sprintf("%d", skip), func(t *testing.T) {
ar, err := New(ctx, io.NopCloser(bytes.NewReader(data)), buffers)
ar, err := New(ctx, ioutil.NopCloser(bytes.NewReader(data)), buffers)
require.NoError(t, err)
wantSkipFalse := false
+2 -1
View File
@@ -4,6 +4,7 @@ package configfile
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
@@ -112,7 +113,7 @@ func (s *Storage) Save() error {
if err != nil {
return fmt.Errorf("failed to create config directory: %w", err)
}
f, err := os.CreateTemp(dir, name)
f, err := ioutil.TempFile(dir, name)
if err != nil {
return fmt.Errorf("failed to create temp file for new config: %w", err)
}
+3 -2
View File
@@ -2,6 +2,7 @@ package configfile
import (
"fmt"
"io/ioutil"
"os"
"runtime"
"strings"
@@ -29,7 +30,7 @@ fruit = banana
// Fill up a temporary config file with the testdata filename passed in
func setConfigFile(t *testing.T, data string) func() {
out, err := os.CreateTemp("", "rclone-configfile-test")
out, err := ioutil.TempFile("", "rclone-configfile-test")
require.NoError(t, err)
filePath := out.Name()
@@ -159,7 +160,7 @@ type = number3
`, toUnix(buf))
t.Run("Save", func(t *testing.T) {
require.NoError(t, data.Save())
buf, err := os.ReadFile(config.GetConfigPath())
buf, err := ioutil.ReadFile(config.GetConfigPath())
require.NoError(t, err)
assert.Equal(t, `[one]
fruit = potato
+5 -4
View File
@@ -10,6 +10,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"strings"
@@ -127,7 +128,7 @@ func Decrypt(b io.ReadSeeker) (io.Reader, error) {
// Encrypted content is base64 encoded.
dec := base64.NewDecoder(base64.StdEncoding, r)
box, err := io.ReadAll(dec)
box, err := ioutil.ReadAll(dec)
if err != nil {
return nil, fmt.Errorf("failed to load base64 encoded data: %w", err)
}
@@ -139,7 +140,7 @@ func Decrypt(b io.ReadSeeker) (io.Reader, error) {
for {
if envKeyFile := os.Getenv("_RCLONE_CONFIG_KEY_FILE"); len(envKeyFile) > 0 {
fs.Debugf(nil, "attempting to obtain configKey from temp file %s", envKeyFile)
obscuredKey, err := os.ReadFile(envKeyFile)
obscuredKey, err := ioutil.ReadFile(envKeyFile)
if err != nil {
errRemove := os.Remove(envKeyFile)
if errRemove != nil {
@@ -211,7 +212,7 @@ func Encrypt(src io.Reader, dst io.Writer) error {
var key [32]byte
copy(key[:], configKey[:32])
data, err := io.ReadAll(src)
data, err := ioutil.ReadAll(src)
if err != nil {
return err
}
@@ -255,7 +256,7 @@ func SetConfigPassword(password string) error {
}
configKey = sha.Sum(nil)
if PassConfigKeyForDaemonization {
tempFile, err := os.CreateTemp("", "rclone")
tempFile, err := ioutil.TempFile("", "rclone")
if err != nil {
return fmt.Errorf("cannot create temp file to store configKey: %w", err)
}
+4 -8
View File
@@ -146,22 +146,18 @@ func Float64VarP(flags *pflag.FlagSet, p *float64, name, shorthand string, value
// DurationP defines a flag which can be set by an environment variable
//
// It wraps the duration in an fs.Duration for extra suffixes and
// passes it to pflag.VarP
// It is a thin wrapper around pflag.DurationP
func DurationP(name, shorthand string, value time.Duration, usage string) (out *time.Duration) {
out = new(time.Duration)
*out = value
pflag.VarP((*fs.Duration)(out), name, shorthand, usage)
out = pflag.DurationP(name, shorthand, value, usage)
setValueFromEnv(pflag.CommandLine, name)
return out
}
// DurationVarP defines a flag which can be set by an environment variable
//
// It wraps the duration in an fs.Duration for extra suffixes and
// passes it to pflag.VarP
// It is a thin wrapper around pflag.DurationVarP
func DurationVarP(flags *pflag.FlagSet, p *time.Duration, name, shorthand string, value time.Duration, usage string) {
flags.VarP((*fs.Duration)(p), name, shorthand, usage)
flags.DurationVarP(p, name, shorthand, value, usage)
setValueFromEnv(flags, name)
}
+2 -1
View File
@@ -7,6 +7,7 @@ package config_test
import (
"context"
"fmt"
"io/ioutil"
"os"
"testing"
@@ -36,7 +37,7 @@ func testConfigFile(t *testing.T, options []fs.Option, configFileName string) fu
_ = os.Unsetenv("_RCLONE_CONFIG_KEY_FILE")
_ = os.Unsetenv("RCLONE_CONFIG_PASS")
// create temp config file
tempFile, err := os.CreateTemp("", configFileName)
tempFile, err := ioutil.TempFile("", configFileName)
assert.NoError(t, err)
path := tempFile.Name()
assert.NoError(t, tempFile.Close())
+2 -1
View File
@@ -3,6 +3,7 @@ package filter
import (
"context"
"fmt"
"io/ioutil"
"os"
"strings"
"sync"
@@ -29,7 +30,7 @@ func TestNewFilterDefault(t *testing.T) {
// testFile creates a temp file with the contents
func testFile(t *testing.T, contents string) string {
out, err := os.CreateTemp("", "filter_test")
out, err := ioutil.TempFile("", "filter_test")
require.NoError(t, err)
defer func() {
err := out.Close()
Loaded 100 of 153 files, more files were not shown because too many files have changed in this diff. Show more