f



Tcl 8.6 unexpected 'file exists' - 'file normalize' interaction

I have a proc which takes a full path argument for a file. (one of the
items returned from a glob)

roughly:

proc handlefile {path} {
    #puts stdout [file normalize $path]
    set fsize [file size $path]

    #...etc
}

Strangely... a particular file has problems with the above.
The 'file size' call returns:
could not read "/usr/local/xxx/www/yyy/Newsletter/050609/~
$sueme220509.htm"  no such file or directory

The 'file normalize' output is "/usr/local/virtual1/hosting/base/yy/
yyy/yyy/www/Newsletter/050609/~$sueme220509.htm"

Both these paths are valid, and equivalent due to some soft symlinking
- and both work just fine in an interactive tclsh with 'file size'
returning a size and 'file exists' returning 1.

The heisenbuggish thing is - that the mere act of using puts to
display the normalized path (without actually using the normalized
value anywhere); causes the problem to disappear.
i.e  uncommenting the 2nd line in the proc above causes file size to
work as expected.

I'm assuming this is a bug  - but at this stage I don't know if the ~
or $ characters are relevant or if it just happened to occur on this
strangely named file for some other reason.

This problem occurs on FreeBSD with a Tcl 8.5.b1 checked out in
january - and also with  8.6b1.1 from 2009-06-14
The bug doesn't occur when I use an 8.5a4 tclkit

I'll report a bug for it if it turns out to be a new one - but I just
thought I'd throw it here for a bit of discussion first in case anyone
has some more ideas about it..

Julian


0
neuronstorm (108)
6/14/2009 4:07:59 PM
comp.lang.tcl 23429 articles. 2 followers. Post Follow

10 Replies
1050 Views

Similar Articles

[PageSpeed] 20

On Jun 14, 4:07=A0pm, "neuronst...@gmail.com" <neuronst...@gmail.com>
wrote:
> I have a proc which takes a full path argument for a file. (one of the
> items returned from a glob)
>
> roughly:
>
> proc handlefile {path} {
> =A0 =A0 #puts stdout [file normalize $path]
> =A0 =A0 set fsize [file size $path]
>
> =A0 =A0 #...etc
>
> }
>
> Strangely... a particular file has problems with the above.
> The 'file size' call returns:
> could not read "/usr/local/xxx/www/yyy/Newsletter/050609/~
> $sueme220509.htm" =A0no such file or directory
>
> The 'file normalize' output is "/usr/local/virtual1/hosting/base/yy/
> yyy/yyy/www/Newsletter/050609/~$sueme220509.htm"
>
> Both these paths are valid, and equivalent due to some soft symlinking
> - and both work just fine in an interactive tclsh with 'file size'
> returning a size and 'file exists' returning 1.
>
> The heisenbuggish thing is - that the mere act of using puts to
> display the normalized path (without actually using the normalized
> value anywhere); causes the problem to disappear.
> i.e =A0uncommenting the 2nd line in the proc above causes file size to
> work as expected.
>
> I'm assuming this is a bug =A0- but at this stage I don't know if the ~
> or $ characters are relevant or if it just happened to occur on this
> strangely named file for some other reason.
>
> This problem occurs on FreeBSD with a Tcl 8.5.b1 checked out in
> january - and also with =A08.6b1.1 from 2009-06-14
> The bug doesn't occur when I use an 8.5a4 tclkit
>
> I'll report a bug for it if it turns out to be a new one - but I just
> thought I'd throw it here for a bit of discussion first in case anyone
> has some more ideas about it..
>
> Julian


Sorry - there is a fair bit of irrelevant information in the above.
I described the bug more or less as I encountered it as I wasn't sure
I'd have time to follow up.

The following code demonstrates the issue more simply:


  set folder {/usr/local/test/}
  set files [glob -dir $folder -type f *]
  foreach f $files {
      #puts [file normalize $f]
      puts "$f exists: [file exists $f]"
  }

Simply create a text file with the name "~test.txt" in the test
folder.

With the 1st puts commented, the output is:
/usr/local/test/~test.txt exists: 0

With the puts uncommented, the output is:
/usr/local/test/~test.txt
/usr/local/test/~test.txt exists: 1



Julian






















0
neuronstorm (108)
6/14/2009 4:30:27 PM
neuronstorm@gmail.com wrote:
> This problem occurs on FreeBSD with a Tcl 8.5.b1 checked out in
> january - and also with  8.6b1.1 from 2009-06-14
> The bug doesn't occur when I use an 8.5a4 tclkit

