Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

The download() function doesn't return error codes, allowing network failures to silently pass through. The check_for_updates() function could then process empty or invalid files, leading to false negatives in update detection.

Changes

  • download() function: Added explicit return $? to propagate curl/wget exit codes
  • check_for_updates() function:
    • Check download return value with if ! download ...
    • Validate downloaded file is non-empty with -s flag
    • Separate error messages for network failures vs. empty files

Before

download "$remote_url" "$tmp_script"

if [ ! -f "$tmp_script" ]; then
    echo -e "${YELLOW}Warning: Could not download...${RESET}"
    return
fi

After

if ! download "$remote_url" "$tmp_script"; then
    echo -e "${YELLOW}Warning: Failed to download...${RESET}"
    return
fi

if [ ! -f "$tmp_script" ] || [ ! -s "$tmp_script" ]; then
    echo -e "${YELLOW}Warning: Downloaded script is missing or empty...${RESET}"
    rm -f "$tmp_script"
    return
fi

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Modified download() to return error codes from curl/wget
- Updated check_for_updates() to check download() return value
- Added validation for empty downloaded files using -s flag
- Improved error messaging to distinguish between network failures and empty files

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 20, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • invalid-domain-that-does-not-exist-12345.com
    • Triggering command: /usr/bin/curl curl -L -s REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Address feedback on light updates to install-wp-tests.sh script Fix network failure handling in install-wp-tests.sh update check Jan 20, 2026
Copilot AI requested a review from swissspidy January 20, 2026 11:23
@swissspidy swissspidy marked this pull request as ready for review January 20, 2026 11:40
@swissspidy swissspidy requested a review from a team as a code owner January 20, 2026 11:40
@swissspidy swissspidy removed request for a team and swissspidy January 20, 2026 11:40
@swissspidy swissspidy merged commit 9508d7f into try/322-refresh Jan 20, 2026
7 checks passed
@swissspidy swissspidy deleted the copilot/sub-pr-356-again branch January 20, 2026 11:41
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.

2 participants