.
D 2013-03-03T17:34:40
J assignee pvgoran
J cmimetype text/plain
J comment I\scouldn't\sfind\sany\sway\sto\sreopen\sor\scomment\son\sthe\salready-closed\sbug\n3604074,\sso\shere\sis\sa\snew\sbug\sreport\sto\ssay\sthat\sthe\sfix\sfor\sthat\sone\ndoesn't\swork:\sif\syou\sbuild\swith\sthe\sasserts\sin\sSpencer's\scode\senabled,\nyou'll\sfind\sthat\sthe\sTcl\sregression\stests\sdraw\san\sassertion\sfailure,\nbecause\sfixempties()\sfails\sto\seliminate\sall\sthe\sEMPTY\sarcs.\n\nThe\sproximate\scause\sof\sthat\sis\sa\ssmall\soversight\sin\sthe\spatch:\sthe\sfirst\nsub-loop\sin\sfixempties\ssupposes\sthat\sit\sdoesn't\sneed\sto\sdo\sthe\s"nexta\s=\na->outchain"\sdance,\sbut\sthat's\swrong\sbecause\sunempty\sis\sstill\scapable\sof\ndeleting\sthe\sarc\simmediately,\sif\sthe\sarc\sis\sa\s"vacuous\sloop".\n\nHowever,\seven\swith\sthat\srepaired\sI\sdon't\sfind\sthe\sfix\simplemented\sfor\n3604074\sto\sbe\svery\strustworthy.\s\sThe\spatch\swill\scope\sif\sexpansion\sof\sa\nlater\sout-arc\sfor\sthe\scurrent\sstate\stries\sto\sre-add\san\sempty\sout-arc\s*to\nthat\sstate*\sthat\swas\salready\sprocessed.\s\sHowever,\sit\sdoesn't\sdetect\sthe\ncase\swhere\swe\sre-add\san\sempty\sout-arc\sto\sa\spreviously\sprocessed\sstate.\nNor\sis\sit\sobvious\sthat\sa\sremoved\sempty\sout-arc\scan't\sbe\sregenerated\sin\sa\nlater\spass\s(which\safter\sall\swas\sthe\sfailure\smode\sexhibited\sin\s3604074).\nI\scouldn't\sfind\sa\stest\scase\sexhibiting\san\sinfinite\sloop,\sbut\sI\sdon't\shave\na\sgood\sfeeling\sabout\sthat.\s\sI\sam\salso\ssuspicious\sthat\sthe\snew\scode\sis\noutright\swrong,\sbecause\sit\sseems\sto\sleave\sout\ssome\sarguably-necessary\sarcs\nwhen\sI\scompare\sits\sfinal\sNFA\sstate\sto\sthe\srewritten\sversion\sattached.\s\sI\ndon't\shave\sa\stest\scase\sto\sprove\sthat\seither,\sbut\sI'm\ssuspicious\sthat\sthe\ntiming\sof\selimination\sof\sempty\sarcs\smight\snot\sbe\squite\sright\snow.\n\nAfter\ssome\sthought\sand\sexperimentation\sI\sdevised\sa\snew\salgorithm\sthat\nclearly\sterminates,\sbecause\sit\sdoesn't\shave\sany\s"repeat\suntil\sdone"\nflavor\sto\sit.\s\sAs\sa\sbonus,\sit\sseems\sto\sbe\sfaster\sthan\sthe\sold\sone,\nand\sit's\sclearer\sthat\sit\screates\sall\sthe\srequired\sreplacement\sarcs.\n\nA\sfew\smiscellaneous\snotes:\n\n*\sIt\swas\salleged\sin\sthe\scomments\sto\s3604074\sthat\sPostgres\shad\sfixed\sthis\nbug,\sbut\sactually\sthe\sreason\sit\sdoesn't\sshow\sup\sfor\sus\sis\sonly\sthat\sin\nhttp://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=173e29aa5deefd9e71c183583ba37805c8102a72\nwe\shad\sgotten\srid\sof\sthe\sexpansion\sof\s"a*"\sto\s"a+|",\sand\sit's\sthe\sempty\nalternative\sthat's\stickling\sthis\sbug.\s\sIf\syou\stry\nselect\s'a'\s~\s'((((((a+|)+|)+|)+|)+|)+|)';\nit\sstill\sfails\sin\sreleased\sPostgres\sversions.\n\n*\sThe\sreason\sI\sfound\sout\sthat\syour\spatch\sis\sbroken\sis\sthat\sas\sPostgres\nhas\sthings\sset\sup,\sthe\sassert()s\sin\sSpencer's\scode\sare\senabled\sin\nstandard\sdevelopment\sbuilds.\s\sThis\sevidently\sisn't\sthe\scase\sin\sTcl,\nbut\sI\ssuggest\syou\smight\swant\sto\srethink\sthat.\n\n*\sWhile\sfooling\swith\sthe\sfixempties\salgorithm,\sI\sfound\sthat\sit\swas\svery\neasy\sto\smake\sCVE-2007-4772\s(the\sinfinite\sloop\sin\spullback()\sfor\s"($|^)*")\ncome\sback,\sif\sthe\soutput\sNFA\swas\seven\sslightly\snonoptimal.\s\sSo\sI\sfear\sthat\nthat\sbug\sis\snot\sreally\sfixed\seither:\sit\sseems\sto\sbe\sfairly\seasy\sto\smake\npullback()\screate\snew\sstates\sas\sfast\sas\sit\scan\sprocess\sthem.\s\spullback\nlooks\svaguely\ssimilar\sto\swhat\sfixempties\sis\sdoing,\sso\sI\swonder\swhether\sit\ncould\sbe\srewritten\sin\sa\ssimilar\sstyle\sto\sthis\spatch.\s\sI've\snot\stried\sit\nthough.\n
J foundin current:\s8.6.0
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter tgl
J subsystem 43.\sRegexp
J title fix\sfor\s3604074\sdoes\snot\swork
J type Bug
K 3606683fffffffffffffffffffffffffffffffff
U tgl
Z 349262405d8967fe72a8751cf39f06a9