The time for doing anything with alpha or beta versions
of Tcl 8.5 is long over.  Throw them all out.

After confirming your bug in a stable release of Tcl 8.5,
preferable 8.5.7, please report it in the tracker.

DGP
0
dgporter (104)
6/14/2009 4:39:15 PM
JMN wrote:
> The following code demonstrates the issue more simply:
> 
>   set folder {/usr/local/test/}
>   set files [glob -dir $folder -type f *]
>   foreach f $files {
>       #puts [file normalize $f]
>       puts "$f exists: [file exists $f]"
>   }
> 
> Simply create a text file with the name "~test.txt" in the test
> folder.
> 
> With the 1st puts commented, the output is:
> /usr/local/test/~test.txt exists: 0
> 
> With the puts uncommented, the output is:
> /usr/local/test/~test.txt
> /usr/local/test/~test.txt exists: 1

Looks like yet another issue with the internal representation of
filenames. Bother. Please log a bug at SourceForge; the page to do so
should be easily findable from http://tcl.sf.net/

Donal.
0
6/14/2009 4:40:29 PM
On Jun 14, 4:39=A0pm, Don Porter <dgpor...@verizon.net> wrote:
> neuronst...@gmail.com wrote:
> > This problem occurs on FreeBSD with a Tcl 8.5.b1 checked out in
> > january - and also with =A08.6b1.1 from 2009-06-14
> > The bug doesn't occur when I use an 8.5a4 tclkit
>
> The time for doing anything with alpha or beta versions
> of Tcl 8.5 is long over. =A0Throw them all out.
>
> After confirming your bug in a stable release of Tcl 8.5,
> preferable 8.5.7, please report it in the tracker.
>
> DGP

The 8.5a4 was only included as an example of an older version where
the bug did *not* occur.
(I didn't have anything else handy on that machine)

The bug presents in 8.6b1 from january and a checkout from today of
8.6b1.1

Cheers,
Julian

0
neuronstorm (108)
6/14/2009 4:42:10 PM
On Jun 14, 4:39=A0pm, Don Porter <dgpor...@verizon.net> wrote:
> neuronst...@gmail.com wrote:
> > This problem occurs on FreeBSD with a Tcl 8.5.b1 checked out in
> > january - and also with =A08.6b1.1 from 2009-06-14
> > The bug doesn't occur when I use an 8.5a4 tclkit
>
> The time for doing anything with alpha or beta versions
> of Tcl 8.5 is long over. =A0Throw them all out.
>
> After confirming your bug in a stable release of Tcl 8.5,
> preferable 8.5.7, please report it in the tracker.
>
> DGP


re:
"> The time for doing anything with alpha or beta versions
> of Tcl 8.5 is long over.  Throw them all out."

For certain platforms - the 8.5aX versions are the only versions
available from the tclkit download matrix (http://www.equi4.com/pub/tk/
downloads.html)
If you want 8.5 features and don't build tclkits yourself.. is there
another source?

I currently have no intention of throwing this very useful tool out -
and I can't imagine I'm alone in that.
I've tried building tclkits in the past without success. I realize
that by now it may be easier, but the lack of recent contributions to
that download matrix may also hint otherwise... (?)

Julian
0
neuronstorm (108)
6/14/2009 5:50:49 PM
On Jun 14, 10:50=A0am, JMN <neuronst...@gmail.com> wrote:
> On Jun 14, 4:39=A0pm, Don Porter <dgpor...@verizon.net> wrote:
>
> > neuronst...@gmail.com wrote:
> > > This problem occurs on FreeBSD with a Tcl 8.5.b1 checked out in
> > > january - and also with =A08.6b1.1 from 2009-06-14
> > > The bug doesn't occur when I use an 8.5a4 tclkit
>
> > The time for doing anything with alpha or beta versions
> > of Tcl 8.5 is long over. =A0Throw them all out.
>
> > After confirming your bug in a stable release of Tcl 8.5,
> > preferable 8.5.7, please report it in the tracker.
>
> > DGP
>
> For certain platforms - the 8.5aX versions are the only versions
> available from the tclkit download matrix (http://www.equi4.com/pub/tk/
> downloads.html)
> If you want 8.5 features and don't build tclkits yourself.. is there
> another source?
>

> Julian

try looking here,

http://www.patthoyts.tk/tclkit/

0
6/14/2009 8:40:25 PM
neuronstorm@gmail.com wrote:
> I have a proc which takes a full path argument for a file. (one of the
> items returned from a glob)
> ...

While others are addressing the issue, I'd like to point out that glob does 
*not* necessarily return a full path name.  It only returns one if a rooted 
path was given, otherwise it returns a relative path starting at the pattern.

e.g.
##
## assume the directory /usr/local/tmp exists and it has
##  a.txt and b.txt in it
##
cd {/usr/local/tmp}
foreach file [glob *.txt] {
     puts "File is {$file}
}


The above will print out:
File is {a.txt}
File is {b.txt}

Not:
File is {/usr/local/tmp/a.txt}
File is {/usr/local/tmp/b.txt}

-- 
+------------------------------------------------------------------------+
| Gerald W. Lester                                                       |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
0
Gerald.Lester (2014)
6/14/2009 11:09:49 PM
On Jun 14, 12:30=A0pm, JMN <neuronst...@gmail.com> wrote:


> The following code demonstrates the issue more simply:
>
> =A0 set folder {/usr/local/test/}
> =A0 set files [glob -dir $folder -type f *]
> =A0 foreach f $files {
> =A0 =A0 =A0 #puts [file normalize $f]
> =A0 =A0 =A0 puts "$f exists: [file exists $f]"
> =A0 }
>
> Simply create a text file with the name "~test.txt" in the test
> folder.
>
> With the 1st puts commented, the output is:
> /usr/local/test/~test.txt exists: 0
>
> With the puts uncommented, the output is:
> /usr/local/test/~test.txt
> /usr/local/test/~test.txt exists: 1
>
> Julian-
>
> - Show quoted text -

While you didn't mention what platform you were using, I am using
SPARC Solaris 9, with tcl 8.6b1.1.
When I run a version of your script pointing to _my_ test directory,
which contains 2 files, I see:
$ ./testtil.tcl
/tmp/.lwv/test/motd exists: 1
/tmp/.lwv/test/~test.txt exists: 0
$

I suspect the above output you mentioned wasn't from your posted
script - your script has the file normalization output commented out.
However, I am seeing the same thing - a file that exists listed as if
it didn't.

here's what _I_ think is happening. Tcl sees ~test.txt and attempts to
expand the ~test into a user login directory. That directory doesn't
exist here, so the resulting path that is attempted to be used is
probably /tmp/.lwv/test/.txt which doesn't exist.  Let's test that
theory.

$ touch /tmp/.lwv/test/.txt
$ ./testtil.tcl
/tmp/.lwv/test/motd exists: 1
/tmp/.lwv/test/~test.txt exists: 0

Well, that didn't work. Hmm. Let's try a ~string that is a user on
this system. No, that doesn't work and doesn't convey to me what is
really being tried there.

I still believe that the problem is an attempt to expand that ~string
into a home directory - I just am uncertain how to prove the issue.
0
lvirden (1938)
6/15/2009 12:22:21 PM
On Jun 15, 12:22=A0pm, "Larry W. Virden" <lvir...@gmail.com> wrote:
> On Jun 14, 12:30=A0pm, JMN <neuronst...@gmail.com> wrote:
>
>
>
> > The following code demonstrates the issue more simply:
>
> > =A0 set folder {/usr/local/test/}
> > =A0 set files [glob -dir $folder -type f *]
> > =A0 foreach f $files {
> > =A0 =A0 =A0 #puts [file normalize $f]
> > =A0 =A0 =A0 puts "$f exists: [file exists $f]"
> > =A0 }
>
> > Simply create a text file with the name "~test.txt" in the test
> > folder.
>
> > With the 1st puts commented, the output is:
> > /usr/local/test/~test.txt exists: 0
>
> > With the puts uncommented, the output is:
> > /usr/local/test/~test.txt
> > /usr/local/test/~test.txt exists: 1
>
> > Julian-
>
> > - Show quoted text -
>
> While you didn't mention what platform you were using, I am using
> SPARC Solaris 9, with tcl 8.6b1.1.
> When I run a version of your script pointing to _my_ test directory,
> which contains 2 files, I see:
> $ ./testtil.tcl
> /tmp/.lwv/test/motd exists: 1
> /tmp/.lwv/test/~test.txt exists: 0
> $
>
> I suspect the above output you mentioned wasn't from your posted
> script - your script has the file normalization output commented out.
> However, I am seeing the same thing - a file that exists listed as if
> it didn't.
>
> here's what _I_ think is happening. Tcl sees ~test.txt and attempts to
> expand the ~test into a user login directory. That directory doesn't
> exist here, so the resulting path that is attempted to be used is
> probably /tmp/.lwv/test/.txt which doesn't exist. =A0Let's test that
> theory.
>
> $ touch /tmp/.lwv/test/.txt
> $ ./testtil.tcl
> /tmp/.lwv/test/motd exists: 1
> /tmp/.lwv/test/~test.txt exists: 0
>
> Well, that didn't work. Hmm. Let's try a ~string that is a user on
> this system. No, that doesn't work and doesn't convey to me what is
> really being tried there.
>
> I still believe that the problem is an attempt to expand that ~string
> into a home directory - I just am uncertain how to prove the issue.

I've opened bug # 2806250 on the sourceforge tcl project site.
Home dir substitution was my first suspicion - but I saw no evidence
of it when using puts to display the path.
If it is being substituted - then I think it must be in some internal
representation.

> I suspect the above output you mentioned wasn't from your posted
> script - your script has the file normalization output commented out.

I'm testing on FreeBSD 6.2
Perhaps my message wasn't clear.. but there are two sets of output.
a) The single line from the script as shown with the normalization
commented out
/usr/local/test/~test.txt exists: 0

