public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* expect and tclsh give different output from "clock scan"
@ 2004-12-22 17:20 Brad Gutt
  2005-01-05 23:14 ` Keith Seitz
  0 siblings, 1 reply; 6+ messages in thread
From: Brad Gutt @ 2004-12-22 17:20 UTC (permalink / raw)
  To: insight

Hi,
 
I'm posting this to this group since the cygwin
announce email posting for expect stated that expect
in cygwin was bundled up by Insight people at Red Hat.
 Let me know if I should take this elsewhere...
 
The "clock scan <format>" command inside tclsh returns
a different number when executed from within tclsh
versus expect.  This is running on a Windows 2000
laptop running under Cygwin.  The time numbers I am
expecting are for my local time since I am not
specifying a timezone.  Check out this transcript:
 
$ tclsh
set dailyTime 5pm
puts [clock scan "today $dailyTime"]
1103763600
exit
$ expect
set dailyTime 5pm
puts [clock scan "today $dailyTime"]
1103767200
exit
$ expect -v
expect version 5.26
$ tclsh
puts "tcl_version $tcl_version"
tcl_version 8.4
puts [info patchlevel]
8.4.1
exit
$ expect -d
expect version 5.26
argv[0] = /bin/expect  argv[1] = -d  
set argc 0
set argv0 "/bin/expect"
set argv ""
executing commands from command file
puts "tcl_version $tcl_version"
tcl_version 8.4
puts [info patchlevel]
8.4.1
exit
 
 
Thinking it could be fixed with the -gmt switch, I
tried the following, and got the same numbers from
clock scan, but got slightly different output from
clock format:
 
$ /bin/expect
puts [clock scan "today 5pm" -gmt 1]
1103734800
set thetime [clock scan "today 5pm" -gmt 1]
puts [clock format "$thetime" -gmt 1 ]
Wed Dec 22 17:00:00 PST 2004
exit
$ /bin/tclsh
puts [clock scan "today 5pm" -gmt 1]
1103734800
set thetime [clock scan "today 5pm" -gmt 1]
puts [clock format "$thetime" -gmt 1 ]
Wed Dec 22 5:00:00 PM GMT 2004
exit

It is notable that clock format spits out an army time
under expect, but spits out a non-army time for tclsh.
 
So, why is the output of clock scan different between
expect and tclsh?  Isn't expect using the same code as
tclsh is using?  
 
thanks!
Brett Gutt



		
__________________________________ 
Do you Yahoo!? 
Take Yahoo! Mail with you! Get it on your mobile phone. 
http://mobile.yahoo.com/maildemo 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: expect and tclsh give different output from "clock scan"
  2004-12-22 17:20 expect and tclsh give different output from "clock scan" Brad Gutt
@ 2005-01-05 23:14 ` Keith Seitz
  2005-01-09 21:52   ` Brad Gutt
  0 siblings, 1 reply; 6+ messages in thread
From: Keith Seitz @ 2005-01-05 23:14 UTC (permalink / raw)
  To: Brad Gutt; +Cc: insight

On Wed, 2004-12-22 at 09:20, Brad Gutt wrote:

> So, why is the output of clock scan different between
> expect and tclsh?  Isn't expect using the same code as
> tclsh is using?  

No, as a matter of fact, they are not using the same code. Expect on
cygwin is a "unix" application, i.e., it uses cygwin's posix layer to
call time() (from tclUnixTime.c):

expect1.1> set ::tcl_platform(platform)
unix

tclsh84> set ::tcl_platform(platform)
windows

On windows, it uses some goofy windowsy thing in tclWinTime.c to get the
time.

My guess is that cygwin/unix code and the windows code use different
epochs.

Keith

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: expect and tclsh give different output from "clock scan"
  2005-01-05 23:14 ` Keith Seitz
@ 2005-01-09 21:52   ` Brad Gutt
  2005-01-10  1:20     ` Christopher Faylor
  0 siblings, 1 reply; 6+ messages in thread
