Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bin/ghostscript10.07.1/bearsampp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ghostscriptVersion = "10.07.1"
ghostscriptExe = "bin/gswin64.exe"
ghostscriptExeConsole = "bin/gswin64c.exe"

bundleRelease = "@RELEASE_VERSION@"
11 changes: 11 additions & 0 deletions bin/ghostscript10.07.1/update_cidfmap.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@ECHO OFF

pushd "%~dp0"
if not exist "%~dp0bin\gswin64c.exe" (
echo ERROR: gswin64c.exe not found in "%~dp0bin"
exit /b 1
)
Comment on lines +3 to +7

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

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

"%~dp0bin\gswin64c.exe" -q -dBATCH -sFONTDIR=c:/windows/fonts -sCIDFMAP=lib/cidfmap lib/mkcidfm.ps
set EXITCODE=%ERRORLEVEL%
popd
exit /b %EXITCODE%
Comment on lines +9 to +11

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Informational

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

2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bundle.name = ghostscript
bundle.release = 2026.4.12
bundle.release = 2026.7.1
bundle.type = tools
bundle.format = 7z

Expand Down
Loading