Refactor builddrivers.py for safety and error handling#1552
Refactor builddrivers.py for safety and error handling#1552SajanGhimire1 wants to merge 4 commits intomicrosoft:devfrom
Conversation
SajanGhimire1
commented
Jan 8, 2026
- Replace all os.system() calls with safe alternatives to prevent command injection
- Fix bare except: clause that could catch KeyboardInterrupt and SystemExit
- Add path sanitization to prevent shell injection attacks
- Fix PHP version validation with proper regex instead of flawed string comparison
- Replace hardcoded backslashes with os.sep for cross-platform compatibility
- Add proper error handling for os.chdir() operations
- Fix variable reference bugs (self.repo vs repo, self.branch vs branch)
- Prevent infinite loops in get_local_source() with proper empty path validation
- Add comprehensive source folder validation before copying
- Improve error messages and log file display on build failure
- Fix interactive mode input validation and retry logic
- Replace all os.system() calls with safe alternatives to prevent command injection - Fix bare except: clause that could catch KeyboardInterrupt and SystemExit - Add path sanitization to prevent shell injection attacks - Fix PHP version validation with proper regex instead of flawed string comparison - Replace hardcoded backslashes with os.sep for cross-platform compatibility - Add proper error handling for os.chdir() operations - Fix variable reference bugs (self.repo vs repo, self.branch vs branch) - Prevent infinite loops in get_local_source() with proper empty path validation - Add comprehensive source folder validation before copying - Improve error messages and log file display on build failure - Fix interactive mode input validation and retry logic
|
@SajanGhimire1 Thanks for raising the PR for this fix, I would like you to please resolve the conflicts in this PR since now we will also be supporting PHP8.4 there are few changes in build script. |
Hi @jahnvi480, |
|
@SajanGhimire1 I still see there are 3 conflicts in this file, can you please check. |
Updated shebang to use env for portability and corrected import path for BuildUtil.
Add root directory setting for build scripts based on OS
Simplified root directory assignment for builds.