.
D 2000-10-26T00:43:32
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s682\sBug\nVersion:\s8.0.3\nSubmitDate:\s'1998-09-24'\nLastModified:\s'2000-04-26'\nSeverity:\sLOW\nStatus:\sClosed\nSubmitter:\swelch\nChangedBy:\shobbs\nRelatedBugIDs:\s582\s1470\nOS:\sAll\sWindows\nFixedDate:\s'2000-10-25'\nFixedInVersion:\sNA\nClosedDate:\s'2000-04-26'\n\n\nThis\sis\sa\sbug\son\sthe\s*unix*\sside\sfor\stclsh\s(it\sis\sstill\spresent\sin\s8.0.3).\n\nWhen\syou\sdo\n\nset\sx\s[exec\sgcc\s-v\s2>@\sstdout]\n\nyou\sget\sthe\schild's\sstderr\sinto\s$x.\s(gcc\s-v\swrites\sto\sits\sstderr)\n\nThis\s*is*\sa\sbug,\sbecause\shere\s"2>@\sstdout"\sbehaves\sexactly\slike\s"2>&1"\nin\s\sBourne\sshell;\s\sthis\s\sis\snot\sthe\sproper\ssemantics\sfor\s\sTcl,\sbecause\n"@stdout"\sshould\sbe\sinterpreted\sas\s"tclsh's\sstdout"\sand\s*not*\swhat\sthe\n"1"\sfile\sdescriptor\shappens\s\sto\sbe\s\sat\sthat\s\stime\s(within\s\sthe\schild),\ni.e.\sexec's\soutput\spipe.\n\nAnother\s\sway\sof\s\slooking\s\sat\sit:\sthis\s\ssemantics\s\sshould\smake\s\sthe\s">@\nstdout"\sconstruct\sequivalent\sto\snothing.\sBut\sit\sis\snot:\n\nset\sx\s[exec\sdate\s>@\sstdout]\n\nproperly\s\soutputs\sthe\s\sdate\s\sto\stclsh's\sstdout,\s\sand\sstores\s\sthe\sempty\nstring\sin\sx.\s\sSo\sthere\sseems\sto\sbe\sa\sspecial\scase\saround\s2>@stdout.\n\nNasty,\seh\s?\n\n\sPlease\snote\sthat\sIan\sTaylor's\s"patch"\s(in\s\syour\sPatches\spage)\son\sthis\nsubject,\s\sduplicates\sthis\s\s*wrong*\s\sbehavior\son\sWindows,\s\sbecause\s\sIan\nfinds\sit\shandy\sfor\shis\sparticular\scase...\sSo\sI'm\salso\ssaying\sthat\sthis\npatch\s\s\sshould\s\s\sbe\s\s\srejected.\s\s\s\s(But\s\s\s\sI\s\s\sgot\s\s\sno\s\s\sreply\s\s\sfrom\[email protected]).\n\n\sIan\sand\sI\shave\scome\sto\sthe\sagreement\sthat\sa\s*feature*\sshould\sbe\sadded\ninstead:\sallowing\sthe\sBourne\sshell\s"N>&P"\snotation\s(N\sand\s\sP\sin\s[0-9])\ninside\s\sexec\sand\sopen.\sThis\ssyntax\sextension\s\swould\ssupport\sthe\swanted\nlow-level\sdescriptor\ssemantics,\shence\she\scould\swrite:\n\nset\sx\s[exec\sgcc\s-v\s2>&1]\n\nwhile\n\nset\sx\s[exec\sgcc\s-v\s2>@\sstdout]\n\nwould\scorrectly\soutput\s\sthe\sgcc\s\sversion\sto\stclsh's\sstdout,\s\sand\sstore\nthe\sempty\sstring\sinto\sx.\n\n\nHere\sis\sa\smore\sconsise\sdescription\sof\sthe\sproblem:\n\nCurrently\son\sunix:\n%\sputs\s"{[exec\secho\splop\s>@\sstdout]}"\n{}\n\n#\s\sThis\s\sis\s\scorrect:\s\s">@\sstdout"\smeans\s"redirect\sthe\n#\schild's\sdescriptor\s1\sto\sTcl's\sstdout".\n\nHowever:\n%\sputs\s"{[exec\ssh\s-c\s{echo\splop\s>&2}\s2>@\sstdout]}"\n{plop}\n\n#\s\sThis\sis\swrong:\shere\s"2>@\s\sstdout"\sis\sinterpreted\sas\n#\s"redirect\sthe\schild's\sdescriptor\s2\sto\sits\sdescriptor\n#\s1\s(which\sis\sthe\spipe\sgathering\sexec's\sresult)"\n\n#\sIn\sother\s\sterms\s"2>@\sstdout"\sbehaves\s\sas\s\s"2>&1"\s\sin\n#\sBourne\sshell;\s\sthis\s\scan\sbe\s\sseparately\suseful,\s\sbut\n#\sit's\snot\shmogeneous\swith\sthe\sfirst\scase.\n\n#\sNote\salso\sthat\s\sthis\sonly\saffects\s\s"2>@\sstdout".\sAll\n#\sother\srelated\s\scases,\slike\s"2>@\s\sother_stream",\s\s">@\n#\sstdout",\s\s"<@\s\sstdin",\s\sand\seven\s\s">&@\sstderr",\swork\n#\scorrectly.\n\n#\sSo\s\sall\s\sthis\samounts\sto\sa\sstrange\sand\sbuggy\sspecial\n#\scase\s\sfor\s\s2>@\sstdout.\s\sIronically,\s\sthis\sis\sexactly\n#\sthis\sstrange\sand\s\sbuggy\sspecial\scase\sthat\sIan\sTaylor\n#\swanted\sto\s'port'\sto\sthe\sWindoze\sworld...\n\s\n--\s04/26/2000\shobbs
J foundin obsolete:\s8.0.3
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 60.\sNRE\sand\scoroutines
J title Semantics\sof\sredirect:\s2>@stdout\smay\snot\sbe\scorrect
J type Bug
K 217779ffffffffffffffffffffffffffffffffff
U nobody
Z 57293c54fb5379a2ff1179ded929bee3