• Using other files for init script

    From Anonymous@no_email@invalid.invalid to comp.lang.tcl on Thu Sep 25 21:32:21 2025
    From Newsgroup: comp.lang.tcl



    Currently tclsh only looks for ~/.tclshrc to run at startup. Many other interpreters provide more configuration, such as examining an environment variable or looking in $XDG_CONFIG_HOME.

    A thin proposal would be to check (in order): $TCLSHRC, then check
    ~/.tclshrc, then check $XDG_CONFIG_HOME/tcl/tclshrc, then finally ~/.config/tcl/tclshrc using the first file that exists as the value of $tcl_rcFileName.
    I was thinking about writing a TIP, but I wanted to first ask if there is a good reason this isn’t currently supported.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Arjen@user153@newsgrouper.org.invalid to comp.lang.tcl on Mon Oct 13 10:59:06 2025
    From Newsgroup: comp.lang.tcl


    Anonymous <no_email@invalid.invalid> posted:



    Currently tclsh only looks for ~/.tclshrc to run at startup. Many other interpreters provide more configuration, such as examining an environment variable or looking in $XDG_CONFIG_HOME.

    A thin proposal would be to check (in order): $TCLSHRC, then check ~/.tclshrc, then check $XDG_CONFIG_HOME/tcl/tclshrc, then finally ~/.config/tcl/tclshrc using the first file that exists as the value of $tcl_rcFileName.
    I was thinking about writing a TIP, but I wanted to first ask if there is a good reason this isn’t currently supported.

    The advantage of having a TIP is that it is very visible to the community
    and that it can be discussed. One reason for Tcl not supporting it yet is that it has not come to anybody's attention before ;). That, at the very least, is my reason.

    What is the equivalent on other platforms, notably Windows, or is there none?

    Regards,

    Arjen
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Mon Oct 13 14:05:39 2025
    From Newsgroup: comp.lang.tcl

    Am 13.10.2025 um 12:59 schrieb Arjen:

    Anonymous <no_email@invalid.invalid> posted:



    Currently tclsh only looks for ~/.tclshrc to run at startup. Many other
    interpreters provide more configuration, such as examining an environment
    variable or looking in $XDG_CONFIG_HOME.

    A thin proposal would be to check (in order): $TCLSHRC, then check
    ~/.tclshrc, then check $XDG_CONFIG_HOME/tcl/tclshrc, then finally
    ~/.config/tcl/tclshrc using the first file that exists as the value of
    $tcl_rcFileName.
    I was thinking about writing a TIP, but I wanted to first ask if there is a >> good reason this isn’t currently supported.

    The advantage of having a TIP is that it is very visible to the community
    and that it can be discussed. One reason for Tcl not supporting it yet is that
    it has not come to anybody's attention before ;). That, at the very least, is my reason.

    What is the equivalent on other platforms, notably Windows, or is there none?

    Regards,

    Arjen

    Yes,
    lease look to TIP 732, which addresses this:

    https://core.tcl-lang.org/tips/doc/trunk/tip/732.md

    On Windows, this is to my knowledge rarely used and is both, a waste of
    time and a security risk. The security risk is specially on Windows, as
    the initialization folder may be writable by other users.

    Harald
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Arjen@user153@newsgrouper.org.invalid to comp.lang.tcl on Mon Oct 13 13:05:27 2025
    From Newsgroup: comp.lang.tcl


    Harald Oehlmann <wortkarg3@yahoo.com> posted:

    Am 13.10.2025 um 12:59 schrieb Arjen:


    What is the equivalent on other platforms, notably Windows, or is there none?

    Regards,

    Arjen

    Yes,
    lease look to TIP 732, which addresses this:

    https://core.tcl-lang.org/tips/doc/trunk/tip/732.md

    On Windows, this is to my knowledge rarely used and is both, a waste of
    time and a security risk. The security risk is specially on Windows, as
    the initialization folder may be writable by other users.

    Harald

    Thanks for that reference. I agree that it is seldom or never used on Windows, it is a typical UNIX feature. But the security issue may be more limited than you think: the home directory is unreadable for others than the owner (or at least, this is the case on my system).

    Regards,

    Arjen
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Ashok@apnmbx-public@yahoo.com to comp.lang.tcl on Wed Oct 29 08:21:47 2025
    From Newsgroup: comp.lang.tcl

    On 10/13/2025 5:35 PM, Harald Oehlmann wrote:
    Am 13.10.2025 um 12:59 schrieb Arjen:


    Yes,
    lease look to TIP 732, which addresses this:

    https://core.tcl-lang.org/tips/doc/trunk/tip/732.md

    As a point of clarification, 732 does not address this. To quote,

    **Tcl executes the following sequence to run an interpreter
    pre-initialization script, not to be confused with the application initialization script such as .tclshrc or .wishrc.**

    The pre-initialization script is run to as part of initializing Tcl
    itself and is independent of any application initialization script
    (.tclshrc for tclsh, .wishrc for wish and whatever else for custom applications)

    What the OP suggested would not be covered by 732. I do think the
    suggestion is reasonable.

    /Ashok


    --- Synchronet 3.21a-Linux NewsLink 1.2