[freetds] FreeBCP -n causes SIGSEGV, -c fails on input

Mark Huber hubmark at gmail.com
Thu Feb 2 16:17:46 EST 2006


I used "datacopy" from the nightly snapshot as I didn't find it in the 
stable release.
----- Original Message ----- 
From: "Thompson, Bill D (London)" <bill_d_thompson at ml.com>
To: "FreeTDS Development Group" <freetds at lists.ibiblio.org>
Sent: Tuesday, January 31, 2006 12:00 PM
Subject: Re: [freetds] FreeBCP -n causes SIGSEGV, -c fails on input


> Hi Mark,
>
> Aaah. The version of datacopy is quite different from my own (I wrote
> it)
> It looks like I have some fixes to do there too.
>
> Bill
>
> -----Original Message-----
> From: freetds-bounces at lists.ibiblio.org
> [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Mark Huber
> Sent: 31 January 2006 16:12
> To: FreeTDS Development Group
> Subject: Re: [freetds] FreeBCP -n causes SIGSEGV, -c fails on input
>
>
> Tried datacopy but still no luck (same issue as "-c" possibly?)
>
> Identical tables, different database, same server. One column (test
> char(10), not nullable)
>
> Here's the command line:
>
> ./datacopy  -a -v -S starsDEV/sa/****/archive/testTable -D
> starsDEV7/sa/****/starsDEV/testTable -d
>
> falls over with:
>
> Error in dbnumcols
> datacopy: table structures do not match. terminating
>
> Here's the tdsump file:
>
> util.c:288:Starting log file for FreeTDS 0.65.dev.20060131
>        on 2006-01-31 11:10:47 with debug flags 0x4fff.
> iconv.c:361:iconv to convert client-side data to the "ISO-8859-1"
> character
> set
> iconv.c:514:tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
> iconv.c:514:tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
> net.c:168:Connecting to 10.1.1.69 port 1433.
> write.c:134:tds_put_string converting 17 bytes of "stag.scplinux.com"
> write.c:162:tds_put_string wrote 34 bytes
> write.c:134:tds_put_string converting 2 bytes of "sa"
> write.c:162:tds_put_string wrote 4 bytes
> write.c:134:tds_put_string converting 12 bytes of "Migrate Data"
> write.c:162:tds_put_string wrote 24 bytes
> write.c:134:tds_put_string converting 9 bytes of "starsDEV7"
> write.c:162:tds_put_string wrote 18 bytes
> write.c:134:tds_put_string converting 10 bytes of "DB-Library"
> write.c:162:tds_put_string wrote 20 bytes
> write.c:134:tds_put_string converting 10 bytes of "us_english"
> write.c:162:tds_put_string wrote 20 bytes
> write.c:162:tds_put_string wrote 0 bytes
> token.c:310:tds_process_login_tokens()
> net.c:446:Received header
> 0000 04 01 01 75 00 8c 01 00-                        |...u....|
>
> net.c:542:Received packet
> 0000 e3 1b 00 01 06 6d 00 61-00 73 00 74 00 65 00 72 |.....m.a .s.t.e.r|
> 0010 00 06 6d 00 61 00 73 00-74 00 65 00 72 00 ab 64 |..m.a.s. t.e.r..d|
> 0020 00 45 16 00 00 02 00 25-00 43 00 68 00 61 00 6e |.E.....% .C.h.a.n|
> 0030 00 67 00 65 00 64 00 20-00 64 00 61 00 74 00 61 |.g.e.d.  .d.a.t.a|
> 0040 00 62 00 61 00 73 00 65-00 20 00 63 00 6f 00 6e |.b.a.s.e . .c.o.n|
> 0050 00 74 00 65 00 78 00 74-00 20 00 74 00 6f 00 20 |.t.e.x.t . .t.o. |
> 0060 00 27 00 6d 00 61 00 73-00 74 00 65 00 72 00 27 |.'.m.a.s .t.e.r.'|
> 0070 00 2e 00 07 42 00 4f 00-52 00 4f 00 4d 00 49 00 |....B.O. R.O.M.I.|
> 0080 52 00 00 00 00 e3 08 00-07 05 09 04 d0 00 34 00 |R....... ......4.|
> 0090 e3 17 00 02 0a 75 00 73-00 5f 00 65 00 6e 00 67 |.....u.s ._.e.n.g|
> 00a0 00 6c 00 69 00 73 00 68-00 00 ab 68 00 47 16 00 |.l.i.s.h ...h.G..|
> 00b0 00 01 00 27 00 43 00 68-00 61 00 6e 00 67 00 65 |...'.C.h .a.n.g.e|
> 00c0 00 64 00 20 00 6c 00 61-00 6e 00 67 00 75 00 61 |.d. .l.a .n.g.u.a|
> 00d0 00 67 00 65 00 20 00 73-00 65 00 74 00 74 00 69 |.g.e. .s .e.t.t.i|
> 00e0 00 6e 00 67 00 20 00 74-00 6f 00 20 00 75 00 73 |.n.g. .t .o. .u.s|
> 00f0 00 5f 00 65 00 6e 00 67-00 6c 00 69 00 73 00 68 |._.e.n.g .l.i.s.h|
> 0100 00 2e 00 07 42 00 4f 00-52 00 4f 00 4d 00 49 00 |....B.O. R.O.M.I.|
> 0110 52 00 00 00 00 ad 36 00-01 71 00 00 01 16 4d 00 |R.....6. .q....M.|
> 0120 69 00 63 00 72 00 6f 00-73 00 6f 00 66 00 74 00 |i.c.r.o. s.o.f.t.|
> 0130 20 00 53 00 51 00 4c 00-20 00 53 00 65 00 72 00 | .S.Q.L.  .S.e.r.|
> 0140 76 00 65 00 72 00 00 00-00 00 08 00 02 f8 e3 13 |v.e.r... ........|
> 0150 00 04 04 34 00 30 00 39-00 36 00 04 34 00 30 00 |...4.0.9 .6..4.0.|
> 0160 39 00 36 00 fd 00 00 00-00 00 00 00 00          |9.6..... .....|
>
> token.c:314:looking for login token, got  e3(ENVCHANGE)
> token.c:105:tds_process_default_tokens() marker is e3(ENVCHANGE)
> read.c:179:tds_get_string: reading 12 from wire to give 6 to client.
> read.c:179:tds_get_string: reading 12 from wire to give 6 to client.
> token.c:314:looking for login token, got  ab(INFO)
> token.c:105:tds_process_default_tokens() marker is ab(INFO)
> token.c:2382:tds_process_msg() reading message from server
> read.c:179:tds_get_string: reading 74 from wire to give 37 to client.
> read.c:179:tds_get_string: reading 14 from wire to give 7 to client.
> token.c:2444:tds_process_msg() calling client msg handler
> token.c:2457:tds_process_msg() returning TDS_SUCCEED
> token.c:314:looking for login token, got  e3(ENVCHANGE)
> token.c:105:tds_process_default_tokens() marker is e3(ENVCHANGE)
> iconv.c:514:tds_iconv_info_init: converting "ISO-8859-1"->"CP1252"
> token.c:314:looking for login token, got  e3(ENVCHANGE)
> token.c:105:tds_process_default_tokens() marker is e3(ENVCHANGE)
> read.c:179:tds_get_string: reading 20 from wire to give 10 to client.
> token.c:314:looking for login token, got  ab(INFO)
> token.c:105:tds_process_default_tokens() marker is ab(INFO)
> token.c:2382:tds_process_msg() reading message from server
> read.c:179:tds_get_string: reading 78 from wire to give 39 to client.
> read.c:179:tds_get_string: reading 14 from wire to give 7 to client.
> token.c:2444:tds_process_msg() calling client msg handler
> token.c:2457:tds_process_msg() returning TDS_SUCCEED
> token.c:314:looking for login token, got  ad(LOGINACK)
> read.c:179:tds_get_string: reading 44 from wire to give 22 to client.
> token.c:314:looking for login token, got  e3(ENVCHANGE)
> token.c:105:tds_process_default_tokens() marker is e3(ENVCHANGE)
> read.c:179:tds_get_string: reading 8 from wire to give 4 to client.
> read.c:179:tds_get_string: reading 8 from wire to give 4 to client.
> token.c:2270:increasing block size from 4096 to 4096
> token.c:314:looking for login token, got  fd(DONE)
> token.c:105:tds_process_default_tokens() marker is fd(DONE)
> token.c:2086:tds_process_end: more_results = 0
>                was_cancelled = 0
>                error = 0
>                done_count_valid = 0
> token.c:2102:tds_process_end() state set to TDS_IDLE
> util.c:119:Changing query state from IDLE to IDLE
> token.c:387:leaving tds_process_login_tokens() returning 1
> util.c:119:Changing query state from IDLE to QUERYING
> mem.c:568:tds_free_all_results()
> write.c:134:tds_put_string converting 19 bytes of "set textsize 64512 "
> write.c:162:tds_put_string wrote 38 bytes
> util.c:119:Changing query state from QUERYING to PENDING
> net.c:673:Sending packet
> 0000 01 01 00 2e 00 00 00 00-73 00 65 00 74 00 20 00 |........ s.e.t. .|
> 0010 74 00 65 00 78 00 74 00-73 00 69 00 7a 00 65 00 |t.e.x.t. s.i.z.e.|
> 0020 20 00 36 00 34 00 35 00-31 00 32 00 20 00       | .6.4.5. 1.2. .|
>
> util.c:119:Changing query state from PENDING to READING
> net.c:446:Received header
> 0000 04 01 00 11 00 8c 01 00-                        |........|
>
> net.c:542:Received packet
> 0000 fd 00 00 be 00 00 00 00-00                      |........ .|
>
> token.c:526:processing result tokens.  marker is  fd(DONE)
> token.c:2086:tds_process_end: more_results = 0
>                was_cancelled = 0
>                error = 0
>                done_count_valid = 0
> token.c:2102:tds_process_end() state set to TDS_IDLE
> util.c:119:Changing query state from READING to IDLE
> util.c:119:Changing query state from IDLE to PENDING
> token.c:514:tds_process_tokens() state is COMPLETED
> dblib.c:983:dbuse()
> dblib.c:899:dbcmd() bufsz = 0
> dblib.c:949:in dbsqlexec()
> dblib.c:5916:in dbsqlsend()
> util.c:119:Changing query state from IDLE to QUERYING
> mem.c:568:tds_free_all_results()
> write.c:134:tds_put_string converting 12 bytes of "use starsDEV"
> write.c:162:tds_put_string wrote 24 bytes
> util.c:119:Changing query state from QUERYING to PENDING
> net.c:673:Sending packet
> 0000 01 01 00 20 00 00 01 00-75 00 73 00 65 00 20 00 |... .... u.s.e. .|
> 0010 73 00 74 00 61 00 72 00-73 00 44 00 45 00 56 00 |s.t.a.r. s.D.E.V.|
>
> dblib.c:4010:in dbsqlok()
> net.c:446:Received header
> 0000 04 01 00 a9 00 8c 01 00-                        |........|
>
> net.c:542:Received packet
> 0000 e3 1f 00 01 08 73 00 74-00 61 00 72 00 73 00 44 |.....s.t .a.r.s.D|
> 0010 00 45 00 56 00 06 6d 00-61 00 73 00 74 00 65 00 |.E.V..m. a.s.t.e.|
> 0020 72 00 ab 68 00 45 16 00-00 01 00 27 00 43 00 68 |r..h.E.. ...'.C.h|
> 0030 00 61 00 6e 00 67 00 65-00 64 00 20 00 64 00 61 |.a.n.g.e .d. .d.a|
> 0040 00 74 00 61 00 62 00 61-00 73 00 65 00 20 00 63 |.t.a.b.a .s.e. .c|
> 0050 00 6f 00 6e 00 74 00 65-00 78 00 74 00 20 00 74 |.o.n.t.e .x.t. .t|
> 0060 00 6f 00 20 00 27 00 73-00 74 00 61 00 72 00 73 |.o. .'.s .t.a.r.s|
> 0070 00 44 00 45 00 56 00 27-00 2e 00 07 42 00 4f 00 |.D.E.V.' ....B.O.|
> 0080 52 00 4f 00 4d 00 49 00-52 00 00 01 00 e3 08 00 |R.O.M.I. R.......|
> 0090 07 05 09 04 d0 00 34 00-fd 00 00 e2 00 00 00 00 |......4. ........|
> 00a0 00                     -                        |.|
>
> dblib.c:4029:dbsqlok() marker is e3
> util.c:119:Changing query state from PENDING to READING
> token.c:526:processing result tokens.  marker is  e3(ENVCHANGE)
> token.c:105:tds_process_default_tokens() marker is e3(ENVCHANGE)
> read.c:179:tds_get_string: reading 16 from wire to give 8 to client.
> read.c:179:tds_get_string: reading 12 from wire to give 6 to client.
> token.c:526:processing result tokens.  marker is  ab(INFO)
> token.c:105:tds_process_default_tokens() marker is ab(INFO)
> token.c:2382:tds_process_msg() reading message from server
> read.c:179:tds_get_string: reading 78 from wire to give 39 to client.
> read.c:179:tds_get_string: reading 14 from wire to give 7 to client.
> token.c:2444:tds_process_msg() calling client msg handler
> token.c:2457:tds_process_msg() returning TDS_SUCCEED
> token.c:526:processing result tokens.  marker is  e3(ENVCHANGE)
> token.c:105:tds_process_default_tokens() marker is e3(ENVCHANGE)
> token.c:526:processing result tokens.  marker is  fd(DONE)
> token.c:2086:tds_process_end: more_results = 0
>                was_cancelled = 0
>                error = 0
>                done_count_valid = 0
> token.c:2102:tds_process_end() state set to TDS_IDLE
> util.c:119:Changing query state from READING to IDLE
> util.c:119:Changing query state from IDLE to PENDING
> dblib.c:4076:dbsqlok() end status was success
> dblib.c:1153:dbresults()
> token.c:514:tds_process_tokens() state is COMPLETED
> dblib.c:899:dbcmd() bufsz = 12
> dblib.c:5012:in dbfreebuf()
> dblib.c:949:in dbsqlexec()
> dblib.c:5916:in dbsqlsend()
> util.c:119:Changing query state from IDLE to QUERYING
> mem.c:568:tds_free_all_results()
> write.c:134:tds_put_string converting 54 bytes of "SET FMTONLY ON select
> *
> from testTable SET FMTONLY OFF"
> write.c:162:tds_put_string wrote 108 bytes
> util.c:119:Changing query state from QUERYING to PENDING
> net.c:673:Sending packet
> 0000 01 01 00 74 00 00 01 00-53 00 45 00 54 00 20 00 |...t.... S.E.T. .|
> 0010 46 00 4d 00 54 00 4f 00-4e 00 4c 00 59 00 20 00 |F.M.T.O. N.L.Y. .|
> 0020 4f 00 4e 00 20 00 73 00-65 00 6c 00 65 00 63 00 |O.N. .s. e.l.e.c.|
> 0030 74 00 20 00 2a 00 20 00-66 00 72 00 6f 00 6d 00 |t. .*. . f.r.o.m.|
> 0040 20 00 74 00 65 00 73 00-74 00 54 00 61 00 62 00 | .t.e.s. t.T.a.b.|
> 0050 6c 00 65 00 20 00 53 00-45 00 54 00 20 00 46 00 |l.e. .S. E.T. .F.|
> 0060 4d 00 54 00 4f 00 4e 00-4c 00 59 00 20 00 4f 00 |M.T.O.N. L.Y. .O.|
> 0070 46 00 46 00            -                        |F.F.|
>
> dblib.c:4010:in dbsqlok()
> net.c:446:Received header
> 0000 04 01 00 3b 00 88 01 00-                        |...;....|
>
> net.c:542:Received packet
> 0000 fd 01 00 b9 00 00 00 00-00 81 01 00 00 00 08 00 |........ ........|
> 0010 af 0a 00 09 04 d0 00 34-04 74 00 65 00 73 00 74 |.......4 .t.e.s.t|
> 0020 00 fd 01 00 c1 00 00 00-00 00 fd 00 00 ba 00 00 |........ ........|
> 0030 00 00 00               -                        |...|
>
> dblib.c:4029:dbsqlok() marker is fd
> util.c:119:Changing query state from PENDING to READING
> token.c:526:processing result tokens.  marker is  fd(DONE)
> token.c:2086:tds_process_end: more_results = 1
>                was_cancelled = 0
>                error = 0
>                done_count_valid = 0
> util.c:119:Changing query state from READING to PENDING
> dblib.c:4076:dbsqlok() end status was success
> dblib.c:1153:dbresults()
> dblib.c:1153:dbresults()
> mem.c:568:tds_free_all_results()
> util.c:119:Changing query state from PENDING to READING
> token.c:526:processing result tokens.  marker is  81(TDS7_RESULT)
> mem.c:568:tds_free_all_results()
> token.c:1433:processing TDS7 result. set current_results to
> tds->res_info
> token.c:3323:adjust_character_column_size:
>        Server charset: CP1252
>        Server column_size: 10
>        Client charset: ISO-8859-1
>        Client column_size: 10
> read.c:179:tds_get_string: reading 8 from wire to give 4 to client.
> token.c:1375:tds7_get_data_info:
>        colname = test (4 bytes)
>        type = 47 (char)
>        server's type = 175 (xchar)
>        column_varint_size = 2
>        column_size = 10 (10 on server)
> util.c:119:Changing query state from READING to PENDING
> dblib.c:1188:dbresults() process_result_tokens returned result_type =
> 4049
> retcode = 1
> util.c:119:Changing query state from PENDING to READING
> token.c:526:processing result tokens.  marker is  fd(DONE)
> token.c:2086:tds_process_end: more_results = 1
>                was_cancelled = 0
>                error = 0
>                done_count_valid = 0
> util.c:119:Changing query state from READING to PENDING
> dblib.c:1188:dbresults() process_result_tokens returned result_type =
> 4052
> retcode = 1
> dblib.c:1153:dbresults()
> mem.c:568:tds_free_all_results()
> util.c:119:Changing query state from PENDING to READING
> token.c:526:processing result tokens.  marker is  fd(DONE)
> token.c:2086:tds_process_end: more_results = 0
>                was_cancelled = 0
>                error = 0
>                done_count_valid = 0
> token.c:2102:tds_process_end() state set to TDS_IDLE
> util.c:119:Changing query state from READING to IDLE
> util.c:119:Changing query state from IDLE to PENDING
> dblib.c:1188:dbresults() process_result_tokens returned result_type =
> 4052
> retcode = 1
> dblib.c:1153:dbresults()
> mem.c:568:tds_free_all_results()
> token.c:514:tds_process_tokens() state is COMPLETED
> dblib.c:1188:dbresults() process_result_tokens returned result_type =
> 4052
> retcode = 2
> mem.c:568:tds_free_all_results()
> util.c:119:Changing query state from IDLE to DEAD
> dblib.c:5012:in dbfreebuf()
> mem.c:568:tds_free_all_results()
> util.c:119:Changing query state from IDLE to DEAD
> dblib.c:5012:in dbfreebuf()
>
>
> ----- Original Message ----- 
> From: "Thompson, Bill D (London)" <bill_d_thompson at ml.com>
> To: "FreeTDS Development Group" <freetds at lists.ibiblio.org>
> Sent: Tuesday, January 31, 2006 4:42 AM
> Subject: Re: [freetds] FreeBCP -n causes SIGSEGV, -c fails on input
>
>
>> Hi again Mark,
>>
>> Forgot to mention...
>> If you are using up to date freetds, then you will have the "datacopy"
>> program.
>> This was written for the purpose you have - to move data from one
> server
>> to another.
>>
>> Bill
>>
>> -----Original Message-----
>> From: freetds-bounces at lists.ibiblio.org
>> [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Mark Huber
>> Sent: 31 January 2006 07:05
>> To: freetds at lists.ibiblio.org
>> Subject: [freetds] FreeBCP -n causes SIGSEGV, -c fails on input
>>
>>
>> Trying to use FreeBCP to transfer data from SQL Server 2K to another
> SQL
>> Server 2K. Here's the gdb output for the core file:
>>
>> Core was generated by `./freebcp starsDEV.dbo.bcptest out /tmp/foo.out
>> -n -U sa -P ****** -S ******'.
>> Program terminated with signal 11, Segmentation fault.
>>
>> #0  dbcoltype (dbproc=0x0, column=0) at dblib.c:2321
>> 2321            colinfo = resinfo->columns[column - 1];
>>
>> Results in segmentation fault regardless of the table ( I tried 40+
>> tables, all different structures)
>>
>> "-c" switch works fine for output but input falls over at the first
> line
>> for this table structure:
>>
>> Column_name     Type    Computed        Length  Prec    Scale
> Nullable
>> TrimTrailingBlanks      FixedLenNullInSource    Collation
>> PortID  int     no      4       10      0       no      (n/a)   (n/a)
>> NULL
>> PortName        nvarchar        no      100                     yes
>> (n/a)   (n/a)   SQL_Latin1_General_CP1_CI_AS
>> PortSortOrder   int     no      4       10      0       yes     (n/a)
>> (n/a)   NULL
>> PortPM  int     no      4       10      0       yes     (n/a)   (n/a)
>> NULL
>> PortType        nvarchar        no      20                      yes
>> (n/a)   (n/a)   SQL_Latin1_General_CP1_CI_AS
>>
>> The output file looks like this: (freebcp  starsDEV.dbo.tblPort out
>> /tmp/wsotblFacilityName -c <password stuff> -t "@|@")
>>
>>
>> 1@|@Carrera@|@12@|@4@|@CDO/CLO
>> 2@|@Eagle@|@13@|@5@|@CDO/CLO
>> 3@|@Hamilton@|@18@|@4@|@CDO/CLO
>>
>> freebcp with in results in:
>>
>> Msg 20050, Level 4
>> Attempt to convert data stopped by syntax error in source field.
>>
>> Msg 20050, Level 4
>> Attempt to convert data stopped by syntax error in source field.
>>
>> Msg 20049, Level 4
>> Data-conversion resulted in overflow.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> FreeTDS mailing list
>> FreeTDS at lists.ibiblio.org
>> http://lists.ibiblio.org/mailman/listinfo/freetds
>> --------------------------------------------------------
>>
>> If you are not an intended recipient of this e-mail, please notify the
>
>> sender, delete it and do not read, act upon, print, disclose, copy,
> retain
>> or redistribute it. Click here for important additional terms relating
> to
>> this e-mail.     http://www.ml.com/email_terms/
>> --------------------------------------------------------
>> _______________________________________________
>> FreeTDS mailing list
>> FreeTDS at lists.ibiblio.org
>> http://lists.ibiblio.org/mailman/listinfo/freetds
>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
> --------------------------------------------------------
>
> If you are not an intended recipient of this e-mail, please notify the 
> sender, delete it and do not read, act upon, print, disclose, copy, retain 
> or redistribute it. Click here for important additional terms relating to 
> this e-mail.     http://www.ml.com/email_terms/
> --------------------------------------------------------
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds 



More information about the FreeTDS mailing list