b) the two lines that are output when it is run with the comment char
removed.
/usr/local/test/~test.txt
/usr/local/test/~test.txt exists: 1

ie - the presence of the [file normalize $f] call 'fixes' it.


It seems to be something internal to Tcl's handling of filenames that
has changed some time since the alpha versions of 8.5 - when it
worked.

J

0
neuronstorm (108)
6/15/2009 2:29:11 PM
On Jun 14, 4:39=A0pm, Don Porter <dgpor...@verizon.net> wrote:
> neuronst...@gmail.com wrote:
> > This problem occurs on FreeBSD with a Tcl 8.5.b1 checked out in
> > january - and also with =A08.6b1.1 from 2009-06-14
> > The bug doesn't occur when I use an 8.5a4 tclkit
>
> The time for doing anything with alpha or beta versions
> of Tcl 8.5 is long over. =A0Throw them all out.
>
> After confirming your bug in a stable release of Tcl 8.5,
> preferable 8.5.7, please report it in the tracker.
>
> DGP

Just noticed the typo in my original message - sorry - curse my
fingers,eyes and small fonts!
It should have read 8.6b1 instead of 8.5b1

"This problem occurs on FreeBSD with a Tcl 8.6.b1 checked out in
january - and also with  8.6b1.1 from 2009-06-14 "


Reported in tracker as #2806250
0
neuronstorm (108)
6/15/2009 2:37:30 PM
Reply:

Similar Artilces:

Sourcing a TCL file from within a tcl file
I am a newbie which I am sure I don't need to state :) I am trying to create a variable with a TCL file that will source another tcl file when I type the variable name something like this if I enter A through my keyboard then source a.tcl Can someone show me how to do this thanks guy On Dec 10, 1:15=A0pm, guy <gcoletta2...@gmail.com> wrote: > I am a newbie which I am sure I don't need to state :) > > I am trying to create a variable with a TCL file that will source > another tcl file when I type the variable name > > something like this > > if I enter A through my keyboard =A0then source a.tcl > > Can someone show me how to do this > > thanks > guy What you are asking is not hard. Will your program have a graphical user interface? Aric On Dec 10, 3:26=A0pm, Aric Bills <aric.bi...@gmail.com> wrote: > On Dec 10, 1:15=A0pm, guy <gcoletta2...@gmail.com> wrote: > > > I am a newbie which I am sure I don't need to state :) > > > I am trying to create a variable with a TCL file that will source > > another tcl file when I type the variable name > > > something like this > > > if I enter A through my keyboard =A0then source a.tcl > > > Can someone show me how to do this > > > thanks > > guy > > What you are asking is not hard. =A0Will your program have a graphical > user interface? > > Aric no I am just using this script...

read file after EOF in Tcl 8.6
Hello! My program repeats attempts to read file after EOF condition appeared on it. The program looks for any new lines appended to that file. The program works with Tcl 8.5, but it doesn't see any new lines with Tcl 8.6. What can be wrong? Please help. Here's the test: $ cat read-after-eof.tcl puts "Tcl patchlevel: [info patchlevel]" set h [open ./read-after-eof.txt] read $h set text [clock seconds] exec cat >>./read-after-eof.txt << $text puts "gets after EOF returns: '[gets $h]'" $ echo "" >read-after-eof....

Tcl file from .txt file
Hi, I have a excel file. I need to change the excel file in to tcl file. I did = change the excel file in to txt file. but unable to change the txt file in = to tcl file. let me know any idea to change the txt file in to tcl file or = directly from the excel file in to tcl file.=20 your help is much more appreciated. thank you. On 11/14/14, 1:30 PM, yenilsuwal@gmail.com wrote: > Hi, > > I have a excel file. I need to change the excel file in to tcl file. I did change the excel file in to txt file. but unable to change the txt file in to tcl file. let me know any idea to c...

Bug789040 came back in Tcl 8.4.6 and Tcl 8.5.
Dear All, Bug 789040 caused exec error in Windows 9x and was fixed in 10/04/03. But it came back in Tcl 8.4.6 and Tcl 8.5. Tcl Windows 9x users should be alerted to the possible failure of exec in the current Tcl 8.4.6 and 8.5 releases due to this bug. Chengye Mao http://www.geocities.com/~chengye Chengye Mao wrote: > Bug 789040 caused exec error in Windows 9x and was fixed in 10/04/03. > But it came back in Tcl 8.4.6 and Tcl 8.5. Tcl Windows 9x users > should be alerted to the possible failure of exec in the current Tcl > 8.4.6 and 8.5 releases due to this bug. Have you i...

Tcl interaction with .bat files
Hi ! Using Tcl, I have tried to interact with Win32 .bat files. Generally speaking, Expect does the job pretty nicely, but a Tcl-only implementation seems to work as well. I 've ended up writing the code below. Could anyone tell me whether this implementation is robust enough ? proc interactWithBat { fileName condActs finalCondAct echoOn } { set ioBat [open |$fileName r+] set goOn 1 while { $goOn } { if { [gets $ioBat line] < 0 } { break } else { if { $echoOn } { puts $line } foreach condAct $condActs { lassign $condAct cond act if { $line eq $cond } { puts $ioBat $act flush $ioBat } } lassign $finalCondAct cond act if { ($line ne "") && ($line eq $cond) } { if { $act != {} } { eval $act } set goOn 0 } } } catch {close $ioBat} ; # Process can be dead ! if { $echoOn } { puts "$fileName executed." ...

"no such file or directory" when executing tcl file
Hi, new to TCL and hitting a road bump right out the gate. I just installed ActiveTcl 8.5 on my Windows XP SP2 machine. I made the following script and saved it as test.tcl: #!/usr/local/bin/tclsh puts stdout {Hello, Patrick!} When in the TCL command prompt, I type test.tcl and it gives me the error "couldn't execute ".\test.tcl": no such file or directory". I am in the correct directory so I'm pretty lost as to why it is saying this. Here are my exact steps: <open command prompt> H:\workspaces\tcl>tclsh85 % dir Volume in drive H is Data Volume Serial Number is 828C-6076 Directory of H:\workspaces\tcl 01/12/2009 05:23 PM <DIR> . 01/12/2009 05:23 PM <DIR> .. 01/12/2009 05:37 PM 31 test.tcl 1 File(s) 31 bytes 2 Dir(s) 41,173,749,760 bytes free % test.tcl couldn't execute ".\test.tcl": no such file or directory If someone could help fill in the blanks here, I'd appreciate it. Apparently I'm overlooking something obvious. Thanks, Patrick On Jan 13, 12:43=A0am, "Patrick H." <patri...@gmail.com> wrote: > Hi, new to TCL and hitting a road bump right out the gate. I just > installed ActiveTcl 8.5 on my Windows XP SP2 machine. I made the > following script and saved it as test.tcl: > > #!/usr/local/bin/tclsh > puts stdout {Hello, Patrick!} > > When in the TCL command prompt, I type...

Dose there any tcl script to translate an file with embedded tcl
Hi I need to generate some big file, but there are rules for generate these files Ex . ============================== Start input a [0] wire input a [1] wire .. .. .. .. input a [1000] wire End ================================= Dose there any tcl script can help to translate a file with embedded tcl script into a new file For example this is a source file ======================== Start * set i 0 * for { set i 0 } { $i < 1000 } { incr i } { * puts input a [$i] wire * } End ========================== After Translate ======================= Start input a [0] wire input a [1] wire .. .. ...

How to write tcl generated xml file into a new file
Hi, I have generated a xml file using xmlgen. After running the tcl script the ouput is displayed on the terminal . I want to take the terminal output into a xml file. Any Suggestion ???/ Thanks Ranjan On Nov 25, 12:46=A0pm, gyana behera <ranjan....@gmail.com> wrote: > Hi, > > I have generated a xml file using xmlgen. > After running the tcl script the ouput is displayed on the terminal . > I want to take the terminal output into a xml file. > > Any Suggestion ???/ > > Thanks > Ranjan Either redirect the output of the script to the xml-file. (xmlgen > output.xml) or open the file in the script: set f [open $filename w] then use puts $f instead of puts to output to the file and finally close the file: close $f Note that all this is covered in the Tcl tutorial, which is definitely worth a visit. (http://www.tcl.tk/man/tcl8.5/tutorial/ tcltutorial.html) Mark ...

Tcl interaction with .bat files #2
Hi ! Using Tcl, I have tried to interact with Win32 .bat files. Generally speaking, Expect does the job pretty nicely, but a Tcl-only implementation seems to work as well. I 've ended up writing the code below. Could anyone tell me whether this implementation is robust enough ? proc interactWithBat { fileName condActs finalCondAct echoOn } { set ioBat [open |$fileName r+] while { 1 } { if { [gets $ioBat line] < 0 } { break } else { if { $echoOn } { puts $line } foreach condAct $condActs { lassign $condAct cond act if { $line eq $cond } { puts $ioBat $act flush $ioBat } } lassign $finalCondAct cond act if { ($line ne "") && ($line eq $cond) } { if { $act != {} } { eval $act } break } } } catch {close $ioBat} ; # Process can be dead ! if { $echoOn } { puts "$fileName executed." } On 9 jan, 18:24, Thomas...

How to capture the output from TCL prompt and save it to a file on Linux file system.
Hello All, I login to TCL prompt and run a simple query which lists few rows. I want to capture those rows and save it to a file on file system. I am working on a Sun Solaris ver. 5.9. Here is the sample query that i run from TCL prompt: >SELECT DISTINCT CATEGORY FROM DS_JOBS; And the Resultant set looks like this: Category............ ABC\ACEIQ\JOBS\C UST_SPCLTY ABC\ACEIQ\JOBS\C UST_SPC SSHIP\SEQ PLIC\CNTRL Any advise is greatly appreciated. Thanks Vini On Mar 22, 7:26=A0pm, Vini <vinay.renukun...@gmail.com> wrote: > Hello All, > > I login to TCL prompt and run a simple query which lists few rows. I > want to capture those rows and save it to a file on file system. I am > working on a Sun Solaris ver. 5.9. > > Here is the sample query that i run from TCL prompt: > > >SELECT DISTINCT CATEGORY FROM DS_JOBS; > > And the Resultant set looks like this: > > Category............ > > ABC\ACEIQ\JOBS\C > UST_SPCLTY > ABC\ACEIQ\JOBS\C > UST_SPC > SSHIP\SEQ > PLIC\CNTRL > > Any advise is greatly appreciated. Wrong group. You mean "SQL" rather than "TCL". -Alex On Mar 22, 2:30=A0pm, Alexandre Ferrieux <alexandre.ferri...@gmail.com> wrote: > On Mar 22, 7:26=A0pm, Vini <vinay.renukun...@gmail.com> wrote: > > > > > > > > > > > Hello All, > > > I login to TCL prompt and run a simple query which lists few rows. I > > want...

Creating a TCL Channel from a C FILE* giving strange file handles
Hey Everybody! Having a problem with the Tcl C Library calls I cant seem to= figure out. I'm trying to create a channel from opened FILE *, and use it = in a TCL script that sources the module. So, what I am running so far is: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D int openCFileCmd(ClientData clientData,=20 Tcl_Interp *interp, int objc, Tcl_Obj *CONST o= bjv[])=20 ...

tcl-inotify: File & directory level notifications for Tcl. (extension)
This is an announcement for a relatively new Tcl project: tcl-inotify. Tcl-inotify is a Tcl interface to the linux kernel's inotify* service. It provides a Tcl package that enables Tcl scripts to monitor the file system changes at a file and directory level. A large number of file/directory actions can be monitored. A proc is executed asynchronously to notify for changes. * inotify is a Linux kernel subsystem that provides file system event notifications. It was written by John McCutchan with help from Robert Love and later Amy Griffis to replace dnotify. It was included in the mainline kernel starting from release 2.6.13, and could be compiled into 2.6.12 and possibly earlier releases by use of a patch. Its function is essentially an extension to filesystems to notice changes to the filesystem, and report those changes to applications. Home page: http://sourceforge.net/projects/tcl-inotify/ Man page: http://tcl-inotify.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

TCL/PHP/XML problem: I need to convert an XML file into a TCL list
My TCL proc, XML_GET_ALL_ELEMENT_ATTRS, is supposed to convert an XML file into a TCL list as follows: attr1 {val1} attr2 {val2} ... attrN {valN} This is the TCL code that does this: [TCL] set contents [read $fileID [file size ${fileName}.xml]]; close $fileID if {![string equal $switch -body]} { # ONLY DO THIS IF THE XML CONTENTS CONTAIN NO BODY - WILL UPGRADE AT A LATER DATE 11/24/2006 - PHIL global serverName if {![info exists serverName]} { global env source ./cgi_globals.tcl global serverName } if {[string length [info procs {URL_ENCODE}]] == 0} { source...

Komodo: Accessing widgets in the auto generated _ui.tcl from the associated .tcl file
I am using Komodo. I created a text widget and want to insert some text into it. The below is my ui.tcl file (ie. Dialog_ui.tcl). In my Dialog.tcl file I want to have access to the $base._text_log widget, so I can insert text into it. For eg. I've tried: ::Dialog::._text_log insert end "hello world!" And other variations, but have not succeeded. This seems to be something trivial, but I can't seem to figure it out. I also tried to get to the BASE variable, but was also unsuccessful. I guess my understanding of namespaces isn't correct. Is it even possible? Help is...

Can I compile a tcl/tk extended C file into an exe file on windows?
I'm new to tcl/tk. I have a simple tk/tcl extended C file like this, #include <stdio.h> #include <stdlib.h> #include <tcl.h> #include <tk.h> int Tcl_AppInit(Tcl_Interp* interp) { int status; status = Tcl_Init(interp); if (status != TCL_OK) { return TCL_ERROR; } /* Initialize Tk values. */ status = Tk_Init(interp); if (status != TCL_OK) { return TCL_ERROR; } return TCL_OK; } int main(int argc, char** argv) { Tk_Main(argc, argv, Tcl_AppInit); return 0; } Can I compile this file into an exe file on windows? How? Thank you ysrise@gmail.com (yan) writes: [snip[ ...

Append a file to an existing file
Hi there I am wondering if there is a simple command in Tcl that I can append a file to an existing file, or combine two files into one file ? Thanks for the help. Regards S-Y. Chen S-Y. Chen wrote: > Hi there > > I am wondering if there is a simple command in Tcl that I can append a > file to an existing file, or combine two files into one file ? > > > Thanks for the help. > > Regards > S-Y. Chen > Here's one way... - [open] fileA in append mode - [open] fileB in read only mode - [read] the contents of fileB and write it to fileA using [puts] - [close] both files So, the man pages on [open], [read], [puts], and [close] should give you all you need. Jeff On Aug 4, 12:45=A0am, Jeff Godfrey <jeff_godf...@pobox.com> wrote: > S-Y. Chen wrote: > > Hi there > > > I am wondering if there is a simple command in Tcl that I can append a > > file to an existing file, or combine two files into one file ? > > > Thanks for the help. > > > Regards > > S-Y. Chen > > Here's one way... > > - [open] fileA in append mode > - [open] fileB in read only mode > - [read] the contents of fileB and write it to fileA using [puts] > - [close] both files > > So, the man pages on [open], [read], [puts], and [close] should give you > all you need. > > Jeff I know I can do it through open, read and close.....just want to see if there is a command like copy a+b...

file exists / file not found
While playing with some code for another thread, I discovered that among the BASIC language diagnostics was the text FILE NOT FOUND. I am unable to find FILE EXISTS among the BASIC diagnostics. When I attempt a load of a non existent file, the drive error light blinks and the system issues a FILE NOT FOUND diagnostic. When I try to save data with a name of a file already on the disk, the drive error light blinks but no diagnostic is issued by the system. In both cases, the drive needs to be queried to retrieve the drive's diagnostic and to stop the drive error light from blinking. I ha...

Does anyone have a Tcl Script which does a Multi Part File Upload to web site ( TCL CGI )
Hello all, I am after a Tcl script which I can use on my apache Linux server which a user can upload files or pictures to the site with ... Any help is appreciated, Thank you for the help, Sean - HeliHobby.com Sean wrote: > Hello all, > > I am after a Tcl script which I can use on my apache Linux server > which a user can upload files or pictures to the site with ... > > Any help is appreciated, > > Thank you for the help, > > Sean - HeliHobby.com I use ncgi for ths (from tcllib). It rocks! high quality code that never fails. For instance the file upload...

Speed problem with Tcl 8.4 and file operations
Hello Tcl user and developer, I study the newsgroup that other user have the same problem with the speed to open files, source, package require and other file operations with Tcl 8.4. But I don't found a solution for the problem. The problem seems the virtual file system in Tcl 8.4. My problem with the performance is Windows NT and the installation is on a mounted file system and than the performance is very terrible. I have the same program running with SUN Solaris 2.8 on a mounted drive the performance is ok. My program have a lot off packages and tcl source. Is it possible to deac...

Binary reader speed comparison
I have a fairly simple binary reader proc that exhibits massive speed differences between Tcl 8.5.8 and Tcl8.6b1.1. Here's the proc: proc readFormatted {filename} { set fd [ open $filename r ] fconfigure $fd -encoding binary -translation binary binary scan [ read $fd 2 ] cc type nextlen if {$type != 75} { return -error "File is not in the expected format" } while {![append buffer [read $fd $nextlen] ; eof $fd]} { binary scan [read $fd 2] cc lastlen nextlen # convert to unsigned value set nextlen ...

Tcl 8.6, ActiveTcl 8.6 & linux Fedora 16 (64 bit)...
Hi all, Just a quick note about installing ActiveTcl 8.6 under Fedora 16, 64 bit. Downloading ActiveTcl 8.6 and trying to run the installer, fails. The reason is that libXss.so, is missing from the system, and Tk seems to need this. The problem can be "resolved" by installing the package "libXScrnSaver". But there is no such package for Fedora 16, and (thankfully) the package gets installed from Fedora 15. Maybe this is a "sign" that libXss.so will disappear in the (near?) future... George PS: Also the mysql TDBC driver crashes, as the shared library has evolved to version 18 (and the sources try to load versions 15 & 16). Changing the sources to also load .18 fixes the problem. (But I would prefer an error message than a core dump...) ...

HD file system corrupted after delete file on a share file on Solaris 8
Hi , I installed Samba 2.2.8a on a sparc system Solaris 8 and all works except when I delete a file or a folder into the share file with a windows 2000 pro, the HD ufs file system fall into a corrupt state and if I pass fsck on the disk it report some UNREF DIR on pass 3 and LINK COUNT problem on pass 4. What could be the problem ? I changed the HD and I have the same problem. Please help and thanks for your help Dano ...

Open files? Closed files? in 8.0/8.5
Hi there- I'm finally going to upgrade my company's version from 5.5/6 to 8.0/8.5 and so I'm learning a lot. One thing that is currently a mystery is the question of when exactly a file is open and when it is closed. I have done testing with the design functions that give me a list of open files, and often I can't get files to close, even with a blank layout showing, and the use of the Close File script step. Do I care? I see the benefit of separating the windows from the files--I've been trying to stop my users from closing files for years...now it looks like I don...

Btreive 6.15 files not Btreive 6.15 files
I have an application that is currently using Btreive 6.15 for their data. However when I attempt to open them BTS tells me that they arn't betrieve files. Any ideas?!?! -- Francis I. Coppage, Jr. "Data! Data! Data! I need data, I can't make bricks without clay!" -- Sherlock Holmes Francis I. Coppage Jr. via DBMonster.com wrote: > I have an application that is currently using Btreive 6.15 for their > data. However when I attempt to open them BTS tells me that they > arn't betrieve files. Any ideas?!?! Check the first 4 bytes of the file with a hex editor...

TCL glob/file exists vs stale NFS handles
Hi, Long story short, the company I work for uses Rational ClearCase which allows our files to be mounted on NFS stores. I'm working on something unique to the company at the moment -- opening/comparing CSV file data. However, something is erroneous with the NFS mount and IT feels that it's not a problem. The trouble is, these stale NFS handles do not play well with TCL's ability to located/use these files. Doing something like if { [file exists <blah.csv>] } ... returns true, and so it continues. However, only the file handle in the directory (linux, by the w...

Web resources about - Tcl 8.6 unexpected 'file exists' - 'file normalize' interaction - comp.lang.tcl

Resources last updated: 3/13/2016 11:34:55 AM