WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@N-Storm
Copy link
Member

@N-Storm N-Storm commented Nov 13, 2025

Description

The armbian-ramlog utility includes a postrotate action that copies log file contents from persistent storage ("HDD") to RAM using cat source > dest. This approach was likely chosen to ensure compatibility with log files that remain open for writing.

However, this method resets the file modification timestamp. While this typically has no impact on actively written log files, it can cause unwanted behavior for certain files in /var/log. Any subsequent synchronization from RAM to persistent storage will propagate these altered timestamps.

Ideally, the postrotate action could handle this more gracefully, but as a simple and non-invasive solution, this change adds a timestamp preservation step using touch.

How Has This Been Tested?

The change is very trivial. Nevertheless, I verified it on my Orange Pi One (v25.8.2 for Orange Pi One running Armbian Linux 6.12.51-current-sunxi).

Checklist:

Please delete options that are not relevant.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings

Summary by CodeRabbit

  • Bug Fixes
    • Log rotation now preserves original file timestamps when archiving logs, ensuring accurate log history tracking.

Add timestamp preservation when copying log files.
@N-Storm N-Storm requested a review from a team as a code owner November 13, 2025 07:01
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 13, 2025

Walkthrough

The armbian-ramlog script's postrotate block now preserves source file timestamps on copied log files using touch -r, ensuring rotated logs maintain their original modification times without changing copy behavior.

Changes

Cohort / File(s) Change Summary
Timestamp preservation in log rotation
packages/bsp/common/usr/lib/armbian/armbian-ramlog
Added touch -r command in postrotate block to sync destination file timestamps with source files during log rotation

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Single-file modification with focused scope
  • Straightforward timestamp preservation logic using standard Unix utilities
  • Verify that touch -r syntax is correct for the target system's touch implementation

Poem

🐰 A timestamp's tale, preserved with care,
When logs spin round and rotate fair,
Touch tells the time of days gone by,
No data lost, no alibi,
The ramlog hops with grace sublime!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Preserve timestamps when copying log files' directly and specifically describes the main change: adding timestamp preservation via touch -r in the postrotate block.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ebc129f and c09f15e.

📒 Files selected for processing (1)
  • packages/bsp/common/usr/lib/armbian/armbian-ramlog (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: pyavitz
Repo: armbian/build PR: 8631
File: config/boards/khadas-vim4.conf:42-42
Timestamp: 2025-09-13T19:51:14.713Z
Learning: In the Armbian build system, run_host_command_logged can properly handle shell redirection operators like >> when passed as arguments, contrary to typical command wrapper behavior. The function has been tested to work correctly with redirection for appending to files like armbianEnv.txt.
Learnt from: pyavitz
Repo: armbian/build PR: 8631
File: config/boards/khadas-vim4.conf:42-42
Timestamp: 2025-09-13T19:51:14.713Z
Learning: In the Armbian build system, run_host_command_logged properly handles shell redirection operators like ">>" when passed as string arguments. This pattern is used consistently throughout the codebase, such as in lib/functions/rootfs/distro-agnostic.sh where it's used to append to armbianEnv.txt files. The function has been tested and confirmed to work correctly with this syntax.
🔇 Additional comments (1)
packages/bsp/common/usr/lib/armbian/armbian-ramlog (1)

155-157: LGTM! Timestamp preservation approach is sound.

The addition of touch -r $file $dest correctly preserves the source file's modification time after copying. This approach—using cat > for content (maintaining compatibility with open files) followed by touch -r for timestamps—is simple, non-invasive, and achieves the stated goal without changing copy semantics.


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

Hey @N-Storm! 👋

Thanks for submitting your first pull request to the Armbian project — we're excited to have you contributing! 🧡
Your effort doesn’t just improve Armbian — it benefits the entire community of users and developers.

If you'd like to stay informed about project updates or collaborate more closely with the team,
you can optionally share some personal contact preferences at armbian.com/update-data.
This helps us keep in touch without relying solely on GitHub notifications.

Also, don’t forget to ⭐ star the repo if you haven’t already — and welcome aboard! 🚀

@github-actions github-actions bot added size/small PR with less then 50 lines 11 Milestone: Fourth quarter release Needs review Seeking for review BSP Board Support Packages labels Nov 13, 2025
@github-actions github-actions bot added the Ready to merge Reviewed, tested and ready for merge label Nov 13, 2025
@github-actions
Copy link
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions bot removed the Needs review Seeking for review label Nov 13, 2025
@igorpecovnik igorpecovnik merged commit d5182b4 into armbian:main Nov 13, 2025
1 check passed
@N-Storm N-Storm deleted the patch-1 branch November 13, 2025 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

11 Milestone: Fourth quarter release BSP Board Support Packages Ready to merge Reviewed, tested and ready for merge size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

2 participants