Skip to Content.
Sympa Menu

freetds - [freetds] time parsing

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Joachim Wieland <joe AT mcknight.de>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] time parsing
  • Date: Fri, 22 Jul 2005 11:08:23 +0200

Hi there,

thanks for freetds!

I use it since 2 years and today I ran into a problem with 0.63 (from the
debian package - I ran 0.61 before and it had the same problem):

I'm reading a record with a datetime and I don't know why but a special row
seems to contain garbage at the end:

src=0xbfffe030 "Di 10 Mai 2005 14:03:43 š%S\bhàÿ¿ËÍî·8"
(german locale)

Then the parsing routine set the timezone to an illegal value:

tm = {tm_sec = 43, tm_min = 3, tm_hour = 14, tm_mday = 10, tm_mon = 4,
tm_year = 105, tm_wday = 2, tm_yday = 130, tm_isdst = 0, tm_gmtoff = 420,
tm_zone = 0x2b <Address 0x2b out of bounds>}

and the program crashed with a segmentation fault. What I did is to set the
timezone explicitly. I did a call to tzset() and set tm.tm_zone = tzname[0]
in convert.c in tds_strftime().

I don't know if the problem is somewhere else such that this crazy timestamp
gets through at all but tm_zone did not get initialized and it should be...
It seems to be a gnu extension however (I'm running debian sarge on i386).

I attach a more detailed gdb output below.

A TDSDUMP-log (from another example however) is attached as well.

I have another question: Is there any way I can set a different datestyle
than via locale? The problem is that if you follow your locale the sql
server might not recognize this input (i.e. its own output) as a valid date
format which is pretty annoying... What do you think about this problem?


Joachim




Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1209740544 (LWP 2082)]
0xb7f17f64 in strftime () from /lib/tls/libc.so.6
(gdb) bt
#0 0xb7f17f64 in strftime () from /lib/tls/libc.so.6
#1 0xb7d48a5f in tds_strftime (
buf=0xb7f99028
"\001£öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿ9¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿ"...,
maxsize=30, format=0x0, dr=0xbfffe000) at convert.c:2802
#2 0xb7d46395 in tds_convert_datetime (tds_ctx=0xb7f99028, srctype=61,
src=0xbfffe030 "Di 10 Mai 2005 14:03:43 š%S\bhàÿ¿ËÍî·8", desttype=47,
cr=0xbfffe0e0) at convert.c:1286
#3 0xb7d46d2d in tds_convert (tds_ctx=0x8367310, srctype=137786128,
src=0x8534e44 "P\226", srclen=43, desttype=47, cr=0xbfffe0e0)
at convert.c:1678
#4 0xb7d34ccd in cs_convert (ctx=0x8367278, srcfmt=0xbfffe220,
srcdata=0x8534e44, destfmt=0xbfffe170, destdata=0x8531e40,
resultlen=0xbfffe16c) at cs.c:485
#5 0xb7d30ddc in _ct_bind_data (ctx=0x8367278, resinfo=0x8532d08,
bindinfo=0x8532d08, offset=0) at ct.c:1502
#6 0xb7d30845 in ct_fetch (cmd=0x8532ac8, type=-1208381400,
offset=-1208381400, option=-1208381400, rows_read=0xbfffe388) at ct.c:1301
#7 0xb7d8835d in syb_st_fetch () from
/usr/lib/perl5/auto/DBD/Sybase/Sybase.so
#8 0xb7d7b4df in XS_DBD__Sybase__st_fetchrow_arrayref ()
from /usr/lib/perl5/auto/DBD/Sybase/Sybase.so
#9 0xb7da5b30 in XS_DBI_dispatch () from /usr/lib/perl5/auto/DBI/DBI.so
#10 0x080c32d6 in Perl_pp_entersub ()
#11 0x080bbdc9 in Perl_runops_standard ()
#12 0x080640c9 in Perl_call_sv ()
#13 0x08063fe5 in Perl_call_sv ()
#14 0xb7dad1cd in XS_DBD_____st_fetchrow_hashref ()
from /usr/lib/perl5/auto/DBI/DBI.so
#15 0xb7da5b30 in XS_DBI_dispatch () from /usr/lib/perl5/auto/DBI/DBI.so
#16 0x080c32d6 in Perl_pp_entersub ()
#17 0x080bbdc9 in Perl_runops_standard ()
#18 0x080635e8 in perl_run ()
#19 0x080633f5 in perl_run ()
#20 0x0805fb9f in main ()
(gdb) up 1
#1 0xb7d48a5f in tds_strftime (
buf=0xb7f99028
"\001£öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿ9¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿØ¡öÿ"...,
maxsize=30, format=0x0, dr=0xbfffe000) at convert.c:2802
warning: Source file is more recent than executable.

