bugGNU troff - Bugs: bug #52525, gropdf: Uninitialized variable...


bug #52525: gropdf: Uninitialized variable "$fld"

Submitted by:  Bjarni Ingi Gislason <bjarniig>
Submitted on:  Mon 27 Nov 2017 01:14:13 AM UTC  
Category:  Device gropdf Severity:  2 - Minor
Item Group:  Incorrect behaviour Status:  Fixed
Privacy:  Public Assigned to:  Deri James <deri>
Open/Closed:  Closed Planned Release:  1.22.4

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Mon 23 Apr 2018 01:21:06 PM UTC, comment #6:

Thanks, Deri!

G. Branden Robinson <gbranden>
Project Member
Mon 23 Apr 2018 01:07:54 PM UTC, comment #5:

Yes it was fixed in that commit.

Deri James <deri>
Project MemberIn charge of this item.
Mon 23 Apr 2018 12:32:00 PM UTC, comment #4:

Hi Deri,

This was fixed as part of your commit f2a92911c552c3995c010f8beb9b89de3612e95a on 1 March, right?

I can't repro the issue in git HEAD using Bjarni's test file, but the thing seems to be a bit slippery and whitespace-dependent as you noted.

G. Branden Robinson <gbranden>
Project Member
Sat 17 Feb 2018 11:08:23 AM UTC, comment #3:

Found it (with your help). The reason I could not replicate is because my test.trf had an extra blank line on the end, if I remove the line then I get the warning. Without the blank line there is actually no output from groff at all passed to gropdf, it receives an empty file. You can see this if you run with the -Z flag - no output is given. So this warning occurs if gropdf is passed an empty file.

To fix this I have added:-

exit 0 if $lct==0;

At line 331. This seems to fix the problem. Of course, an empty pdf file is produced, which is invalid, but if you include one blank line to the troff input you get a valid pdf with a single blank page. The distinction seems defensible, no input equals no output. In fact this is exactly what grops does.

I have promised Peter Schaffter to try to commit changes for his slides addition to Mom by next Friday, so this fix will be included in that.



Deri James <deri>
Project MemberIn charge of this item.
Sat 17 Feb 2018 04:17:50 AM UTC, comment #2:

Hi Deri,

that is strange. I can reproduce the problem even with the installed groff:

schwarze@isnote $ groff --version
GNU groff version 1.22.3.rc1

schwarze@isnote $ groff -Tpdf test.trf > test.pdf
this is the t-block
Use of uninitialized value $fld in concatenation (.) or string at /usr/local/bin/gropdf line 2012.
Use of uninitialized value $fld in concatenation (.) or string at /usr/local/bin/gropdf line 2012.

schwarze@isnote $ xpdf test.pdf
Syntax Warning: May not be a PDF file (continuing anyway)
Syntax Error: Couldn't read xref table
Syntax Warning: PDF file is damaged - attempting to reconstruct xref table...
Syntax Error: Top-level pages reference is wrong type (null)
Syntax Error: Couldn't read page catalog

schwarze@isnote $ cat test.pdf
1 0 obj
1 0 obj << /CreationDate (D:20180217045905+01'00')
/Creator (groff version 1.22.3.rc1)
/ModDate (D:20180217045905+01'00')
/Producer (gropdf version 1.22.3.rc1)


2 0 obj

  1. 2
                    1. 65535 f

0000000016 00000 n
0000000186 00000 n
/Info 1 0 R
/Root 1 0 R
/Size 2



The error message comes from Perl. Have you somehow globally disabled warnings in your Perl interpreter (admittedly, i wouldn't know how to do that)?

The line in question is
in PutField().

For debugging, i just added this statement right before that line:
warn "|$pmsg|$fld|$term|$typ|" unless defined $fld;
Which resulted in this output:

|SCALAR(0xfa4d4761910)|1 0 obj ||
|| at /usr/local/bin/gropdf line 2012.

|SCALAR(0xfa4d4761910)|2 0 obj ||
|| at /usr/local/bin/gropdf line 2012.

So apparently, the following gets called:
PutField(&"1 0 obj ", undef, false);
PutField(&"2 0 obj ", undef, false);

And indeed, the "1 0 obj endobj" in the output looks strange to me.

Any idea what to do to help you reproduce?

Ingo Schwarze <schwarze>
Project Member
Sat 17 Feb 2018 02:08:04 AM UTC, comment #1:

Afraid I can't duplicate this in 1.22.3.rc1.

Can I close this?

Deri James <deri>
Project MemberIn charge of this item.
Mon 27 Nov 2017 01:14:13 AM UTC, original submission:
Bjarni Ingi Gislason <bjarniig>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by gbranden (Posted a comment)
  • -email is unavailable- added by deri (Posted a comment)
  • -email is unavailable- added by schwarze (Updated the item)
  • -email is unavailable- added by bjarniig (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-23 gbranden StatusConfirmed => Fixed
        Open/ClosedOpen => Closed
        Planned ReleaseNone => 1.22.4
    2018-02-17 schwarze CategoryNone => Device gropdf
        Severity3 - Normal => 2 - Minor
        StatusNone => Confirmed
        Assigned toNone => deri

    Back to the top

    Powered by Savane 3.4