archiecobbs / s3backer

FUSE/NBD single file backing store via Amazon S3
Other
535 stars 77 forks source link

s3backer: invalid file size `1y' #162

Closed solracsf closed 2 years ago

solracsf commented 2 years ago

Accordingly to man page:

--size=SIZE
             Specify the size (in bytes) of the backed file to be exported by the
             filesystem.  The size may have an optional suffix 'K' for kilobytes,
             'M' for megabytes, 'G' for gigabytes, 'T' for terabytes, 'E' for
             exabytes, 'Z' for zettabytes, or 'Y' for yottabytes.  s3backer will
             attempt to auto-detect the size of the backed file by reading block
             number zero.  If this option is not specified, the auto-detected value
             will be used.  If this option is specified but disagrees with the
             auto-detected value, s3backer will exit with an error unless --force
             is also given.

but when set as:

--size=1y (or 1Y)

it outputs

s3backer: invalid file size `1y'

archiecobbs commented 2 years ago

What does this program output?

#include <stdint.h>
#include <stdio.h>
int
main(int ac, char **av)
{
    printf("%lu\n", (unsigned long)sizeof(uintmax_t));
    return 0;
}

You can compile and run it like this:

$ cc -o xx xx.c && ./xx

If it prints 8 then the problem is that the largest integer C type is not big enough to hold that many blocks.

s3backer could be more helpful with the error message in this situation of course.

solracsf commented 2 years ago

8 it is

# cc -o xx xx.c && ./xx
8
archiecobbs commented 2 years ago

Better error message implemented in 4c7596f4.