From: Brad Gutt @ 2005-01-09 21:52 UTC (permalink / raw)
  To: Keith Seitz; +Cc: insight

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 1694 bytes --]

Thanks Keith.  Wow! The Expect binary and the Tcl
binary that I'm using on my PC are both coming from
the same version of Cygwin, and therefore the response
of ::tcl_platform(platform) being different is even a
more serious flaw than the issue with "clock scan"!  I
expect (pardon the pun) that Expect should be using
the exact same source code as Tcl, in fact, I would
have expected Expect to just use Tcl as a
library/framework and just add Expect-specific Tcl C
commands and procs to supply additional functionality,
just like normal Tcl based applications.  Is it that
Expect has an old copy of Tcl source in its tree? If
so, do you or anyone know why that is? Or, better yet,
is there some Expect-specific mailing list in which I
can investigate this problem further, so as to not
bother the insight group with this?

Thanks!
Brett

--- Keith Seitz <keiths@redhat.com> wrote:

> On Wed, 2004-12-22 at 09:20, Brad Gutt wrote:
> 
> > So, why is the output of clock scan different
> between
> > expect and tclsh?  Isn't expect using the same
> code as
> > tclsh is using?  
> 
> No, as a matter of fact, they are not using the same
> code. Expect on
> cygwin is a "unix" application, i.e., it uses
> cygwin's posix layer to
> call time() (from tclUnixTime.c):
> 
> expect1.1> set ::tcl_platform(platform)
> unix
> 
> tclsh84> set ::tcl_platform(platform)
> windows
> 
> On windows, it uses some goofy windowsy thing in
> tclWinTime.c to get the
> time.
> 
> My guess is that cygwin/unix code and the windows
> code use different
> epochs.
> 
> Keith
> 
> 



		
__________________________________ 
Do you Yahoo!? 
All your favorites on one personal page – Try My Yahoo!
http://my.yahoo.com 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: expect and tclsh give different output from "clock scan"
  2005-01-09 21:52   ` Brad Gutt
@ 2005-01-10  1:20     ` Christopher Faylor
  2005-02-20  7:29       ` Brad Gutt
  0 siblings, 1 reply; 6+ messages in thread
From: Christopher Faylor @ 2005-01-10  1:20 UTC (permalink / raw)
  To: insight

On Sun, Jan 09, 2005 at 01:52:13PM -0800, Brad Gutt wrote:
>Thanks Keith.  Wow! The Expect binary and the Tcl binary that I'm using
>on my PC are both coming from the same version of Cygwin, and therefore
>the response of ::tcl_platform(platform) being different is even a more
>serious flaw than the issue with "clock scan"! I expect (pardon the
>pun) that Expect should be using the exact same source code as Tcl, in
>fact, I would have expected Expect to just use Tcl as a
>library/framework and just add Expect-specific Tcl C commands and procs
>to supply additional functionality, just like normal Tcl based
>applications.  Is it that Expect has an old copy of Tcl source in its
>tree?  If so, do you or anyone know why that is?  Or, better yet, is
>there some Expect-specific mailing list in which I can investigate this
>problem further, so as to not bother the insight group with this?

Keith's analysis of the situation is correct.  expect uses a unix-like
version of tcl and insight uses a windows version of tcl with hooks for
cygwin.

Using the cygwin version of tcl for expect allows expect to use select,
ptys, and other unix-isms.  Using the windows version for insight allows
insight to draw windows on the screen.

This is a fact of life.  It isn't going to change no matter what mailing
list you discuss it in.

cgf
--
Christopher Faylor			spammer? ->	aaaspam@sourceware.org
Cygwin Co-Project Leader				aaaspam@duffek.com
TimeSys, Inc.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: expect and tclsh give different output from "clock scan"
  2005-01-10  1:20     ` Christopher Faylor
