Skip to content

fix: [disk-encrypt] Disk decrypt failed.#158

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:release/eaglefrom
GongHeng2017:202508211558-eagle-fix
Aug 21, 2025
Merged

fix: [disk-encrypt] Disk decrypt failed.#158
deepin-bot[bot] merged 1 commit intolinuxdeepin:release/eaglefrom
GongHeng2017:202508211558-eagle-fix

Conversation

@GongHeng2017
Copy link
Contributor

@GongHeng2017 GongHeng2017 commented Aug 21, 2025

-- Add _FILE_OFFSET_BITS=64 and _LARGEFILE64_SOURCE compile definitions to enable 64-bit file operations, fixing decryption failures on partitions larger than 2GB.
-- Resolves seek position errors and line 951 execution failure in diskencrypt.cpp when processing large disk partitions.

Log: fix issue
Bug: https://pms.uniontech.com/bug-view-327113.html

Summary by Sourcery

Enable large file support for the disk-encrypt plugin to fix decryption failures on partitions larger than 2GB.

Bug Fixes:

  • Resolve seek position errors and decryption failure on large disk partitions by enabling 64-bit file operations.

Build:

  • Add compile definitions _FILE_OFFSET_BITS=64 and _LARGEFILE64_SOURCE in CMakeLists.txt to support large files.

-- Add _FILE_OFFSET_BITS=64 and _LARGEFILE64_SOURCE compile definitions
to enable 64-bit file operations, fixing decryption failures on
partitions larger than 2GB.
-- Resolves seek position errors and line 951 execution failure in
diskencrypt.cpp when processing large disk partitions.

Log: fix issue
Bug: https://pms.uniontech.com/bug-view-327113.html
@sourcery-ai
Copy link

sourcery-ai bot commented Aug 21, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR updates the disk encryption plugin’s build configuration to enable large-file support macros, ensuring 64-bit file operations and resolving decryption failures and seek-position errors on partitions larger than 2GB.

Class diagram for disk encryption plugin build configuration changes

classDiagram
    class DiskEncryptPlugin {
        +DFMPLUGIN_DISK_ENCRYPT_LIBRARY
        +_FILE_OFFSET_BITS=64
        +_LARGEFILE64_SOURCE
        // Now supports 64-bit file operations
    }
Loading

File-Level Changes

Change Details Files
Enable 64-bit file operations during compilation
  • Added _FILE_OFFSET_BITS=64 to the compile definitions
  • Added _LARGEFILE64_SOURCE to the compile definitions
  • Refactored target_compile_definitions call to accommodate multiple flags
src/dde-file-manager-daemon/daemonplugin-file-encrypt/CMakeLists.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot
Copy link

deepin pr auto review

我对这个CMakeLists.txt的变更进行审查,以下是分析意见:

语法逻辑

语法正确,CMakeLists.txt的格式规范,变更合理。

代码质量

  1. 新增的三个编译定义DFMPLUGIN_DISK_ENCRYPT_LIBRARY_FILE_OFFSET_BITS=64_LARGEFILE64_SOURCE都是有效的预处理器宏定义。
  2. 将编译定义分成多行书写提高了可读性,这是一个好的实践。

代码性能

  1. _FILE_OFFSET_BITS=64_LARGEFILE64_SOURCE这两个宏定义的引入是为了支持大文件处理(大于2GB的文件)。这对于文件加密功能来说是有必要的,因为加密处理的文件可能很大。

代码安全

  1. 大文件支持(_FILE_OFFSET_BITS=64_LARGEFILE64_SOURCE)对于文件加密功能是必要的安全特性,确保可以正确处理大文件而不会出现文件截断或溢出问题。
  2. 这些宏定义应该放在所有源文件之前被定义,以确保整个项目都能正确使用大文件支持。

改进建议

  1. 考虑添加注释解释为什么需要这些宏定义,特别是_FILE_OFFSET_BITS=64_LARGEFILE64_SOURCE,以便其他开发者理解这些配置的用途。例如:
target_compile_definitions(${PROJECT_NAME} PRIVATE
    DFMPLUGIN_DISK_ENCRYPT_LIBRARY
    # 启用大文件支持(>2GB)
    _FILE_OFFSET_BITS=64
    _LARGEFILE64_SOURCE
)
  1. 如果项目中有多个CMakeLists.txt文件,确保在其他相关文件中也一致地设置了这些宏定义,以避免潜在的不一致问题。

  2. 考虑添加版本检查,确保编译环境支持这些大文件特性,特别是在跨平台构建时。

总体而言,这次变更是有益的,增加了对大文件的支持,这对于文件加密功能是必要的。建议添加适当的注释以提高代码的可维护性。

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • Wrap the _FILE_OFFSET_BITS and _LARGEFILE64_SOURCE definitions in a platform check (e.g. only on Linux/POSIX) to avoid unintended side-effects on other systems.
  • Consider using CMake feature checks (such as check_c_source_compiles) to detect and enable large-file support instead of hardcoding these macros.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Wrap the _FILE_OFFSET_BITS and _LARGEFILE64_SOURCE definitions in a platform check (e.g. only on Linux/POSIX) to avoid unintended side-effects on other systems.
- Consider using CMake feature checks (such as check_c_source_compiles) to detect and enable large-file support instead of hardcoding these macros.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: GongHeng2017, max-lvs

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@GongHeng2017
Copy link
Contributor Author

/merge

@deepin-bot deepin-bot bot merged commit d490527 into linuxdeepin:release/eagle Aug 21, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants