Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/recursive_glob?V=5
QUERY_STRINGV=5
CONTENT_TYPE
DOCUMENT_URI/revision/recursive_glob
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.70.100.97
REMOTE_PORT46170
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR13.58.229.159
HTTP_CF_RAY88d5cb8e69afe241-ORD
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_REFERERhttps://nikit.tcl-lang.org/revision/recursive%5Fglob?V=5
HTTP_CF_CONNECTING_IP13.58.229.159
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit recursive_glob {This command is part of the [TclX] package.

    :   '''recursive_glob''' ''dirlist globlist''
Return a list of all files in/below directories in ''dirlist'' that match one of the patterns in ''globlist''. See also [for_recursive_glob].

----
[TR] Using Tcl 8.5 or newer, you can easily use the proc below instead, which is just an improved version of the TclX code:

======
proc rglob {dirlist globlist} {
        set result {}
        set recurse {}
        foreach dir $dirlist {
                if ![file isdirectory $dir] {
                        return -code error "'$dir' is not a directory"
                }
                foreach pattern $globlist {
                        lappend result {*}[glob -nocomplain -directory $dir -- $pattern]
                }
                foreach file [glob -nocomplain -directory $dir -- *] {
                        set file [file join $dir $file]
                        if [file isdirectory $file] {
                                set fileTail [file tail $file]
                                if {!($fileTail eq "." || $fileTail eq "..")} {
                                        lappend recurse $file
                                }
                        }
                }
        }
        if {[llength $recurse] > 0} {
                lappend result {*}[rglob $recurse $globlist]
        }
        return $result
}
======

----
[tjk] The above code doesn't work (at least for me). Here is a version that works and include an exclusion list. This version doesn't take a list of directories as the first argument but I can't think of a good reason that it should.

======
proc rglob { dirpath patterns {exclude_pats {}} } {
    set rlist {}
    set exclude [glob -nocomplain -types f -directory ${dirpath} {*}${exclude_pats}]
    foreach fpath [glob -nocomplain -types f -directory ${dirpath} {*}${patterns}] {
        if { ${fpath} ni ${exclude} } {
            lappend rlist ${fpath}
        }
    }
    foreach dir [glob -nocomplain -types d -directory ${dirpath} *] {
        lappend rlist {*}[rglob ${dir} ${patterns} ${exclude_pats}]
    }
    return ${rlist}
}
======
------
[RFox]  Even more powerful is the fileutil::find command which uses a 'visitor pattern' to allow you to filter the files found in a directory tree via a script.  since the script could have side effects, this also subsumes the [for_recursive_glob] functionality.

======

<<categories>>Command | TclX} regexp2} CALL {my render recursive_glob {This command is part of the [TclX] package.

    :   '''recursive_glob''' ''dirlist globlist''
Return a list of all files in/below directories in ''dirlist'' that match one of the patterns in ''globlist''. See also [for_recursive_glob].

----
[TR] Using Tcl 8.5 or newer, you can easily use the proc below instead, which is just an improved version of the TclX code:

======
proc rglob {dirlist globlist} {
        set result {}
        set recurse {}
        foreach dir $dirlist {
                if ![file isdirectory $dir] {
                        return -code error "'$dir' is not a directory"
                }
                foreach pattern $globlist {
                        lappend result {*}[glob -nocomplain -directory $dir -- $pattern]
                }
                foreach file [glob -nocomplain -directory $dir -- *] {
                        set file [file join $dir $file]
                        if [file isdirectory $file] {
                                set fileTail [file tail $file]
                                if {!($fileTail eq "." || $fileTail eq "..")} {
                                        lappend recurse $file
                                }
                        }
                }
        }
        if {[llength $recurse] > 0} {
                lappend result {*}[rglob $recurse $globlist]
        }
        return $result
}
======

----
[tjk] The above code doesn't work (at least for me). Here is a version that works and include an exclusion list. This version doesn't take a list of directories as the first argument but I can't think of a good reason that it should.

======
proc rglob { dirpath patterns {exclude_pats {}} } {
    set rlist {}
    set exclude [glob -nocomplain -types f -directory ${dirpath} {*}${exclude_pats}]
    foreach fpath [glob -nocomplain -types f -directory ${dirpath} {*}${patterns}] {
        if { ${fpath} ni ${exclude} } {
            lappend rlist ${fpath}
        }
    }
    foreach dir [glob -nocomplain -types d -directory ${dirpath} *] {
        lappend rlist {*}[rglob ${dir} ${patterns} ${exclude_pats}]
    }
    return ${rlist}
}
======
------
[RFox]  Even more powerful is the fileutil::find command which uses a 'visitor pattern' to allow you to filter the files found in a directory tree via a script.  since the script could have side effects, this also subsumes the [for_recursive_glob] functionality.

======

<<categories>>Command | TclX}} CALL {my revision recursive_glob} CALL {::oo::Obj1260414 process revision/recursive_glob} CALL {::oo::Obj1260412 process}

-errorcode

NONE

-errorinfo

Unknow state transition: LINE -> END
    while executing
"error $msg"
    (class "::Wiki" method "render_wikit" line 6)
    invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
    (class "::Wiki" method "render" line 8)
    invoked from within
"my render $name $C"
    (class "::Wiki" method "revision" line 31)
    invoked from within
"my revision $page"
    (class "::Wiki" method "process" line 56)
    invoked from within
"$server process [string trim $uri /]"

-errorline

4