[Bug 258392] lang/tcl85 lang/tcl86: fix unsafe buffer lifetime

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 09 Sep 2021 18:09:18 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258392

            Bug ID: 258392
           Summary: lang/tcl85 lang/tcl86: fix unsafe buffer lifetime
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: tcltk@FreeBSD.org
          Reporter: dim@FreeBSD.org
          Assignee: tcltk@FreeBSD.org
             Flags: maintainer-feedback?(tcltk@FreeBSD.org)

Created attachment 227791
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=227791&action=edit
lang/tcl8[56]: apply upstream fix for unsafe buffer lifetime

During an exp-run for llvm 13 (see bug 258209), it turned out that
lang/tcl8[56] compiled with clang 13 result in problems when databases/sqlite3
attempts to generate its main sqlite3.c source with tclsh [1] [2]:

sqlite3.c:17852:2: error: invalid preprocessing directive
#defi 0, xStep,xFinal,xValue,xInverse,#zName, {0}}
 ^
sqlite3.c:18129:2: error: invalid preprocessing directive
#definly system table */
 ^
sqlite3.c:18223:2: error: invalid preprocessing directive
#defi     /* ON DELETE and ON UPDATE actions, respectively */
 ^

After some searching in tcl history I found that the cause is upstream ticket
https://core.tcl-lang.org/tcl/info/24b9181478 ("Fix unsafe buffer lifetime").
They patched the 8.5 and 8.6 branches, but this didn't appear in a release yet.
8.7 already has the fix.

The unsafe buffer gets optimized differently with clang 13, causing the sqlite3
build to break due to its tcl scripts outputting garbled generated code.

Here is a patch for tcl 8.5 and tcl 8.6. I verified that all tcl versions in
the ports tree can now be compiled with clang 13, and then succesfully generate
the sqlite3.c main file.

[1]
http://gohan04.nyi.freebsd.org/data/mainamd64PR258209-default/2021-09-05_20h27m09s/logs/errors/sqlite3-3.35.5_3,1.log
[2]
http://gohan04.nyi.freebsd.org/data/mainamd64PR258209-default/2021-09-05_20h27m09s/logs/errors/sqlite3-tcl-3.35.5_3,1.log

-- 
You are receiving this mail because:
You are the assignee for the bug.