-
-
Notifications
You must be signed in to change notification settings - Fork 0
⚡ optimize subprocess invocation for ext4 config removal #227
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
Merged
Ven0m0
merged 2 commits into
main
from
perf-optimize-systemd-timers-6539663368636111348
Mar 20, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -108,37 +108,31 @@ remove_ext4_configs() { | |||||||||
| # Remove ext4-specific cron jobs | ||||||||||
| local cron_dir="$WD/t/r/etc/cron.d" | ||||||||||
| if [[ -d $cron_dir ]]; then | ||||||||||
| local -a cron_files=("$cron_dir"/*) | ||||||||||
| local -a cron_matches=() | ||||||||||
| if ((${#cron_files[@]})); then | ||||||||||
| while IFS= read -r -d '' f; do | ||||||||||
| cron_matches+=("$f") | ||||||||||
| done < <(grep -liZ -E 'e2fsck|tune2fs|ext4' "${cron_files[@]}" 2>/dev/null || true) | ||||||||||
|
|
||||||||||
| for f in "${cron_matches[@]}"; do | ||||||||||
| log "Removed ext4-specific cron job: ${f##*/}" | ||||||||||
| rm -f "$f" | ||||||||||
| done | ||||||||||
| fi | ||||||||||
| local files=() | ||||||||||
| while IFS= read -r -d '' f; do | ||||||||||
| files+=("$f") | ||||||||||
| done < <(grep -liZ "e2fsck\|tune2fs\|ext4" "$cron_dir"/* 2>/dev/null) | ||||||||||
|
Comment on lines
+111
to
+114
|
||||||||||
|
|
||||||||||
| for f in "${files[@]}"; do | ||||||||||
| log "Removed ext4-specific cron job: ${f##*/}" | ||||||||||
| rm -f "$f" | ||||||||||
| done | ||||||||||
| fi | ||||||||||
|
|
||||||||||
| # Remove ext4-specific systemd timers | ||||||||||
| local systemd_dir="$WD/t/r/etc/systemd/system" | ||||||||||
| if [[ -d $systemd_dir ]]; then | ||||||||||
| local -a timer_files=("$systemd_dir"/*.timer) | ||||||||||
| local -a timer_matches=() | ||||||||||
| if ((${#timer_files[@]})); then | ||||||||||
| while IFS= read -r -d '' f; do | ||||||||||
| timer_matches+=("$f") | ||||||||||
| done < <(grep -liZ -E 'e2fsck|tune2fs|ext4' "${timer_files[@]}" 2>/dev/null || true) | ||||||||||
|
|
||||||||||
| for f in "${timer_matches[@]}"; do | ||||||||||
| log "Removed ext4-specific systemd timer: ${f##*/}" | ||||||||||
| rm -f "$f" | ||||||||||
| # Remove corresponding service file | ||||||||||
| rm -f "${f%.timer}.service" 2>/dev/null || : | ||||||||||
| done | ||||||||||
| fi | ||||||||||
| local files=() | ||||||||||
|
|
||||||||||
| while IFS= read -r -d '' f; do | ||||||||||
| files+=("$f") | ||||||||||
| done < <(grep -liZ "e2fsck\|tune2fs\|ext4" "$systemd_dir"/*.timer 2>/dev/null) | ||||||||||
|
Comment on lines
+126
to
+128
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the previous block, you can use
Suggested change
References
Comment on lines
+126
to
+128
|
||||||||||
|
|
||||||||||
| for f in "${files[@]}"; do | ||||||||||
| log "Removed ext4-specific systemd timer: ${f##*/}" | ||||||||||
| rm -f "$f" | ||||||||||
| # Remove corresponding service file | ||||||||||
| rm -f "${f%.timer}.service" 2>/dev/null || : | ||||||||||
| done | ||||||||||
| fi | ||||||||||
|
|
||||||||||
| log "ext4-specific configs removed" | ||||||||||
|
|
||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While using a
while readloop is a robust way to handle filenames, you can make this more concise and efficient by usingmapfile(an alias forreadarray). This aligns with the repository's style guide which prefersmapfilefor populating arrays.References
mapfile -tfor populating arrays. (link)