@ 2005-02-20  7:29       ` Brad Gutt
  2005-02-21 16:16         ` Christopher Faylor
  0 siblings, 1 reply; 6+ messages in thread
From: Brad Gutt @ 2005-02-20  7:29 UTC (permalink / raw)
  To: insight

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 2114 bytes --]

Thanks Christopher.  I think that for my purposes, I
would want to do
the same thing as you (or someone) have done in the
Insight build
environment, it is just that I am a bit lost on how
Insights build
configuration goes about it.

What I am after is getting a version of Expect that
matches Tcl in
every way possible, even if it is a "windows version"
similar to what
Insight uses.  Here is what I think happens, and tell
me where I am wrong:

  If I have a Windows 2000 machine, and build Insight
from source
  using Cygwin, I issue the ./configure <flags>
command from the
  Cygwin shell.  When Insight is built, Tcl is built
and also Expect
  is built.  I am believing that those versions of Tcl
and Expect are
  the "windows versions" you spoke of simply because
they are built on
  a Windows machine AND because of some special
<flags> that are given
  to the ./configure switch to turn off any of the
unix-like behaviors
  Keith spoke of, which means avoiding use of the
posix layer and
  instead using the "goofy windowsy things".

If that is the case, then when I issue the "set
::tcl_platform(platform)" command to those versions of
Expect and Tcl,
both of those executables should return "windows". If
so, that is
exactly what I need, then all I would need to know now
is what are the
<flags> given to ./configure to make all of that
happen?

Thanks for all your help,
Brad

BTW, the cvs branch I'm looking at is gdb_5_2-branch,
cvs module is
insight+dejagnu

--- Christopher Faylor <me@cgf.cx> wrote:
> Keith's analysis of the situation is correct. 
> expect uses a unix-like
> version of tcl and insight uses a windows version of
> tcl with hooks for
> cygwin.
> 
> Using the cygwin version of tcl for expect allows
> expect to use select,
> ptys, and other unix-isms.  Using the windows
> version for insight allows
> insight to draw windows on the screen.
> 
> This is a fact of life.  It isn't going to change no
> matter what mailing
> list you discuss it in.



		
__________________________________ 
Do you Yahoo!? 
All your favorites on one personal page – Try My Yahoo!
http://my.yahoo.com 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: expect and tclsh give different output from "clock scan"
  2005-02-20  7:29       ` Brad Gutt
@ 2005-02-21 16:16         ` Christopher Faylor
  0 siblings, 0 replies; 6+ messages in thread
From: Christopher Faylor @ 2005-02-21 16:16 UTC (permalink / raw)
  To: Brad Gutt, insight

On Sat, Feb 19, 2005 at 11:28:59PM -0800, Brad Gutt wrote:
>Thanks Christopher.  I think that for my purposes, I would want to do
>the same thing as you (or someone) have done in the Insight build
>environment, it is just that I am a bit lost on how Insights build
>configuration goes about it.
>
>What I am after is getting a version of Expect that matches Tcl in
>every way possible, even if it is a "windows version" similar to what
>Insight uses.

Just in case you're expecting an answer from me -- I implemented or oversaw
the implementation of the full cygwin port of expect for cygwin.  I surely
don't want to worry about how to implement this outside of cygwin.

Other than that, I can't see how this is a discussion for either the cygwin
or the insight mailing lists.  The fact that Insight uses tcl doesn't mean
that you can use it as a basis for a pure windows port.

AFAIK and FWIW, expect has a native windows port these days.

Anyway, you will undoubtedly have more luck in a windows forum, possibly
a mingw forum: www.mingw.org .

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-02-21 16:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-22 17:20 expect and tclsh give different output from "clock scan" Brad Gutt
2005-01-05 23:14 ` Keith Seitz
2005-01-09 21:52   ` Brad Gutt
2005-01-10  1:20     ` Christopher Faylor
2005-02-20  7:29       ` Brad Gutt
2005-02-21 16:16         ` Christopher Faylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).