bugGNU roff - Bugs: bug #60657, [mm] refer fills undefined fields...

 
 

bug #60657: [mm] refer fills undefined fields with value of previous entries

Submitter:  None
Submitted:  Sat 22 May 2021 05:44:34 PM UTC
   
 
Category:  Macro mm Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 05 Mar 2022 09:10:51 PM UTC, comment #5: 


commit 1db6dd3435ea0306a763c39383f3b46ade51845b
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Sun Mar 6 05:28:00 2022 +1100

    [mm]: Fix Savannah #60657.

    [refer,mm]: Add and use `ref*reset` macro to clean up between
    bibilography entries.

    * tmac/refer.tmac (]-): Move string clean up logic from here...
      (ref*reset): ...to this new macro.  Now we can also use it...

    * contrib/mm/refer-mm.tmac (ref*][-first-pass): ...here.

    Problem appears to date back to refer-mm.tmac's introduction in January
    2011.  Thanks to Bjarni Ingi Gislason for the root-cause analysis and
    proposed fix, to which I applied the DRY principle and added a reset of
    `ref*string` as well.

    Fixes <https://savannah.gnu.org/bugs/?60657>.


G. Branden Robinson <gbranden>
Group administrator
Sat 05 Mar 2022 05:13:54 PM UTC, comment #4: 

Thanks, Bjarni.  That is a clear and simple reproducer.

Here's the output.


$ printf ".R1\nbibliography 60657.ref\n.R2\n" | groff -a -R -mm
<beginning of page>
 - 1 -

 REFERENCES
 1.
 First Author in First Book. Test one.
 2.
 Second Author in Second Book. Test one.
 3.
 Third Author. Test one.



<beginning of page>
 - 2 -
[several blank lines elided]


To clarify for posterity, what we see is that the %O annotation from the first bibliographic entry is incorrectly carried over to the second and subsequent entries.

G. Branden Robinson <gbranden>
Group administrator
Sat 05 Mar 2022 03:01:19 PM UTC, comment #3: 


  Files for a test.

  File "refer.bib"

%K 1
%A First Author
%B First Book
%O Test one

%K 2
%A Second Author
%B Second Book

%K 3
%A Third Author

  File "refer.mm"

.R1
bibliography refer.bib
.R2

  Command:

groff -a -R -mm refer.mm


Bjarni Ingi Gislason <bjarniig>
Sat 05 Mar 2022 12:29:15 PM UTC, comment #2: 

  The symptoms show that the variables '[X' do not get removed before
the next data group, see macro "]-" in file "tmac/refer.tmac".

  Marking the macro with a text shows, that each involvement gets
executed in a block before the output of the bibliography.

  A fix is to add the "rm ..." line in the macro ']-' to the macro
"ref*mac" in the file "contrib/mm/refer-mm.tmac":

.de ref*][-first-pass
.  ec
.  am ref*mac
.    ds [F "\\*([F\"
.    ][ "\\$1" "\\$2"
.\" next line added from macro ']-' in file "tmac/refer.tmac"
.    rm [A [B [C [D [E [G [I [J [N [O [P [Q [R [S [T [V
\\..
..

Bjarni Ingi Gislason <bjarniig>
Fri 04 Jun 2021 11:31:30 AM UTC, comment #1: 

Changing category: problem description makes it seem more likely this is an mm problem than a refer one.

Dave <barx>
Group Member
Sat 22 May 2021 05:44:34 PM UTC, original submission:  

If we compile refer -e -p test.ref testref2.mm |groff -mm -Tpdf > testref_mm.pdf, if a bibligraphic entry has an undefined field
(say %V) the value of the field is replaced with the value of the last entry where the field was defined instead of being replaced by an empty string.

For instance in the compiled pdf file, entry 14 has the volume number of entry 13 and the same comment. This is because the entry 13 defines
%V 257
%S Rapport - CEA
%O  Pr\*'esidence du Conseil. Commissariat \*`a l'\*'energie atomique. Rapport C
.E.A. n° 257 Extract from "the Physical review". Vol. 92. N° 5, December 1953
but entry 14 leaves those fields empty. The value of the field %O
is repeated until the entry 17 that redefines %O.
Similarly, entry 18 defines
%O  Soci\*'et\*'e des sciences physiques et naturelles de Bordeaux. S\*'eance du 4 mars 1897
and that comment gets repeated until entry 22 that redefines %O.

This behavior only appears with -mm macros. With -ms,-me,-mom the
when %O,%V or %S are empty, the previous values don't get printed.

I could not find any documentation indicating that refer is incompatible with the -mm macros or that refer needs particular options to produce valid output for troff -mm, so I assume this is a bug.




Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #51459:  test.ref added by None (37KiB - application/octet-stream - Uncertain if it is a bug of refer or a feature of the mm macros)
file #51460:  testref2.mm added by None (64B - text/x-troff-mm - Uncertain if it is a bug of refer or a feature of the mm macros)
file #51461:  testref_mm.pdf added by None (73KiB - application/pdf - Uncertain if it is a bug of refer or a feature of the mm macros)

 

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 bjarniig (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-03-05 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0
    2022-03-05 gbranden StatusConfirmed In Progress
    2022-03-05 gbranden StatusNone Confirmed
        Assigned toNone gbranden
    2021-06-04 barx Carbon-CopyRemoved 93119 -
    2021-06-04 barx CategoryPreprocessor refer Macro mm
        Summarywith mm macros, refer fills undefined fields with value of previous entries. [mm] refer fills undefined fields with value of previous entries
    2021-05-22 None Attached File- Added test.ref, #51459
        Attached File- Added testref2.mm, #51460
        Attached File- Added testref_mm.pdf, #51461

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code