<i>[file] inconsistent handling of VFS/..</i> status still Open with 3 other changes
by
.
D 2018-06-15T14:13:28.723
J icomment The\ssame\sas\sregards\sthe\sother\sfile\scommands\susing\sTclpObjStat\s/\sTclOSstat\s(at\sleast\sby\sthe\ssecond\scall)...\r\n\r\n<pre\sstyle="padding-left:10pt"><code>\r\n%\sfile\sexists\s[string\strim\s"\s/etc/passwd/..\s"]\r\n1\r\n%\sfile\sexists\s[pwd]\r\n1\r\n%\sfile\sexists\s[string\strim\s"\s/etc/passwd/..\s"]\r\n0\r\n</code></pre>\r\n\r\nStrange\sis\sif\sI\sextend\sTclpObjStat\swith\spath\snormalization\s(that\snormally\sshould\sdo\salways\sthe\ssame\sthing),\sit\sworks?!\r\n\r\n<pre\sstyle="padding-left:10pt"><code>\r\n---\s"a/./unix/tclUnixFile.c~0"\r\n+++\s"b/./unix/tclUnixFile.c"\r\n@@\s-842,7\s+842,20\s@@\sTclpObjStat(\r\n\s\s\s\s\sif\s(path\s==\sNULL)\s{\r\n\s\treturn\s-1;\r\n\s\s\s\s\s}\selse\s{\r\n<b\sstyle="color:red;">-\treturn\sTclOSstat(path,\sbufPtr);</b>\r\n<b\sstyle="color:green;">+\tint\src\s=\sTclOSstat(path,\sbufPtr);\r\n+\tif\s(rc\s==\s-1\r\n+\s\s\s\s#ifdef\sENOTDIR\r\n+\t\s\s\s&&\serrno\s==\sENOTDIR\r\n+\s\s\s\s#endif\r\n+\t)\s{\r\n+\t\s\s\s\sTcl_Obj\s*normPtr\s=\sTcl_FSGetNormalizedPath(NULL,\spathPtr);\r\n+\t\s\s\s\sif\s(normPtr\s==\sNULL)\s{\r\n+\t\treturn\s-1;\r\n+\t\s\s\s\s}\r\n+\t\s\s\s\spath\s=\sTcl_GetString(normPtr);\r\n+\t\s\s\s\src\s=\sTclOSstat(path,\sbufPtr);\r\n+\t}\r\n+\treturn\src;</b>\r\n\s\s\s\s\s}\r\n\s}\r\n</code></pre>\r\n\r\nSo\sI\sassume\sthat\snot\sonly\sthe\sfile\saccess\sresp.\sfile\ssystem\sapi\sselecter\sis\saffected,\s<b>but\salso\sthe\sprecedence\sof\sthe\spath\snormalization:</b><ul>\r\n<li>rather\sit\sshould\salways\sfirstly\sresolve\sthe\spath-segments;</li>\r\n<li>or\sthe\spath-segments,\sthat\scould\sbe\sreally\saccessed\sby\scorresponding\sfile-system\s(and\sonly\shereafter\sthe\srest);</li>\r\n<li>or\sit\sremains\sUB\sas\snow;</li>\r\n</ul>\r\n\r\nCurrently\swe've\sa\smix\sthere,\salthough\svery\sconfusing\smix.\r\n\r\nSo\sfirstly\sI\swould\slike\sto\sknow\sthe\sexpected\sprecedence\sregarding\spath-segments\sand\sfile\saccess.\r\nOr\sanswer\sto\squestion:\sshould\s<code>[file\sdirname\s"/some/path"]</code>\spoint\sto\sthe\ssame\spath\sas\s"/some/path/..",\sand\sif\snot,\swhich\sdeviations\sthere\sare?
J login sebres
J mimetype text/x-fossil-wiki
K 3e25ac512e9eeb8788028264c400238fcf425238
U sebres
Z 3bbd7e6ef6b43eaf957e924c5125847c