mount, s3: clarify allowOthers requirement and bucket name error (#12197)

* mount, s3: clarify allowOthers requirement and bucket name error

`weed mount -allowOthers` defaults to true. On Linux, a non-root
user's mount then needs `user_allow_other` in /etc/fuse.conf, but the
help text only said "allows other users to access the file system".
Say so in the help, and point at -allowOthers=false.

Also fix the grammar of the bucket name length error ("must between
[3, 63]" -> "must be between 3 and 63").

Help and error text only; no behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3: normalize the remaining VerifyS3BucketName error messages

The length message was clarified; the rest of the function still had
inconsistent phrasing ("name must start", "cannot be ip addresses",
"prefix xn-- ... in bucket prefix"). Align them on "bucket name ..."
wording matching the AWS bucket naming rules.

---------

Co-authored-by: pingqiu <pingqiu999@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: user.email <chrislusf@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-10-29 01:36:16 -07:00
1 parent d21a1eda54
commit 9df7d62b4b
2 files changed
+8 -8

No files matched your search

+1 -1
View File
@@ -115,7 +115,7 @@ func init() {
mountOptions.cacheMetaTtlSec = cmdMount.Flag.Int("cacheMetaTtlSec", 60, "metadata cache validity seconds")
mountOptions.cacheDirMaxEntries = cmdMount.Flag.Int("cacheDirMaxEntries", 100000, "a directory with more children than this is not cached locally but read directly from the filer; 0 caches everything")
mountOptions.dataCenter = cmdMount.Flag.String("dataCenter", "", "prefer to write to the data center")
mountOptions.allowOthers = cmdMount.Flag.Bool("allowOthers", true, "allows other users to access the file system")
mountOptions.allowOthers = cmdMount.Flag.Bool("allowOthers", true, "allows other users to access the file system; on Linux, when mounting as a non-root user, this requires 'user_allow_other' in /etc/fuse.conf, so set -allowOthers=false otherwise")
mountOptions.defaultPermissions = cmdMount.Flag.Bool("defaultPermissions", true, "enforce permissions by the operating system")
mountOptions.umaskString = cmdMount.Flag.String("umask", "022", "octal umask, e.g., 022, 0111")
mountOptions.nonempty = cmdMount.Flag.Bool("nonempty", false, "allows the mounting over a non-empty directory")
+7 -7
View File
@@ -15,14 +15,14 @@ const reservedBucketName = "filemeta"
// https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html
func VerifyS3BucketName(name string) (err error) {
if len(name) < 3 || len(name) > 63 {
return fmt.Errorf("bucket name must between [3, 63] characters")
return fmt.Errorf("bucket name must be between 3 and 63 characters")
}
if name == reservedBucketName {
return fmt.Errorf("bucket name %q is reserved", name)
}
for idx, ch := range name {
if !(unicode.IsLower(ch) || ch == '.' || ch == '-' || unicode.IsNumber(ch)) {
return fmt.Errorf("bucket name can only contain lower case characters, numbers, dots, and hyphens")
return fmt.Errorf("bucket name can only contain lowercase letters, numbers, dots, and hyphens")
}
if idx > 0 && (ch == '.' && name[idx-1] == '.') {
return fmt.Errorf("bucket names must not contain two adjacent periods")
@@ -30,19 +30,19 @@ func VerifyS3BucketName(name string) (err error) {
//TODO buckets with s3 transfer acceleration cannot have . in name
}
if name[0] == '.' || name[0] == '-' {
return fmt.Errorf("name must start with number or lower case character")
return fmt.Errorf("bucket name must start with a letter or number")
}
if name[len(name)-1] == '.' || name[len(name)-1] == '-' {
return fmt.Errorf("name must end with number or lower case character")
return fmt.Errorf("bucket name must end with a letter or number")
}
if strings.HasPrefix(name, "xn--") {
return fmt.Errorf("prefix xn-- is reserved and not allowed in bucket prefix")
return fmt.Errorf("bucket name must not start with 'xn--'")
}
if strings.HasSuffix(name, "-s3alias") {
return fmt.Errorf("suffix -s3alias is reserved and not allowed in bucket suffix")
return fmt.Errorf("bucket name must not end with '-s3alias'")
}
if net.ParseIP(name) != nil {
return fmt.Errorf("bucket name cannot be ip addresses")
return fmt.Errorf("bucket name must not be formatted as an IP address")
}
return nil
}