2802
(gdb) info locals
tm = {tm_sec = 43, tm_min = 3, tm_hour = 14, tm_mday = 10, tm_mon = 4,
tm_year = 105, tm_wday = 2, tm_yday = 130, tm_isdst = 0, tm_gmtoff = 420,
tm_zone = 0x2b <Address 0x2b out of bounds>}
length = 0
s = 0x5a <Address 0x5a out of bounds>
our_format = 0x8535a58 "%a %d %b %Y %T %Z"
millibuf = "\000\000\000\000\vËØ·"
pz = 0x0
(gdb)

Starting log file with debug level 99.
2005-07-22 10:45:57.161281 iconv will convert client-side data to the
"ISO-8859-15" character set


....


2005-07-22 10:45:57.369739 ct_send() succeeded
2005-07-22 10:45:57.369752 inside ct_results()
Received header @ 2005-07-22 10:45:57.370206
0000 04 01 00 5f 00 46 01 00 |..._.F..|


Received packet @ 2005-07-22 10:45:57.370226

... changing of context successful ...

2005-07-22 10:45:57.370264 processing result tokens. marker is e3(ENVCHANGE)
2005-07-22 10:45:57.370277 inside tds_process_default_tokens() marker is
e3(ENVCHANGE)
2005-07-22 10:45:57.370291 processing result tokens. marker is ab(INFO)
2005-07-22 10:45:57.370303 inside tds_process_default_tokens() marker is
ab(INFO)
2005-07-22 10:45:57.370320 processing result tokens. marker is fd(DONE)
2005-07-22 10:45:57.370347 inside tds_process_end() more_results = 0,
was_cancelled = 0
2005-07-22 10:45:57.370361 inside ct_results() process_result_tokens returned
1 (type 4047)
2005-07-22 10:45:57.370374 inside ct_results()
2005-07-22 10:45:57.370385 inside tds_process_result_tokens() state is
COMPLETED
2005-07-22 10:45:57.370397 inside ct_results() process_result_tokens returned
2 (type 4046)
2005-07-22 10:45:57.370411 inside ct_cmd_drop()
2005-07-22 10:46:02.405462 inside ct_cmd_alloc()
2005-07-22 10:46:02.405497 inside ct_command()
2005-07-22 10:46:02.405515 inside ct_cmd_props() action = CS_GET property = 51
2005-07-22 10:46:02.405535 inside ct_send()
Sending packet @ 2005-07-22 10:46:02.405555
0000 01 01 00 4a 00 00 00 00 73 65 6c 65 63 74 20 63 |...J.... select c|
0010 72 65 61 74 65 64 61 74 65 20 66 72 6f 6d 20 74 |reatedat e from t|
0020 62 6c 5f 64 6f 6d 61 69 6e 73 5f 64 6e 73 7a 6f |bl_domai ns_dnszo|
0030 6e 65 73 5f 74 65 73 74 20 77 68 65 72 65 20 69 |nes_test where i|
0040 64 20 3d 20 35 39 36 34 31 0a |d = 5964 1.|


