Changeset: 2aaa4be50f21 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2aaa4be50f21 Added Files: sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py Removed Files: sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.sql sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.test Modified Files: sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.err sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.out Branch: mtest Log Message:
Converting unicode-bom.Bug-2641 test to Python (we can't write the BOM character from pymonetdb on normal circustances), but I think there's a bug with BOM character as an identifier diffs (229 lines): diff --git a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.sql b/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py rename from sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.sql rename to sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py --- a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.sql +++ b/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py @@ -1,10 +1,66 @@ --- The Unicode BOM (Byte Order Marker) is only a BOM when at the start --- of a file. Anywhere else it's a ZERO WIDTH NO-BREAK SPACE which we --- shouldn't ignore. - --- the line above has nothing but the BOM, the line below starts with one -SELECT 1; --- next line has the BOM in the middle of the SELECT -SELECT 1; --- finally, more than one BOM scattered over the entire statement -SELECT 1; +import sys + +try: + from MonetDBtesting import process +except ImportError: + import process + + +# The Unicode BOM (Byte Order Marker) is only a BOM when at the start +# of a file. Anywhere else it's a ZERO WIDTH NO-BREAK SPACE which we +# shouldn't ignore. + +# This line has the BOM character plus the newline +INPUT1 = b"\xEF\xBB\xBF\x0A" +with process.client('sql', text=False, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: + out, err = c.communicate(INPUT1) + retcode = c.returncode + + if retcode == 0: + sys.stderr.write("Expected nonzero return code") + if not err or b'Unexpected character (U+FEFF)' not in err: + sys.stderr.write("Expected stderr to contain 'Unexpected character (U+FEFF)'") + +# This line starts with the BOM followed by SELECT 1;\n +INPUT2 = b"\xEF\xBB\xBF\x53\x45\x4C\x45\x43\x54\x20\x31\x3B\x0A" +with process.client('sql', text=False, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: + out, err = c.communicate(INPUT2) + retcode = c.returncode + + if retcode == 0: + sys.stderr.write("Expected nonzero return code") + if not err or b'Unexpected character (U+FEFF)' not in err: + sys.stderr.write("Expected stderr to contain 'Unexpected character (U+FEFF)'") + +# This line has the BOM in the middle of the SELECT 1;\n +INPUT3 = b"\x53\x45\x4C\xEF\xBB\xBF\x45\x43\x54\x20\x31\x3B\x0A" +with process.client('sql', text=False, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: + out, err = c.communicate(INPUT3) + retcode = c.returncode + + if retcode == 0: + sys.stderr.write("Expected nonzero return code") + if not err or b'syntax error in' not in err: + sys.stderr.write("Expected stderr to contain 'syntax error in'") + +# More than one BOM scattered over the entire statement +INPUT4 = b"\x53\x45\xEF\xBB\xBF\x4C\x45\xEF\xBB\xBF\x43\x54\xEF\xBB\xBF\x20\x31\xEF\xBB\xBF\x3B\xEF\xBB\xBF\x0A" +with process.client('sql', text=False, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: + out, err = c.communicate(INPUT4) + retcode = c.returncode + + if retcode == 0: + sys.stderr.write("Expected nonzero return code") + if not err or b'Unexpected character (U+FEFF)' not in err: + sys.stderr.write("Expected stderr to contain 'Unexpected character (U+FEFF)'") + +# Using BOM as a SQL identifier +INPUT5 = b"\x53\x45\x4C\x45\x43\x54\x20\x22\xEF\xBB\xBF\x22\x3B" +with process.client('sql', text=False, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: + out, err = c.communicate(INPUT5) + retcode = c.returncode + + if retcode == 0: + sys.stderr.write("Expected nonzero return code") + if not err or b'Unexpected character (U+FEFF)' not in err: + sys.stderr.write("Expected stderr to contain 'Unexpected character (U+FEFF)'") diff --git a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.err b/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.err --- a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.err +++ b/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.err @@ -5,88 +5,6 @@ stderr of test 'unicode-bom.Bug-2641` in # 11:21:04 > mserver5 "--config=/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/etc/monetdb5.conf" --debug=10 --set gdk_nr_threads=0 --set "monet_mod_path=/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/lib:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/bin" --set "gdk_dbfarm=/net/volund.ins.cwi.nl/export/scratch0/fabian/vtmp/mtest-Jun2010-volund.ins.cwi.nl/sql/dbfarm" --set mapi_open=true --set xrpc_open=true --set mapi_port=33351 --set xrpc_port=40107 --set monet_prompt= --set mal_listing=2 --trace "--dbname=mTests_src_test_BugTracker-2010" --set mal_listing=0 ; echo ; echo Over.. # 11:21:04 > -# builtin opt gdk_arch = 64bitx86_64-pc-linux-gnu -# builtin opt gdk_version = 1.38.4 -# builtin opt prefix = /ufs/fabian/scratch/monetdb/Jun2010/program-x86_64 -# builtin opt exec_prefix = ${prefix} -# builtin opt gdk_dbname = demo -# builtin opt gdk_dbfarm = ${prefix}/var/MonetDB/dbfarm -# builtin opt gdk_debug = 0 -# builtin opt gdk_alloc_map = no -# builtin opt gdk_vmtrim = yes -# builtin opt monet_admin = adm -# builtin opt monet_prompt = > -# builtin opt monet_welcome = yes -# builtin opt monet_mod_path = /ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB -# builtin opt monet_daemon = no -# builtin opt host = localhost -# builtin opt mapi_port = 50000 -# builtin opt mapi_clients = 2 -# builtin opt mapi_open = false -# builtin opt mapi_autosense = false -# builtin opt sql_debug = 0 -# builtin opt standoff_ns = -# builtin opt standoff_start = start -# builtin opt standoff_end = end -# config opt prefix = /ufs/fabian/scratch/monetdb/Jun2010/program-x86_64 -# config opt config = ${prefix}/etc/monetdb5.conf -# config opt prefix = /ufs/fabian/scratch/monetdb/Jun2010/program-x86_64 -# config opt exec_prefix = ${prefix} -# config opt gdk_dbfarm = ${prefix}/var/MonetDB5/dbfarm -# config opt monet_mod_path = /ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/lib:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/bin -# config opt mero_pidfile = ${prefix}/var/run/MonetDB/merovingian.pid -# config opt mero_controlport = 50001 -# config opt sql_optimizer = default_pipe -# config opt minimal_pipe = inline,remap,deadcode,multiplex,garbageCollector -# config opt default_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mitosis,mergetable,deadcode,commonTerms,joinPath,reorder,deadcode,reduce,dataflow,history,multiplex,garbageCollector -# config opt nov2009_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,multiplex,garbageCollector -# config opt replication_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,replication,multiplex,garbageCollector -# config opt accumulator_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,accumulators,dataflow,history,multiplex,garbageCollector -# config opt recycler_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,deadcode,constants,commonTerms,joinPath,deadcode,recycle,reduce,dataflow,history,multiplex,garbageCollector -# config opt cracker_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,selcrack,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,multiplex,garbageCollector -# config opt sidcrack_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,sidcrack,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,multiplex,garbageCollector -# config opt octopus_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mitosis,mergetable,deadcode,constants,commonTerms,joinPath,octopus,deadcode,reduce,dataflow,history,multiplex,garbageCollector -# config opt mapreduce_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mapreduce,mergetable,deadcode,commonTerms,joinPath,reorder,deadcode,reduce,dataflow,history,multiplex,garbageCollector -# config opt datacyclotron_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,datacyclotron,mergetable,deadcode,constants,commonTerms,joinPath,reorder,deadcode,reduce,dataflow,history,replication,multiplex,garbageCollector -# config opt derive_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,derivePath,joinPath,deadcode,reduce,dataflow,history,multiplex,garbageCollector -# config opt dictionary_pipe = inline,remap,dictionary,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,multiplex,garbageCollector -# config opt compression_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,compression,dataflow,history,multiplex,garbageCollector -# cmdline opt config = /ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/etc/monetdb5.conf -# cmdline opt gdk_nr_threads = 0 -# cmdline opt monet_mod_path = /ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/lib:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/bin -# cmdline opt gdk_dbfarm = /net/volund.ins.cwi.nl/export/scratch0/fabian/vtmp/mtest-Jun2010-volund.ins.cwi.nl/sql/dbfarm -# cmdline opt mapi_open = true -# cmdline opt xrpc_open = true -# cmdline opt mapi_port = 33351 -# cmdline opt xrpc_port = 40107 -# cmdline opt monet_prompt = -# cmdline opt mal_listing = 2 -# cmdline opt gdk_dbname = mTests_src_test_BugTracker-2010 -# cmdline opt mal_listing = 0 -#warning: please don't forget to set your vault key! -#(see /ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/etc/monetdb5.conf) - -# 11:21:04 > -# 11:21:04 > mclient -lsql -ftest -i -e --host=volund --port=33351 -# 11:21:04 > - -MAPI = (monetdb) /var/tmp/mtest-27483/.s.monetdb.35395 -QUERY = -ERROR = !Unexpected character (U+FEFF) -CODE = 42000 -MAPI = (monetdb) /var/tmp/mtest-30274/.s.monetdb.37685 -QUERY = SELECT 1; -ERROR = !Unexpected character (U+FEFF) -CODE = 42000 -MAPI = (monetdb) /var/tmp/mtest-30274/.s.monetdb.37685 -QUERY = SELECT 1; -ERROR = !syntax error, unexpected IDENT in: "sel" -CODE = 42000 -MAPI = (monetdb) /var/tmp/mtest-30274/.s.monetdb.37685 -QUERY = SELECT 1; -ERROR = !syntax error, unexpected IDENT in: "se" - !Unexpected character (U+FEFF) -CODE = 42000 # 11:21:04 > # 11:21:04 > Done. diff --git a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.out b/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.out --- a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.out +++ b/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.out @@ -5,31 +5,8 @@ stdout of test 'unicode-bom.Bug-2641` in # 11:21:04 > mserver5 "--config=/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/etc/monetdb5.conf" --debug=10 --set gdk_nr_threads=0 --set "monet_mod_path=/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/lib:/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/lib/MonetDB5/bin" --set "gdk_dbfarm=/net/volund.ins.cwi.nl/export/scratch0/fabian/vtmp/mtest-Jun2010-volund.ins.cwi.nl/sql/dbfarm" --set mapi_open=true --set xrpc_open=true --set mapi_port=33351 --set xrpc_port=40107 --set monet_prompt= --set mal_listing=2 --trace "--dbname=mTests_src_test_BugTracker-2010" --set mal_listing=0 ; echo ; echo Over.. # 11:21:04 > -# MonetDB server v5.20.4, based on kernel v1.38.4 -# Release Jun2010-hg -# Serving database 'mTests_src_test_BugTracker-2010', using 4 threads -# Compiled for x86_64-pc-linux-gnu/64bit with 64bit OIDs dynamically linked -# Found 7.751 GiB available main-memory. -# Copyright (c) 1993-July 2008 CWI. -# Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved -# Visit http://monetdb.cwi.nl/ for further information -# Listening for connection requests on mapi:monetdb://volund.ins.cwi.nl:33351/ -# MonetDB/SQL module v2.38.4 loaded -# MonetDB/GIS module v0.18.0 loaded - -# 11:21:04 > -# 11:21:04 > mclient -lsql -ftest -i -e --host=volund --port=33351 -# 11:21:04 > - -#SELECT 1; -% .%2 # table_name -% %2 # name -% tinyint # type -% 1 # length -[ 1 ] - # 11:21:04 > # 11:21:04 > Done. # 11:21:04 > diff --git a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.test b/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.test deleted file mode 100644 --- a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.test +++ /dev/null @@ -1,15 +0,0 @@ -statement error - --- of a file. Anywhere else it's a ZERO WIDTH NO-BREAK SPACE which we --- shouldn't ignore. - --- the line above has nothing but the BOM, the line below starts with one -SELECT 1 - -statement error -SELECT 1 - -statement error -SELECT 1; - - _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list