Re: potential bug in fmt egg when using columnar

3 views
Skip to first unread message

Alex Shinn

unread,
Jan 15, 2026, 7:40:30 AM (4 days ago) Jan 15
to Niklas Böhm, chicken...@nongnu.org, chibi-...@googlegroups.com
Hi Niklas,

Thanks for the proposal!

The current behavior is intentional.
The columns are generated independently, interleaved,
and as each line is available it's output, updating orig-st.

Updating orig-st with the result of each column would
break the row/col numbers.  What you propose instead is
not updating the full state, but just the non-standard
properties.  I tend to think these should not persist beyond
their columns, but did you have a particular use case in
mind that wasn't behaving as expected?

-- 
Alex

On Wed, Jan 14, 2026 at 11:07 PM Niklas Böhm via Chicken-hackers <chicken...@nongnu.org> wrote:
Hello everybody, hello Alex,

I noticed that when using `columnar` that changes to the format state
get swallowed.  Digging into this, it's due to the copying of the state
before creating partial output from the following lines (fmt-column.scm,
l. 82f):

                ;; gen threads through it's own state, ignore result
                (gen (fmt-set-writer! (copy-fmt-state st) output*))

All of the changes to `st` within the gen function will then ignored.
Now I am not exactly sure which changes we want to preserve, but I
believe that at least the `properties` should be kept, as they might
contain meaningful information (which is how I discovered this bug).
Would it make sense to preserve more information from the copied state
or should we leave it at that?  Currently my fix (also attached) looks like:

        ;; gen threads through it's own state, copy over properties
        (let ([st (gen (fmt-set-writer! (copy-fmt-state st) output*))])
          (fmt-set-properties! orig-st (fmt-properties st)))


Let me know what you think, would be happy to see this included.

Cheers
Nik
Reply all
Reply to author
Forward
0 new messages