2005-07-22 10:46:02.405601 ct_send() succeeded
2005-07-22 10:46:02.405616 inside ct_results()
Received header @ 2005-07-22 10:46:02.406185
0000 04 01 00 30 00 46 01 00 |...0.F..|


Received packet @ 2005-07-22 10:46:02.406206
0000 a0 0b 00 0a 63 72 65 61 74 65 64 61 74 65 a1 05 | ...crea tedate¡.|
0010 00 0c 00 08 00 3d d1 31 94 00 00 00 c8 af 00 fd |.....=Ñ1 ....ȯ.ý|
0020 10 00 c1 00 01 00 00 00 |..Á.....|


2005-07-22 10:46:02.406232 processing result tokens. marker is a0(COLNAME)
2005-07-22 10:46:02.406249 processing result tokens. marker is a1(COLFMT)
2005-07-22 10:46:02.406263 processing result. type = 61(datetime),
varint_size 0
2005-07-22 10:46:02.406277 inside ct_results() process_result_tokens returned
1 (type 4049)
2005-07-22 10:46:02.406291 processing result tokens. marker is d1(ROW)
2005-07-22 10:46:02.406308 inside ct_results() process_result_tokens returned
1 (type 4040)
2005-07-22 10:46:02.406324 inside ct_res_info()
2005-07-22 10:46:02.406335 ct_res_info(): Number of columns is 1
2005-07-22 10:46:02.406350 inside ct_describe()
2005-07-22 10:46:02.406362 inside _ct_get_client_type(type 61, size 8)
2005-07-22 10:46:02.406374 inside ct_describe() datafmt->datatype = 6 server
type 61
2005-07-22 10:46:02.406391 inside cs_convert()
2005-07-22 10:46:02.406403 inside _ct_get_server_type(1)
2005-07-22 10:46:02.406418 inside _ct_get_server_type(6)
2005-07-22 10:46:02.406430 inside cs_convert() srctype = 47 (24) desttype =
61 (8)
2005-07-22 10:46:02.406443 inside cs_convert() calling tds_convert
2005-07-22 10:46:02.406487 inside store_time() millisecs = 123
2005-07-22 10:46:02.406501 inside cs_convert() tds_convert returned 8
2005-07-22 10:46:02.406514 inside cs_convert() returning 1
2005-07-22 10:46:02.406526 inside cs_convert()
2005-07-22 10:46:02.406537 inside _ct_get_server_type(6)
2005-07-22 10:46:02.406549 inside _ct_get_server_type(1)
2005-07-22 10:46:02.406561 inside cs_convert() srctype = 61 (8) desttype = 47
(257)
2005-07-22 10:46:02.406574 inside cs_convert() calling tds_convert
2005-07-22 10:46:02.406595 inside cs_convert() tds_convert returned 25
2005-07-22 10:46:02.406607 inside cs_convert() FMT_NULLTERM
2005-07-22 10:46:02.406619 inside cs_convert() returning 1
2005-07-22 10:46:02.406632 inside cs_convert()
2005-07-22 10:46:02.406643 inside _ct_get_server_type(1)
2005-07-22 10:46:02.406655 inside _ct_get_server_type(6)
2005-07-22 10:46:02.406667 inside cs_convert() srctype = 47 (24) desttype =
61 (8)
2005-07-22 10:46:02.406680 inside cs_convert() calling tds_convert
2005-07-22 10:46:02.406696 inside store_time() millisecs = 123
2005-07-22 10:46:02.406709 inside cs_convert() tds_convert returned 8
2005-07-22 10:46:02.406721 inside cs_convert() returning 1
2005-07-22 10:46:02.406733 inside cs_convert()
2005-07-22 10:46:02.406744 inside _ct_get_server_type(6)
2005-07-22 10:46:02.406755 inside _ct_get_server_type(1)
2005-07-22 10:46:02.406767 inside cs_convert() srctype = 61 (8) desttype = 47
(257)
2005-07-22 10:46:02.406803 inside cs_convert() calling tds_convert



Archive powered by MHonArc 2.6.24.

Top of Page