Skip to content
Tcl Source Code Artifact [c9d843e84d]
Login

Artifact [c9d843e84d]

Artifact c9d843e84d95806d7a9b106b950987877d06c1f7:

Ticket change [c9d843e84d] - Closed ticket [2647951fffffffff|2647951fff]: <i>Error in exec ends stdin</i> plus 7 other changes by ferrieux on 2009-03-01 17:57:43.
D 2009-03-01T17:57:43
J closedate 2009-03-01T10:57:43
J closer ferrieux
J icomment \n\nallow_comments\s-\s1\n\nOK\sgot\sit.\sThis\sis\snot\sa\sTcl\snor\sLinux\sproblem,\sjust\sone\sspecific\sbehavior\sof\scsh.\nDetails\sfrom\sthe\sstrace:\n\n12200\s09:32:12.664493\sexecve("/bin/csh",\s["csh"...,\s"-fc"...,\s"echo\shello\s>fff"...],\s[/*\s69\svars\s*/]\s<unfinished\s...>\n12200\s09:32:12.675081\sdup2(0,\s16)\s\s\s\s\s\s\s=\s16\n12200\s09:32:12.747895\sopen("fff",\sO_WRONLY|O_CREAT|O_TRUNC,\s0666)\s=\s-1\sEACCES\s(Permission\sdenied)\n12200\s09:32:12.748463\swrite(18,\s"fff:\sPermission\sdenied.\\n",\s24)\s=\s24\n12200\s09:32:12.748541\slseek(16,\s0,\sSEEK_END)\s=\s8660\n\nExplanation:\n\n(1)\sThe\sdup2\sis\spart\sof\sthe\sredirections\sfor\sthe\s"echo\shello"\scommand.\sIt\sjust\sinherits\sdesc\s0\sbecause\sthere\sis\sno\sredirection\son\sstdin.\n(2)\sCsh\stries\sto\shonour\sthe\s>\sredirection,\sand\sgets\san\s(expected)\serror.\sIt\sbarfs\sto\sstderr\s(which\sis\sokay).\n(3)\s*but*\sit\salso\sdecides\sto\sskip\sahead\sto\sthe\send\sof\sthe\slocal\ssubcommand's\sstdin\s(lseek(16,...))\n(4)\sAll\sthis\shooks\sback\sto\sTcl's\sstdin\ssince\sthe\s[exec\scsh]\shas\sno\sstdin\sredirection\seither.\n(5)\sHence\son\sthe\snext\sattempt\sto\sread,\sthe\sTcl\sIO\ssubsystem\sgets\san\sEOF.\sQED.\n\nI\shave\sno\sidea\swhy\sCsh\sdoes\s(3).\sAt\sthe\sextreme\sit\scould\svaguely\smake\ssense\sfor\san\sinteractive\sCsh\sto\sdo\sthat\son\sa\sterminal,\sso\sthat\sit\sskips\sto\snew\styped\scommand\swhen\san\serror\shas\soccurred\sin\sa\sbuffered\sblock\sof\scommands...\sBut\shere\sthe\sCsh\sis\snot\sinteractive.\sFrom\smy\sseat\sit\sis\sa\sfully\squalified\sBug.\n\nA\ssimple\sworkaround\sis\sto\s[exec\scsh\s...\s<\s/dev/null].\n\nI'll\sthus\sclose\sthis\sartifact\sas\sInvalid,\ssince\sTcl\scannot\sbe\sheld\sresponsible\sfor\sCsh's\smisbehavior.\nMy\spersonal\stake\son\sCsh\sis:\sonly\suse\sit\sinteractively\sif\sever.\sThat's\snot\sa\sprogramming\slanguage.\sThat's\san\sengineer's\snightmare.\n*Always*\suse\s/bin/sh\swhen\syou\sneed\sto\sresort\sto\san\sOS\sshell.\n\n\n
J login ferrieux
J mimetype text/plain
J resolution Invalid
J status Closed
J username ferrieux
K 2647951fffffffffffffffffffffffffffffffff
U ferrieux
Z 9b6662310d2f57697baa2e33a5633c7f