Skip to content

{DO NOT MERGE}CHEF-35767: Fix filetype extraction when using -f flag with license_id#427

Draft
muthuja wants to merge 1 commit into
mainfrom
CHEF-35767-fix-cmdline-filename-filetype-extraction/muthuja
Draft

{DO NOT MERGE}CHEF-35767: Fix filetype extraction when using -f flag with license_id#427
muthuja wants to merge 1 commit into
mainfrom
CHEF-35767-fix-cmdline-filename-filetype-extraction/muthuja

Conversation

@muthuja

@muthuja muthuja commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

This pull request strengthens validation and handling of user-specified filenames in the fetch_package.sh script. The main improvements focus on extracting and validating the package file type when the -f flag is used, ensuring users provide a full filename with a recognized extension.

Validation and extraction improvements:

  • When a filename is provided via -f, the script now extracts the file type from the base name (not the path) to avoid issues with directory names containing dots.
  • The script enforces that the filename includes an extension and exits with an error if not.
  • The extracted file type is validated against a list of known package types (e.g., rpm, deb, msi, etc.). If the file type is unrecognized, the script exits with an error and a helpful message.

Code robustness:

  • The script now consistently quotes variables in command substitutions (e.g., dirname "$download_filename") to avoid issues with spaces or special characters in paths.
  • Ensures that filetype is reset appropriately when not provided on the command line.

Description

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • If Gemfile.lock has changed, I have used --conservative to do it and included the full output in the Description above.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

@muthuja
muthuja requested a review from Copilot June 30, 2026 09:58
@muthuja
muthuja marked this pull request as ready for review June 30, 2026 09:59
@muthuja
muthuja requested review from a team and jaymzh as code owners June 30, 2026 09:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request updates the Bourne-shell install script’s package-fetch logic to ensure the filetype variable is correctly determined when license_id is present and the user supplies -f (exact output filename).

Changes:

  • Extract filetype from a user-provided -f filename when operating in the licensed/content-disposition code path.
  • Explicitly initialize filetype to an empty value in directory-only/default paths so it can be determined later from the actual downloaded filename.

Comment on lines +46 to +49
download_filename="$cmdline_filename"
download_dir=`dirname $download_filename`
use_content_disposition="false" # User specified exact filename
filetype=`echo $cmdline_filename | sed -e 's/^.*\.//'` # Extract filetype from provided filename

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This suggestion has been applied in the latest changes, and it looks like a valid improvement.

Signed-off-by: muthuja <muthujabavaji.vempalli@progress.com>
@muthuja
muthuja force-pushed the CHEF-35767-fix-cmdline-filename-filetype-extraction/muthuja branch from 78acdd1 to a30b605 Compare June 30, 2026 10:11
@muthuja

muthuja commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

There is some active discussion around this change. Until it's resolved, we can hold off on merging it.
cc @Stromweld

@Stromweld
Stromweld marked this pull request as draft July 14, 2026 01:04
@muthuja muthuja changed the title CHEF-35767: Fix filetype extraction when using -f flag with license_id {DO NOT MERGE}CHEF-35767: Fix filetype extraction when using -f flag with license_id Jul 20, 2026
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