Thumbnail generation is skipped for files with future modification timestamps

Đang mở Phù hợp với người mới
#3,907 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
85/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c
Lĩnh vực
desktop

Hướng nghiên cứu

Bắt đầu trong libnemo-private/nemo-thumbnails.c tại chỗ kiểm tra RECENT_MTIME_COOLDOWN so với info->original_file_mtime. Tái hiện bằng một JPEG có mtime sớm hơn 24 giờ, sau đó điều chỉnh điều kiện để cooldown chỉ áp dụng khi mtime không ở tương lai. Hoàn thành nghĩa là các tệp có mtime ở tương lai nhận được thumbnail trong khi các tệp vừa được sửa đổi vẫn tuân theo cooldown hiện có; build lại Nemo và lặp lại bài kiểm tra đã mô tả.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Distribution

Linux Mint 22.3 Zena

Package version

6.6.3+zena

Frequency

Always

Bug description

Problem description

Nemo may indefinitely skip thumbnail generation for files whose modification timestamp (mtime) is in the future.

The current code applies the recent-modification cooldown using the following condition:

if (current_time < info->original_file_mtime + RECENT_MTIME_COOLDOWN) {

If a file's mtime is later than the current system time, this condition remains true until the current time reaches the file's modification timestamp plus RECENT_MTIME_COOLDOWN. As a result, Nemo does not attempt to generate a thumbnail during that period.

This can occur, for example, when files are copied from a device or filesystem that uses a different clock or timestamp convention.

Expected behavior

Files with future modification timestamps should not be blocked by the recent-modification cooldown. Nemo should proceed with thumbnail generation.

The cooldown should continue to apply to files modified within the existing cooldown period.

Proposed fix

Check that the file's modification timestamp is not in the future before applying the cooldown:

if (info->original_file_mtime <= current_time &&
    current_time < info->original_file_mtime + RECENT_MTIME_COOLDOWN) {

This preserves the existing cooldown behavior for recently modified files while allowing thumbnail generation for files with future timestamps.

Steps to reproduce

  1. Create or select a JPEG image.
  2. Set its modification timestamp approximately 24 hours into the future.
  3. Open the containing directory in Nemo.
  4. Observe that the thumbnail is not generated or displayed.
  5. Apply the proposed change, rebuild Nemo, and repeat the test.

Test results

Tested on Linux Mint 22.3 Zena with Nemo 6.6.3+zena.

  • Created a JPEG test image and set its mtime approximately 24 hours into the future.
  • Confirmed that the original version of Nemo did not display the thumbnail.
  • Rebuilt and installed Nemo with the proposed change.
  • Confirmed that the patched version successfully generated and displayed the thumbnail.
  • Removed an outdated xx-large thumbnail cache entry and confirmed that Nemo regenerated a valid thumbnail.
  • Verified that the patch applies cleanly in both forward and reverse directions.

Proposed patch

The attached patch modifies libnemo-private/nemo-thumbnails.c.

nemo-future-mtime-thumbnail-fix.patch

Steps to reproduce
  1. Create or select a JPEG image.
  2. Set its modification timestamp approximately 24 hours into the future.
  3. Open the containing directory in Nemo.
  4. Observe that the thumbnail is not generated or displayed.
  5. Apply the proposed change, rebuild Nemo, and repeat the test.
Expected behavior

Files with modification timestamps in the future should still have their thumbnails generated normally.

The recent-modification cooldown should only apply when the file's modification timestamp is not later than the current system time.

The existing cooldown behavior for recently modified files should remain unchanged.

Additional information

The issue was reproduced on Linux Mint 22.3 Zena with Nemo 6.6.3+zena.

The proposed fix has been built and tested locally. Thumbnail generation works as expected for a JPEG file with an mtime approximately 24 hours in the future after applying the patch.

The patch has been verified by applying it in both forward and reverse directions.

The fix has not yet been tested against the latest upstream development branch.

Ngôn ngữ chính
C
Star
1.6k
Fork
391
Merge trung bình
2 ngày 19 giờ
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của linuxmint/nemo

Tất cả issue của linuxmint/nemo

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.