Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File sizes >4GB are not handled gracefully #31

Closed
nathanhi opened this issue Jun 11, 2023 · 0 comments
Closed

File sizes >4GB are not handled gracefully #31

nathanhi opened this issue Jun 11, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@nathanhi
Copy link
Owner

If a file with >4GB in size is created struct.pack throws an exception while trying to pack the size:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nathanhi/src/pyfatfs/.venv/lib/python3.11/site-packages/fs/copy.py", line 144, in copy_file
    copy_file_if(
  File "/home/nathanhi/src/pyfatfs/.venv/lib/python3.11/site-packages/fs/copy.py", line 223, in copy_file_if
    copy_file_internal(
  File "/home/nathanhi/src/pyfatfs/.venv/lib/python3.11/site-packages/fs/copy.py", line 279, in copy_file_internal
    _copy_locked()
  File "/home/nathanhi/src/pyfatfs/.venv/lib/python3.11/site-packages/fs/copy.py", line 272, in _copy_locked
    dst_fs.upload(dst_path, read_file)
  File "/home/nathanhi/src/pyfatfs/.venv/lib/python3.11/site-packages/fs/base.py", line 1417, in upload
    tools.copy_file_data(file, dst_file, chunk_size=chunk_size)
  File "/home/nathanhi/src/pyfatfs/.venv/lib/python3.11/site-packages/fs/tools.py", line 54, in copy_file_data
    write(chunk)
  File "/home/nathanhi/src/pyfatfs/pyfatfs/FatIO.py", line 200, in write
    self.fs.update_directory_entry(self.dir_entry.get_parent_dir())
  File "/home/nathanhi/src/pyfatfs/pyfatfs/__init__.py", line 25, in _wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/nathanhi/src/pyfatfs/pyfatfs/PyFat.py", line 34, in _wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/nathanhi/src/pyfatfs/pyfatfs/PyFat.py", line 595, in update_directory_entry
    dir_entries += bytes(d)
                   ^^^^^^^^
  File "/home/nathanhi/src/pyfatfs/pyfatfs/FATDirectoryEntry.py", line 247, in __bytes__
    entry += struct.pack(self.FAT_DIRECTORY_LAYOUT,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: 'L' format requires 0 <= number <= 4294967295```

Instead, a PyFatException with errno `EFBIG` should be raised
@nathanhi nathanhi self-assigned this Jun 11, 2023
@nathanhi nathanhi added the enhancement New feature or request label Oct 15, 2023
@nathanhi nathanhi closed this as completed Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant