Skip to content

Commit

Permalink
fix for #1150
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankMittelbach committed Dec 23, 2024
1 parent f105e97 commit 4dddea4
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
6 changes: 6 additions & 0 deletions base/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ to completeness or accuracy and it contains some references to files that are
not part of the distribution.
================================================================================

2024-12-23 Frank Mittelbach <[email protected]>

* docstrip.dtx (subsection{Batchfile commands}):
Check that stream macro (with the name of a file to generate) is not
already used, e.g., as declared preamble (gh/1150)

2024-12-21 Joseph Wright <[email protected]>
* ltoutenc.dtx
Correct \=\i setup in T1 (gh/1587)
Expand Down
12 changes: 12 additions & 0 deletions base/doc/ltnews41.tex
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,18 @@ \subsection{Fix the use of \texttt{localmathalpabets}}
%
\githubissue[s]{1101 1028}

\subsection{\pkg{docstrip}:\ Error if \texttt{.ins} file is problematical}}

If a file to generate had the same name as a preamble declared with
\cs{declarepreamble} the preamble definition was overwritten because
the macro used to stored it was reused for denoting the output
stream. The same problem happened with postambles declared with
\cs{declarepostamble}. This is now detected and an error message is
issued. To circumvent the issue in that case, simply use a different
macro name for the preamble or postamble.
%
\githubissue{1150}


%\section{Changes to packages in the \pkg{amsmath} category}

Expand Down
35 changes: 32 additions & 3 deletions base/docstrip.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
\catcode`\{=1
\catcode`\}=2
\def\filename{docstrip.dtx}
\def\fileversion{v2.6b}
\def\filedate{2022-09-03}
\def\docdate {2024-02-08}
\def\fileversion{v2.6c}
\def\filedate{2024-12-23}
\def\docdate {2024-12-23}
%%
%
%\iffalse
Expand Down Expand Up @@ -3027,8 +3027,37 @@ Z
% defining preamble for the current file.
% \begin{macrocode}
\def\@fileX#1#2{%
% \end{macrocode}
% If the csname used for the stream has already been defined, e.g.,
% as a preamble or postamble or for some other purpose, chances are
% that turning it into a stream number will break something. We
% therefore generate an error and show the current definition.
% \changes{v2.6c}{2024-12-23}{Check that stream macro is not already
% used (gh/1150)}
% \begin{macrocode}
\ifx#1\relax \else
\errmessage{Command \string#1 for denoting the output \noexpand
\file stream already defined!^^J
\space Current meaning is:^^J^^J\meaning#1^^J^^J
\space Extraction will probably fail - check result}%
\fi
\chardef#1=\stream@closed
\def\curout{#1}%
% \end{macrocode}
% If it matches the name of the current preamble or postable then
% it definitely can't work, so we call that out explicitly:
% \begin{macrocode}
\ifx\curout\currentpreamble
\errmessage{Declared preamble name \string#1 not allowed if
\string\file{\@stripstring#1} is used}%
\fi
\ifx\curout\currentpostamble
\errmessage{Declared postamble name \string#1 not allowed if
\string\file{\@stripstring#1} is used}%
\fi
% \end{macrocode}
%
% \begin{macrocode}
\let\curinfiles\empty
\let\curinnames\empty
\def\curref{\MetaPrefix ^^J%
Expand Down

0 comments on commit 4dddea4

Please sign in to comment.