[ZEPPELIN-6509] Add error handling and safety guards to genthrift.sh#5297
Open
celinayk wants to merge 1 commit into
Open
[ZEPPELIN-6509] Add error handling and safety guards to genthrift.sh#5297celinayk wants to merge 1 commit into
celinayk wants to merge 1 commit into
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What is this PR for?
genthrift.sh(the Thrift code generation script) had no error handling. If thethriftcompiler was missing or failed, or if the script was run from the wrong directory,it could silently overwrite valid generated Java sources with empty/partial output. This PR adds basic safety guards so the script fails fast instead of corrupting the
source tree
What type of PR is it?
Bug Fix
Todos
set -euo pipefailso any failing command aborts the scriptcd "$(dirname "${BASH_SOURCE[0]}")"so the script always runs relative to its own location, regardless of the caller's working directoryjava_license_header.txtexists before proceeding, and exit with a clear error message if it's missingWhat is the Jira issue?
ZEPPELIN-6509
How should this be tested?
bash -n zeppelin-interpreter/src/main/thrift/genthrift.sh— verify syntaxthriftinstalled — confirm it still regenerates sources as beforejava_license_header.txtand run the script — confirm it exits with an error instead of silently producing malformed outputScreenshots (if appropriate)
N/A (shell script change, no UI)
Questions: