Add period to pop empty color page stack warning

Sam Carter sam.carter8 at aol.com
Thu Apr 24 10:48:59 CEST 2025


Hi Max,

Many thanks for all the information and the proposed patch!

I'll forward the information and fixes for the TeXworks/overleaf parsers to TeXstudio, maybe they can adopt these fixes too.

Thanks for your time!

Cheers,
S.

> On 24. Apr 2025, at 10:43, Max Chernoff <tex at maxchernoff.ca> wrote:
> 
> Hi Sam,
> 
> On Thu, 2025-04-24 at 01:22 +0200, Sam Carter via tex-live wrote:
>> The fact that -- unlike other warnings -- this one does not end with a
>> period,
> 
> From my testing, less than half of the pdfTeX warnings end with a
> period. Compiling the following file:
> 
>    \pdfmajorversion=1
>    \pdfminorversion=1
>    \pdfximage{example-image-a.pdf}\pdfrefximage\pdflastximage
> 
>    \special{doesn't exist}
> 
>    \pdfmapline{ptmr8y NimbusRomNo9L-Regu}
>    \font\testfont=ptmr8y at 12pt
>    {\testfont Hello, world!}
> 
>    \pdfpageref999
> 
>    \pdfdest name {test} xyz
>    \pdfdest name {test} xyz
> 
>    \ignoreprimitiveerror=1
>    \setbox0=\vbox{\hrule height 1pt \vskip 0pt minus 1fill}
>    \setbox1=\vsplit0 to 5pt
> 
>    \pdfcolorstack0 pop
> 
>    \bye
> 
> gives the following output:
> 
>    This is pdfTeX, Version 3.141592653-2.6-1.40.27 (TeX Live 2026/dev) (preloaded format=pdftex)
>     restricted \write18 enabled.
>    entering extended mode
>    (./pdftex-warnings.tex
>    pdfTeX warning (Object streams): \pdfobjcompresslevel > 0 requires PDF-1.5 or greater. Object streams disabled now.
> 
> 
>    pdfTeX warning: pdftex (file /usr/local/texlive/2025/texmf-dist/tex/latex/mwe/example-image-a.pdf): PDF inclusion: found PDF version <1.5>, but at most version <1.1> allowed
>    ignored error: Infinite glue shrinkage found in box being split
>    Underfull \vbox (badness 10000) detected at line 18
>    [1
>    Non-PDF special ignored!
>    <special> doesn't exist
> 
>    pdfTeX warning (ext4): destination with the same identifier (name{test}) has been already used, duplicate ignored
> 
>    \plainoutput ->\shipout \vbox {\makeheadline \pagebody \makefootline }
>                                                                          \advancepageno \ifnum \outputpenalty >-\@MM \else \dosupereject \fi
>    <output> {\plainoutput
>                           }
>    \supereject ->\par \penalty -\@MM
> 
>    \bye ->\par \vfill \supereject
>                                   \end
>    l.22 \bye
> 
> 
>    pdfTeX warning: pdftex: pop empty color page stack 0
>     </usr/local/texlive/2025/texmf-dist/tex/latex/mwe/example-image-a.pdf>] )
>    (see the transcript file for additional information)
>    pdfTeX warning (dest): Page 999 has been referenced but does not exist!
> 
>     </usr/local/texlive/2025/texmf-dist/fonts/pk/ljfour/public/cm/dpi600/cmr10.pk>
> 
>    pdfTeX warning: pdftex: No flags specified for non-embedded font `NimbusRomNo9L-Regu' (ptmr8y) (I'm using 34): fix your map entry.
> 
> 
>    pdfTeX warning: pdftex: font `NimbusRomNo9L-Regu' is not a standard font; I suppose it is available to your PDF viewer then
>    Output written on pdftex-warnings.pdf (1 page, 15345 bytes).
>    Transcript written on pdftex-warnings.log.
> 
>> confuses some log parsing tools like the log summary from TeXstudio.
> 
> Really, the best solution here is to fix the buggy parsers. It's usually
> just a regex, so it's likely easier than you think. I've actually done
> this before for a similar issue:
> 
>    https://github.com/TeXworks/texworks/pull/971
> 
>    https://github.com/overleaf/overleaf/pull/1024
> 
>> Is there any chance a period could be added to the end of the
>> warning?
> 
> I've attached a patch that will do this, but I'll hold off on merging it
> until I hear from Karl/Thanh.
> 
> Thanks,
> -- Max
> From e95035ae2005bdc959376fa4e9e33cf321539f35 Mon Sep 17 00:00:00 2001
> From: Max Chernoff <git at maxchernoff.ca>
> Date: Thu, 24 Apr 2025 02:34:58 -0600
> Subject: [PATCH] pdfTeX: Always end warning messages with a period
> 
> ---
> texk/web2c/pdftexdir/ChangeLog  |  4 ++++
> texk/web2c/pdftexdir/pdftex.web | 28 +++++++++++++++-------------
> texk/web2c/pdftexdir/utils.c    |  9 +++++++++
> 3 files changed, 28 insertions(+), 13 deletions(-)
> 
> diff --git a/texk/web2c/pdftexdir/ChangeLog b/texk/web2c/pdftexdir/ChangeLog
> index f23c5318..4fcc90c2 100644
> --- a/texk/web2c/pdftexdir/ChangeLog
> +++ b/texk/web2c/pdftexdir/ChangeLog
> @@ -1,3 +1,7 @@
> +2025-04-24  Max Chernoff  <tex at maxchernoff.ca>
> +
> + * pdftex.web, utils.c: Always end warning messages with a period.
> +
> 2025-04-17  Karl Berry  <karl at freefriends.org>
> 
> * pdftex.web (bool): rename variable to booltemp, kowtowing to C23.
> diff --git a/texk/web2c/pdftexdir/pdftex.web b/texk/web2c/pdftexdir/pdftex.web
> index 104abf06..96ef5d17 100644
> --- a/texk/web2c/pdftexdir/pdftex.web
> +++ b/texk/web2c/pdftexdir/pdftex.web
> @@ -17319,7 +17319,7 @@ var kn, st, sh: scaled;
>     f: internal_font_number;
> begin
>     if not (not is_char_node(g) and type(g) = glue_node) then begin
> -        pdf_warning("adjust_interword_glue", "g is not a glue", true, true);
> +        pdf_warning("adjust_interword_glue", "g is not a glue.", true, true);
>         return;
>     end;
> 
> @@ -17682,7 +17682,7 @@ begin
>     end
>     else begin
>         if (pdf_font_type[f] <> new_font_type) and (pdf_font_type[f] <> virtual_font_type) then
> -            pdf_warning("font expansion", "font should be expanded before its first use", true, true);
> +            pdf_warning("font expansion", "font should be expanded before its first use.", true, true);
>         set_expand_params(f, auto_expand, stretch_limit, shrink_limit, font_step, 0);
>         if pdf_font_type[f] = virtual_font_type then
>             vf_expand_local_fonts(f);
> @@ -17722,7 +17722,7 @@ begin
>     if (quad(k) = 0) and (quad(f) > 0) then
>         quad(k) := quad(f);
>     if quad(k) = 0 then
> -        pdf_warning("\letterspacefont", "font has zero em size (\fontdimen6)", true, true);
> +        pdf_warning("\letterspacefont", "font has zero em size (\fontdimen6).", true, true);
> 
>     for i := 0 to nw - 1 do
>         font_info[width_base[k] + i].sc :=
> @@ -19976,7 +19976,7 @@ else begin
>     end;
>     libpdffinish;
>     if fixed_pdf_draftmode = 0 then b_close(pdf_file)
> -    else pdf_warning(0, "\pdfdraftmode enabled, not changing output pdf", true, true)
> +    else pdf_warning(0, "\pdfdraftmode enabled, not changing output pdf.", true, true)
> end
> 
> @ Destinations that have been referenced but don't exists have
> @@ -19997,7 +19997,7 @@ begin
>         print("num");
>         print_int(obj_info(k));
>     end;
> -    print(" has been referenced but does not exist, replaced by a fixed one");
> +    print(" has been referenced but does not exist, replaced by a fixed one.");
>     print_ln; print_ln;
>     pdf_begin_obj(k, 1);
>     pdf_out("[");
> @@ -20030,7 +20030,7 @@ begin
>         print("num");
>         print_int(obj_info(k));
>     end;
> -    print(" has been referenced but does not exist");
> +    print(" has been referenced but does not exist.");
>     print_ln; print_ln;
>     @{pdf_begin_obj(k, 1);
>     pdf_out("[");
> @@ -20051,7 +20051,7 @@ k := head_tab[obj_type_page];
> while obj_aux(k) = 0 do begin
>     pdf_warning("dest", "Page ", true, false);
>     print_int(obj_info(k));
> -    print(" has been referenced but does not exist!");
> +    print(" has been referenced but does not exist.");
>     print_ln; print_ln;
>     k := obj_link(k);
> end;
> @@ -20098,6 +20098,7 @@ for k := font_base + 1 to font_ptr do
>            print_font_identifier(k);
>            print(" have conflicting attributes; I will ignore the attributes assigned to ");
>            print_font_identifier(i);
> +           print(".");
>            print_ln; print_ln;
>         end;
>     end;
> @@ -34132,7 +34133,7 @@ begin
>         if is_error then
>             pdf_error(s, "not allowed in DVI mode (\pdfoutput <= 0)")
>         else
> -            pdf_warning(s, "not allowed in DVI mode (\pdfoutput <= 0); ignoring it", true, true);
> +            pdf_warning(s, "not allowed in DVI mode (\pdfoutput <= 0); ignoring it.", true, true);
>         end
> end;
> 
> @@ -34310,7 +34311,7 @@ begin
>             scan_int;
>             k := cur_val;
>             if (k <= 0) or (k > obj_ptr) or (obj_data_ptr(k) <> 0) then begin
> -                pdf_warning("\pdfobj", "invalid object number being ignored", true, true);
> +                pdf_warning("\pdfobj", "invalid object number being ignored.", true, true);
>                 pdf_retval := -1; {signal the problem}
>                 k := -1; {will be generated again}
>             end;
> @@ -34468,7 +34469,7 @@ begin
>     if (xr > 65535) or (yr > 65535) then begin
>         xr := 0;
>         yr := 0;
> -        pdf_warning("ext1", "too large image resolution ignored", true, true);
> +        pdf_warning("ext1", "too large image resolution ignored.", true, true);
>     end;
>     if (x <= 0) or (y <= 0) or (xr < 0) or (yr < 0) then
>         pdf_error("ext1", "invalid image dimensions");
> @@ -34481,7 +34482,7 @@ begin
>          the image file, usually 1dpi x 1dpi, to avoid arithmetic overflow.}
>         xr := 0;
>         yr := 0;
> -        pdf_warning("ext1", "too small image resolution ignored", true, true);
> +        pdf_warning("ext1", "too small image resolution ignored.", true, true);
>     end;
>     if is_pdf_image(image) then begin
>         w := x;
> @@ -35029,6 +35030,7 @@ begin
>     end;
>     print(") ");
>     print(s2);
> +    print(".");
>     print_ln;
>     show_context;
> end;
> @@ -35458,7 +35460,7 @@ begin
>         print("num");
>         print_int(obj_info(thread));
>     end;
> -    print(" has been referenced but does not exist, replaced by a fixed one");
> +    print(" has been referenced but does not exist, replaced by a fixed one.");
>     print_ln; print_ln;
>     pdf_new_dict(obj_type_others, 0, 0);
>     a := obj_ptr;
> @@ -36522,7 +36524,7 @@ begin
>     if pdf_link_stack_ptr < 1 then
>         pdf_error("ext4", "pdf_link_stack empty, \pdfendlink used without \pdfstartlink?");
>     if pdf_link_stack_top.nesting_level <> cur_s then
> -        pdf_warning(0, "\pdfendlink ended up in different nesting level than \pdfstartlink", true, true);
> +        pdf_warning(0, "\pdfendlink ended up in different nesting level than \pdfstartlink.", true, true);
> 
>     {N.B.: test for running link must be done on |link_node| and not |ref_link_node|,
>      as |ref_link_node| can be set by |do_link| or |append_link| already}
> diff --git a/texk/web2c/pdftexdir/utils.c b/texk/web2c/pdftexdir/utils.c
> index 7f5e5041..fd5e1485 100644
> --- a/texk/web2c/pdftexdir/utils.c
> +++ b/texk/web2c/pdftexdir/utils.c
> @@ -257,6 +257,7 @@ void pdftex_fail(const char *fmt, ...)
> __attribute__ ((format(printf, 1, 2)))
> void pdftex_warn(const char *fmt, ...)
> {
> +    int string_length;
>     va_list args;
>     va_start(args, fmt);
>     println();
> @@ -266,6 +267,14 @@ void pdftex_warn(const char *fmt, ...)
>         tex_printf(" (file %s)", cur_file_name);
>     tex_printf(": ");
>     vsnprintf(print_buf, PRINTF_BUF_SIZE, fmt, args);
> +    string_length = strlen(print_buf);
> +    if (print_buf[string_length - 1] == '!')
> +        print_buf[string_length - 1] = '.';
> +    if (print_buf[string_length - 1] != '.') {
> +        print_buf[string_length] = '.';
> +        print_buf[string_length + 1] = '\0';
> +        string_length++;
> +    }
>     print(maketexstring(print_buf));
>     flushstr(last_tex_string);
>     va_end(args);
> -- 
> 2.49.0
> 




More information about the tex-live mailing list.