|
2013-07-05
| ||
| 16:18 | • Closed ticket [983509ffff]: Tcl_RegisterConfig ignores encoding failure plus... artifact: 3436b56e07 user: dgp | |
| 16:17 | • Ticket [983509ffff]: 7 changes artifact: cd8fcfd3ad user: dgp | |
|
2007-11-06
| ||
| 04:28 | • Ticket [983509ffff]: 4 changes artifact: e3db7a258f user: andreas_kupries | |
| 04:07 | • Ticket [983509ffff]: 4 changes artifact: 7c13549d95 user: andreas_kupries | |
| 03:51 | • Ticket [983509ffff]: 4 changes artifact: 466eeabcae user: dgp | |
| 03:44 | • Ticket [983509ffff]: 4 changes artifact: 23e6837d55 user: dgp | |
| 03:32 | • Ticket [983509ffff]: 4 changes artifact: da61ec97cf user: andreas_kupries | |
| 03:17 | • Ticket [983509ffff]: 4 changes artifact: 39cd2eeb1e user: dgp | |
| 03:00 | • Ticket [983509ffff]: 5 changes artifact: ae0d2f1399 user: andreas_kupries | |
| 02:46 | • Ticket [983509ffff]: 4 changes artifact: 2012f35a4f user: andreas_kupries | |
| 02:41 | • Ticket [983509ffff]: 4 changes artifact: 9f21071a20 user: dkf | |
| 02:39 | • Ticket [983509ffff]: 4 changes artifact: 4f2db5c1d3 user: andreas_kupries | |
|
2007-11-01
| ||
| 18:33 | • Ticket [983509ffff]: 5 changes artifact: fe1d24ecc0 user: dkf | |
|
2007-03-21
| ||
| 22:47 | • Ticket [983509ffff]: 4 changes artifact: ede65af7ba user: dkf | |
|
2007-03-12
| ||
| 23:10 | • Ticket [983509ffff]: 4 changes artifact: ffb44472e2 user: dkf | |
| 22:13 | • Ticket [983509ffff]: 5 changes artifact: c5d5169865 user: dgp | |
|
2006-03-28
| ||
| 04:40 | • Ticket [983509ffff]: 4 changes artifact: d2058afea1 user: andreas_kupries | |
| 04:37 | • Ticket [983509ffff]: 5 changes artifact: 027785b806 user: dgp | |
| 04:04 | • Ticket [983509ffff]: 4 changes artifact: 2dbd9c089b user: andreas_kupries | |
| 00:21 | • Ticket [983509ffff]: 4 changes artifact: 8e3b45e477 user: andreas_kupries | |
| 00:11 | • Ticket [983509ffff]: 4 changes artifact: e8c6d7a120 user: dgp | |
| 00:03 | • Ticket [983509ffff]: 4 changes artifact: 9d81ad164c user: andreas_kupries | |
|
2006-03-10
| ||
| 12:21 | • Ticket [983509ffff]: 5 changes artifact: fcc40da697 user: dgp | |
|
2004-12-02
| ||
| 08:52 | • Ticket [983509ffff]: 5 changes artifact: 852a04d56a user: dgp | |
|
2004-07-17
| ||
| 04:44 | • Ticket [983509ffff]: 4 changes artifact: f1e4c5f9a9 user: andreas_kupries | |
| 04:35 | • Ticket [983509ffff]: 4 changes artifact: 472ee9d1d2 user: dgp | |
| 04:22 | • Ticket [983509ffff]: 4 changes artifact: 3e539f13e5 user: andreas_kupries | |
| 04:19 | • Ticket [983509ffff]: 4 changes artifact: 5a7fbb598c user: dgp | |
| 02:25 | • Ticket [983509ffff]: 4 changes artifact: 6c16450308 user: andreas_kupries | |
|
2004-07-01
| ||
| 16:05 | • New ticket [983509ffff]. artifact: 0d7438e116 user: dgp | |
Tcl_RegisterConfig ignores encoding failure
Closed / Fixed983509ffffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 13 years ago
Descriptionplain2004-07-01 16:05:03
Tcl_RegisterConfig() receives a "valEncoding" argument that specifies the encoding for the string values in the "configuration" table of values. Those values are copied into a dictionary, converting to UTF-encoding. Problem arises when Tcl_GetEncoding(NULL, valEncoding) returns NULL -- essentially meaning the appropriate *.enc file for that encoding could not be found. In that circumstance, T_RC ignores the encoding failure, and goes ahead an converts the config values according to whatever Tcl thinks the system encoding is at the moment. Since T_GE() failed, we know this cannot be the right thing -- we are definitely converting based on the wrong encoding -- and worse, we can't even predict what wrong thing T_RC will do instead. When the "valEncoding" cannot be found, no data should be copied over to the dictionary, since it cannot be done correctly. Whether [pkgconfig] should also not be defined, or whether it should be defined with no data, I'm not sure.
andreas_kupriesplain2004-07-17 02:25:07
Logged In: YES user_id=75003 We could also 'panic'. This might actually best, because something is so seriously wrong that we cannot fix the situaiton, IMHO.
dgpplain2004-07-17 04:19:20
Logged In: YES user_id=80530 If we take that approach, though, I expect a Tclkit built on Tcl 8.5 to always panic at startup.
andreas_kupriesplain2004-07-17 04:22:57
Logged In: YES user_id=75003 In other words, an 8.5-based Tclkit is currently always using the wrong encoding for the embedded values ? More pressure on us to understand and untangle the startup, encoding, fs, etc, right ?
dgpplain2004-07-17 04:35:34
Logged In: YES user_id=80530 I don't know whether an 8.5-based Tclkit is something that exists. If it did, it could avoid this problem by making sure the valEncoding value is "utf-8". If valEncoding were something like "iso8859-1", though, then using that encoding requires finding the iso8859-1.enc file while requires mounting the VFS in which that file is found, which requires a [package require] of the tclvfs package, which requires creating an interp, which includes a call to Tcl_RegisterConfig.
andreas_kupriesplain2004-07-17 04:44:52
Logged In: YES user_id=75003 AFAIK jcw has not yet tried to build an 8.5 kit. Nor others. So this is theoretical right now. Note: Part of the startup of a tclkit is getting a file boot.tcl out of the appended metakit filesystem before the regular vfs infrastructure is in place. That is done by using direct metakit commands to access the views and locate, and read the file. IOW this part has knowledge how the mkfs is organized. This piece of tcl code is embedded in the code, as a static string. Given that it might be possible to get the encoding file in the same manner, before vfs is in place, by using lower layers. I don't remember if we have an API to process an encoding stored in a string as opposed to in a file, or channel. If so this can break the cycle you have described.
dgpplain2004-12-02 08:52:56
Logged In: YES user_id=80530 this is more serious now, since the initial encoding search path is shorter, and it's more likely the required encoding will not be available at the time an interp is created.
dgpplain2006-03-10 12:21:03
Logged In: YES user_id=80530 Are 8.5-based Tclkits available now to start testing this?
andreas_kupriesplain2006-03-28 00:03:47
Logged In: YES user_id=75003 I am doing 8.5 builds about once a week currently. The builds generate basekits. Do you need binaries, or sources, what platforms ?
dgpplain2006-03-28 00:11:42
Logged In: YES user_id=80530 ok, then. 1) implement the "just panic" "fix" to the bug reported here. 2) build a tclkit on the patched sources. 3) try to start that tclkit and see whether it panics.
andreas_kupriesplain2006-03-28 00:21:32
Logged In: YES user_id=75003 I should be able to do that.
andreas_kupriesplain2006-03-28 04:04:58
Logged In: YES user_id=75003 Ok, panic seems to be a bad approach. I am not even getting to tclkits right now. We are building a cripped tclsh's, which are binary patched on install. currently, due to the order things are done this crippled shell is used to build the tclkits. To prevent problems we set the environment so that it will find its library etc. despite the crippling (TCL_LIBRARY, LD_LIBRARY_PATH). This is not working anymore. The pkg config stuff happens, I guess, before the TCL_LIBRARY is used to resolve the location of the encodings, and thus it has no encodings and fails. To actually get to the tclkits I will likely have to rework the buildsystem so that it uses an uncrippled tclsh to run tclkit build. However also, a tclkit is, I think, quite similar to a crippled tclsh when it comes to startup and encodings, TCL_LIBRARY, etc. So it will very likely panic as well. I might try the rewrite, but not today anymore. I will have to let my subconscious work on this a bit more. So, what else could be tried ? Just ignoring the call, leaving us with tclkit which simply does not have any of the data available ? This might actually be feasible, given that the information is intended for build environments, a portable tclconfig.sh in a way. A tclkit will likely have no interest in this at all. Extreme question: While a sufficient number of TCT members voted yes on this, should we nevertheless revisit the rationale of the TIP and maybe back the whole complex out of 8.5 ?
dgpplain2006-03-28 04:37:39
Logged In: YES user_id=80530 ask me again after 8.5a4 is out.
andreas_kupriesplain2006-03-28 04:40:57
Logged In: YES user_id=75003 ok.
dgpplain2007-03-12 22:13:17
Logged In: YES user_id=80530 Originator: YES Is the recent commit relevant to this issue?
dkfplain2007-03-12 23:10:22
Logged In: YES user_id=79902 Originator: NO This bug would probably trip up the recent commit if the encoding was not found.
dkfplain2007-03-21 22:47:35
Logged In: YES user_id=79902 Originator: NO FWIW, I think we need a way of embedding more encodings into the Tcl library so that at least the encoding used for config info is always defined (plus a few others, such as iso8859-1 which is needed for binary channels). Like that, we would be able to revert to a Tcl_Panic on failed encoding loading, which is just about the only sane option anyway; if the encoding isn't there, the build went wrong IMO...
dkfplain2007-11-01 18:33:50
Logged In: YES user_id=79902 Originator: NO iso8859-1 is now embedded directly in the Tcl library. That should allow someone to define a sane(r) fallback strategy.
andreas_kupriesplain2007-11-06 02:39:02
Logged In: YES user_id=75003 Originator: NO Is use of 'iso8859-1' a saner fallback ?
dkfplain2007-11-06 02:41:08
Logged In: YES user_id=79902 Originator: NO Could be. :-)
andreas_kupriesplain2007-11-06 02:46:36
Logged In: YES user_id=75003 Originator: NO Meh :/ Ok. I am coding this up and committing it. It is a 3-liner. Then we can discuss further.
andreas_kupriesplain2007-11-06 03:00:52
Logged In: YES user_id=75003 Originator: NO Ok. The HEAD now uses 'iso8859-1' as the fall back instead of whatever the system encoding is. Whether this is saner than what we had before is something we can discuss here. Dropping priority however.
dgpplain2007-11-06 03:17:16
Logged In: YES user_id=80530 Originator: YES I haven't fully re-immersed myself in this again, but this doesn't seem like the right answer. If valEncoding isn't available, it isn't available, and we can't store values submitted in that encoding. When we store using any other encoding, we necessarily store the wrong thing. I don't see how a new wrong answer is better than the old wrong answer. I'll stick to my original "no data should be copied" prescription.
andreas_kupriesplain2007-11-06 03:32:19
Logged In: YES user_id=75003 Originator: NO And "no data should be copied" is equivalent to a Tcl_Pnic in this location, right?
dgpplain2007-11-06 03:44:20
Logged In: YES user_id=80530 Originator: YES Not explicitly, no. "No data should be copied" means the dictionary for this package will have nothing in it. Consquentially, the corresponding [foo::pkgconfig list] would return an empty list. Some scripts might be quite unhappy not to find data they're looking for, but that would lead to error rather than panic.
dgpplain2007-11-06 03:51:19
Logged In: YES user_id=80530 Originator: YES Not explicitly, no. "No data should be copied" means the dictionary for this package will have nothing in it. Consquentially, the corresponding [foo::pkgconfig list] would return an empty list. Some scripts might be quite unhappy not to find data they're looking for, but that would lead to error rather than panic.
andreas_kupriesplain2007-11-06 04:07:45
Logged In: YES user_id=75003 Originator: NO Ok, that is also easy to do (now that I am actually looking at the code again). Just conditionalize part of the setup on 'venc != NULL'. Ok. Another round of changes coming up.
andreas_kupriesplain2007-11-06 04:28:48
Logged In: YES user_id=75003 Originator: NO Committed. For a bogus encoding we setup the query command, no extension of the database ... Querying scripts will either see an empty list, or a 'package not known' error.
dgpplain2013-07-05 16:17:56
Checkins [341f682e08] (8.5) and [6189063c4d] (8.6,trunk) have fixed this bug by re-designing it out of existence. Now these values are stored as bytes, and the encoding name is also stored and interpretation of the bytes according to that encoding is delayed until the values are retrieved. At that time, it's at least likelier that enough initialization is complete that encoding conversion will happen successfully. If not, the error can arise then rather than during interp creation.
dgp Closed ticket [983509ffff].
[History diff]2013-07-05 16:18:30
Log in (anonymous is fine) to add a comment.