Skip to content

revised/improved logic in .bashrc for memory and system updates.#70

Closed
buildplan wants to merge 10 commits intomainfrom
buildplan-patch-1
Closed

revised/improved logic in .bashrc for memory and system updates.#70
buildplan wants to merge 10 commits intomainfrom
buildplan-patch-1

Conversation

@buildplan
Copy link
Copy Markdown
Owner

No description provided.

@buildplan buildplan self-assigned this Oct 22, 2025
@buildplan buildplan added the enhancement New feature or request label Oct 22, 2025
@buildplan buildplan requested a review from Copilot October 22, 2025 09:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the script to version 0.72.1, improving the memory display formatting and enhancing the robustness of the system updates detection logic in the .bashrc configuration.

Key changes:

  • Enhanced memory display to show values in appropriate units (MiB/GiB) with proper formatting
  • Improved system updates detection with better fallback mechanisms and error handling

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
du_setup.sh Updated version to 0.72.1, improved memory display formatting with unit conversion, and enhanced update detection logic with multiple fallback strategies
du_setup.sh.sha256 Updated checksum to reflect changes in du_setup.sh
README.md Updated version number, date, and checksum references to match the new release

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread du_setup.sh

# Fallback if apt-check didn't provide values
if [ -z "$total" ] && [ -r /var/lib/update-notifier/updates-available ]; then
total=$(awk '/[0-9]+ (update|package)s? can be (updated|applied|installed)/ {print $1; exit}' /var/lib/update-notifier/updates-available 2>/dev/null)
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

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

The regex pattern (update|package)s? will match 'updates' or 'packages' but the s? only applies to the closing word. The pattern should be (updates?|packages?) to correctly match both singular and plural forms of both words.

Suggested change
total=$(awk '/[0-9]+ (update|package)s? can be (updated|applied|installed)/ {print $1; exit}' /var/lib/update-notifier/updates-available 2>/dev/null)
total=$(awk '/[0-9]+ (updates?|packages?) can be (updated|applied|installed)/ {print $1; exit}' /var/lib/update-notifier/updates-available 2>/dev/null)

Copilot uses AI. Check for mistakes.
Comment thread du_setup.sh
Comment on lines +1445 to +1446
total=$(awk '/[0-9]+ (update|package)s? can be (updated|applied|installed)/ {print $1; exit}' /var/lib/update-notifier/updates-available 2>/dev/null)
security=$(awk '/[0-9]+ (update|package)s? .*security/ {print $1; exit}' /var/lib/update-notifier/updates-available 2>/dev/null)
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

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

The regex pattern (update|package)s? will match 'updates' or 'packages' but the s? only applies to the closing word. The pattern should be (updates?|packages?) to correctly match both singular and plural forms of both words.

Suggested change
total=$(awk '/[0-9]+ (update|package)s? can be (updated|applied|installed)/ {print $1; exit}' /var/lib/update-notifier/updates-available 2>/dev/null)
security=$(awk '/[0-9]+ (update|package)s? .*security/ {print $1; exit}' /var/lib/update-notifier/updates-available 2>/dev/null)
total=$(awk '/[0-9]+ (updates?|packages?) can be (updated|applied|installed)/ {print $1; exit}' /var/lib/update-notifier/updates-available 2>/dev/null)
security=$(awk '/[0-9]+ (updates?|packages?) .*security/ {print $1; exit}' /var/lib/update-notifier/updates-available 2>/dev/null)

Copilot uses AI. Check for mistakes.
Removed the check for non-UTF-8 files from the workflow.
Added a step to sanitize non-UTF-8 files before running Codacy Analysis CLI.
Updated Codacy workflow to improve security scanning and file handling.
@buildplan buildplan closed this Oct 22, 2025
@buildplan buildplan deleted the buildplan-patch-1 branch October 22, 2025 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants