Conversation
# Conflicts: # build.properties
PR Summary by QodoAdd Ghostscript 10.07.1 bundle config, CIDF map script, and bump release
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1. Missing popd on error
|
- Add bearsampp.conf with version 10.07.1 settings and executables - Add update_cidfmap.bat script for CID font map generation
| pushd "%~dp0" | ||
| if not exist "%~dp0bin\gswin64c.exe" ( | ||
| echo ERROR: gswin64c.exe not found in "%~dp0bin" | ||
| exit /b 1 | ||
| ) |
There was a problem hiding this comment.
1. Missing popd on error 🐞 Bug ☼ Reliability
update_cidfmap.bat calls pushd "%~dp0" but exits on the missing-exe error path without running popd, leaving the caller’s working directory changed and the directory stack unbalanced. This can break subsequent steps when the script is invoked from other batch scripts or a long-lived cmd session.
Agent Prompt
### Issue description
`update_cidfmap.bat` does `pushd "%~dp0"` but on the error branch (`gswin64c.exe` missing) it does `exit /b 1` before `popd`, leaving the current directory changed for the caller.
### Issue Context
This script is shipped into the Ghostscript bundle and may be invoked by users or other scripts; it should always restore CWD regardless of success/failure.
### Fix Focus Areas
- bin/ghostscript10.07.1/update_cidfmap.bat[3-7]
### Suggested change
Restructure to ensure cleanup always runs, e.g.:
- Add `popd` before `exit /b 1`, or
- Use a `:cleanup` label and `goto cleanup` on failures so `popd` always executes.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| set EXITCODE=%ERRORLEVEL% | ||
| popd | ||
| exit /b %EXITCODE% |
There was a problem hiding this comment.
2. Exitcode variable leaks 🐞 Bug ⚙ Maintainability
update_cidfmap.bat sets EXITCODE without setlocal/endlocal, so when run from another batch file in the same cmd.exe process it can overwrite the caller’s environment variable. This can cause subtle downstream script logic errors if the caller uses EXITCODE for its own flow.
Agent Prompt
### Issue description
The script assigns `EXITCODE` globally (`set EXITCODE=%ERRORLEVEL%`) and later uses it to exit. Without `setlocal/endlocal`, this variable persists into the caller environment when invoked from another batch script.
### Issue Context
This is a helper script shipped with the bundle; avoiding environment pollution makes it safer to compose into other scripts.
### Fix Focus Areas
- bin/ghostscript10.07.1/update_cidfmap.bat[9-11]
### Suggested change
Either:
- Wrap the script in `setlocal` / `endlocal` (e.g., `setlocal EnableExtensions` at top, and `endlocal & exit /b %EXITCODE%` at end), or
- Avoid the temporary variable entirely by carefully preserving errorlevel while still running `popd` (e.g., store it in a locally-scoped variable via `setlocal`).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit b723ced |
No description provided.