overview: fix "internal error: no overview data found" on 32 bit architectures - fixes #9723
The precision field in the backend overview YAML files can hold fs.ModTimeNotSupported (100 years in nanoseconds) which overflows int on 32 bit platforms, making the YAML for those backends fail to parse and causing rclone to log 18 internal errors on every invocation. Use int64 for the precision field and add a test that parses every embedded backend YAML file so this is caught on 32 bit test runs.
This commit is contained in:
@@ -26,7 +26,7 @@ type BackendConfig struct {
|
|||||||
Remote string `yaml:"remote"`
|
Remote string `yaml:"remote"`
|
||||||
Features []string `yaml:"features"`
|
Features []string `yaml:"features"`
|
||||||
Hashes []string `yaml:"hashes"`
|
Hashes []string `yaml:"hashes"`
|
||||||
Precision int `yaml:"precision"`
|
Precision int64 `yaml:"precision"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBackendConfig from docs/data/backends
|
// GetBackendConfig from docs/data/backends
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package overview
|
package overview
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/rclone/rclone/docs/data/backends"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
@@ -53,3 +55,17 @@ func TestGetBackendConfig(t *testing.T) {
|
|||||||
assert.Equal(t, expectedMemoryConfig, conf, "parsed memory.yaml should match")
|
assert.Equal(t, expectedMemoryConfig, conf, "parsed memory.yaml should match")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check every embedded backend YAML file parses on all architectures
|
||||||
|
func TestGetBackendConfigAll(t *testing.T) {
|
||||||
|
entries, err := backends.BackendFS.ReadDir(".")
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.NotEmpty(t, entries)
|
||||||
|
|
||||||
|
for _, entry := range entries {
|
||||||
|
name := strings.TrimSuffix(entry.Name(), ".yaml")
|
||||||
|
conf, err := GetBackendConfig(name)
|
||||||
|
assert.NoError(t, err, "failed to load %s", entry.Name())
|
||||||
|
assert.NotNil(t, conf)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user