Ticket UUID: | fcfddc9f6d8e258f14f9119750efd4403eb7e239 | |||
Title: | Tilde file syntax not available on 9.0 but used by "~/.Xdefaults" | |||
Type: | Bug | Version: | main | |
Submitter: | oehhar | Created on: | 2024-09-09 10:40:07 | |
Subsystem: | 81. Portability | Assigned To: | jan.nijtmans | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Closed | Last Modified: | 2024-10-30 13:01:34 | |
Resolution: | Fixed | Closed By: | oehhar | |
Closed on: | 2024-10-30 13:01:34 | |||
Description: |
file generic/tkOption.c contains the following line 1592: /* * No luck there. Try a .Xdefaults file in the user's home directory. */ if (regProp != NULL) { XFree(regProp); } result = ReadOptionFile(interp, (Tk_Window) winPtr, "~/.Xdefaults", TK_USER_DEFAULT_PRIO); return result; It is reported by user "avih" on TkChat, that this will not work for TCL 9. The "~/" syntax is not supported any more. The migration hints tell on tilde expansion https://core.tcl-lang.org/tcl/wiki?name=Migrating+scripts+to+Tcl+9&p tell that. Possible actions:
Thank you for all, Harald | |||
User Comments: |
oehhar added on 2024-10-30 13:01:34:
Thanks, great work! Harald jan.nijtmans added on 2024-10-30 10:24:20: Now merge to trunk and core-8-branch. Makes no sense for 8.6. jan.nijtmans added on 2024-10-30 10:02:29: > I think, it would be more effective to wait for TIP701, as it would be a distinct C-Call. Is this a good idea? I considered that, but since Tk will get its own release schedule, it might be that Tk 9.0.1 is released before Tcl 9.0.1. Anyway, I think any Tk 9 release should work with any Tcl 9 (and 8.7) release. Regarding lightweight/secure: The command only sets a variable name, there's nothing in it that's not secure. It's only executed once at startup, so being a little less lightweight is not really an issue as well. oehhar added on 2024-10-30 07:57:42: I think, it would be more effective to wait for TIP701, as it would be a distinct C-Call. Is this a good idea? Would TIP 701 aqlso a good candidate to replace (void) Tcl_EvalEx(interp, "set tcl_rcFileName [file tildeexpand ~/" INITFILENAME "]", -1, TCL_EVAL_GLOBAL); by a more lightwight and secure call ? Thanks for all, Harald jan.nijtmans added on 2024-10-29 18:15:43: It's not a duplicate, but a similar solution can be used. Proposed fix [6f70b2e3f18cdf14|here]. oehhar added on 2024-10-28 08:11:44: Sorry, eventually duplicate ticket: [7677029cd9113c63] oehhar added on 2024-10-28 08:09:11: Michael Soyka has found another appearence of this bug. Here is his report copied from clt: Tcl/Tk developers- Although automatic tilde expansion has been removed from Tcl version 9, I found one instance in the Tk sources where it hasn't been addressed. Specifically, in tk/win/winMain.c, the Tcl variable "tcl_rcFileName" is apparently given the value "~/wishrc.tcl". I noticed this because my version of wish90 does not source this file as earlier versions did. -mike The relevant line is line 286 of win\winMain.c. Tcl_ObjSetVar2(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, Tcl_NewStringObj("~/.wishrc", -1), TCL_GLOBAL_ONLY); The same is in unix\tkAppInit.c line 189 The file is later taken in TCL file tclMain.c line 228 and passed to Tcl_TranslateFileName. Well, TCL is solving this issue by using the script level, see tclAppInit.c line 167: (void) Tcl_EvalEx(interp, "set tcl_rcFileName [file tildeexpand ~/" INITFILENAME "]", -1, TCL_EVAL_GLOBAL); So, this might be the solution for Tk too. Take care, Harald |