radumarias / rencfs

An encrypted file system written in Rust that is mounted with FUSE on Linux. It can be used to create encrypted directories
Apache License 2.0
118 stars 27 forks source link

Error reading after copy #232

Open radumarias opened 1 week ago

radumarias commented 1 week ago

Describe the bug

If you copy Services Agreement Template.pdf to mnt and then copy it again from mnt to mnt, when you try to open it, it gives an error.

To Reproduce Steps to reproduce the behavior:

  1. Copy the above file to mnt
  2. Copy it from mnt to mnt in the same folder
  3. Open the second file
  4. See the error.

Expected behavior See the pdf.

Screenshots image

Desktop (please complete the following information):

Additional context

  2024-11-15T14:07:59.516604Z  WARN rencfs::mount::linux: implementation is a stub
    at src/mount/linux.rs:985
    in rencfs::mount::linux::statfs with req: Request { unique: 362, uid: 1001, gid: 1001, pid: 149094 }, inode: 1

  2024-11-15T14:07:59.517408Z  WARN rencfs::mount::linux: implementation is a stub
    at src/mount/linux.rs:985
    in rencfs::mount::linux::statfs with req: Request { unique: 364, uid: 1001, gid: 1001, pid: 149094 }, inode: 1

  2024-11-15T14:07:59.517559Z  WARN rencfs::mount::linux: implementation is a stub
    at src/mount/linux.rs:985
    in rencfs::mount::linux::statfs with req: Request { unique: 366, uid: 1001, gid: 1001, pid: 149094 }, inode: 1

  2024-11-15T14:07:59.528041Z  WARN rencfs::mount::linux: implementation is a stub
    at src/mount/linux.rs:985
    in rencfs::mount::linux::statfs with req: Request { unique: 378, uid: 1001, gid: 1001, pid: 149094 }, inode: 1

  2024-11-15T14:07:59.538385Z  WARN rencfs::mount::linux: implementation is a stub
    at src/mount/linux.rs:985
    in rencfs::mount::linux::statfs with req: Request { unique: 388, uid: 1001, gid: 1001, pid: 149094 }, inode: 1

  2024-11-15T14:07:59.548800Z  WARN rencfs::mount::linux: implementation is a stub
    at src/mount/linux.rs:985
    in rencfs::mount::linux::statfs with req: Request { unique: 398, uid: 1001, gid: 1001, pid: 149094 }, inode: 1

  2024-11-15T14:07:59.645539Z ERROR rencfs::encryptedfs: size mismatch in write(), size 0 offset 0 buf_len 372635 len 262144
    at src/encryptedfs.rs:1710
    in rencfs::encryptedfs::write with ino: 16177583467943519426, offset: 0, handle: 6, len: 372635
    in rencfs::mount::linux::copy_file_range with req: Request { unique: 408, uid: 1001, gid: 1001, pid: 149094 }, inode: 6869766424152510740, fh_in: 5, off_in: 0, inode_out: 16177583467943519426, fh_out: 6, off_out: 0, length: 372635, flags: 0

  2024-11-15T14:07:59.645616Z  INFO rencfs::encryptedfs: written uncommited for 16177583467943519426 size 262144
    at src/encryptedfs.rs:1715
    in rencfs::encryptedfs::write with ino: 16177583467943519426, offset: 0, handle: 6, len: 372635
    in rencfs::mount::linux::copy_file_range with req: Request { unique: 408, uid: 1001, gid: 1001, pid: 149094 }, inode: 6869766424152510740, fh_in: 5, off_in: 0, inode_out: 16177583467943519426, fh_out: 6, off_out: 0, length: 372635, flags: 0

  2024-11-15T14:07:59.646608Z  INFO rencfs::encryptedfs: written uncommited for 16177583467943519426 size 372635
    at src/encryptedfs.rs:1715
    in rencfs::encryptedfs::write with ino: 16177583467943519426, offset: 0, handle: 6, len: 110491
    in rencfs::mount::linux::copy_file_range with req: Request { unique: 408, uid: 1001, gid: 1001, pid: 149094 }, inode: 6869766424152510740, fh_in: 5, off_in: 0, inode_out: 16177583467943519426, fh_out: 6, off_out: 0, length: 372635, flags: 0

  2024-11-15T14:07:59.713348Z  INFO rencfs::encryptedfs: written for 16177583467943519426 372635
    at src/encryptedfs.rs:1565
    in rencfs::mount::linux::release with req: Request { unique: 418, uid: 0, gid: 0, pid: 0 }, inode: 16177583467943519426, fh: 6, flags: 32769, lock_owner: 0, flush: false

  2024-11-15T14:07:59.713398Z ERROR rencfs::encryptedfs: size mismatch write 372635 262144
    at src/encryptedfs.rs:1567
    in rencfs::mount::linux::release with req: Request { unique: 418, uid: 0, gid: 0, pid: 0 }, inode: 16177583467943519426, fh: 6, flags: 32769, lock_owner: 0, flush: false

  2024-11-15T14:07:59.752235Z  WARN rencfs::mount::linux: error: errno is 13
    at src/mount/linux.rs:1126
    in rencfs::mount::linux::access with req: Request { unique: 438, uid: 1001, gid: 1001, pid: 149094 }, inode: 16177583467943519426, mask: 1