Skip to content
Tcl Source Code Artifact [f42130bad5]
Login

Artifact [f42130bad5]

Artifact f42130bad5793565e957d64526f819ada0f1f762:

Ticket change [f42130bad5] - New ticket [1064247fffffffff|1064247fff] <i>filesystem-7.8 fails on darwin without NO_REALPATH</i>. by das on 2004-11-11 01:31:22.
D 2004-11-11T01:31:22
J assignee vincentdarley
J cmimetype text/plain
J comment filesystem-7.8\sfails\son\sdarwin\swhen\srealpath()\sis\sused,\sand\ssucceeds\s\notherwise.\sThe\sfailure\sis\sthat\ncd\ssimplefs:/simpledir\nsucceeds\sbut\sdoes\snot\schange\sthe\scurrent\sdirectory\n\nI've\stracked\sthis\sdown\sto\sdiffering\sbehaviour\sin\s\nTclpObjNormalizePath()\swhen\snormalizing\s'simplefs:/simpledir'\s\ndepending\son\sNO_REALPATH\sbeing\sdefined:\n\n-\swith\sNO_REALPATH,\sthe\s"slow\sway"\sof\sgetting\sthe\ssubpath\sto\sbe\s\nnormalized\sat\sthe\sstart\sof\sTclpObjNormalizePath()\sfails\sat\saccess()\s\non\sthe\sfirst\spath\scomponent\s'simplefs:',\swhich\sleads\sto\sthe\scorrect\s\nreturn\svalue\sof\s'simplefs:/simpledir'\sas\sexpected.\n-\swithout\sNO_REALPATH,\sthe\sfast\sway\sof\susing\srealpath()\sto\sget\sthe\s\nsubpath\sto\sbe\snormalized\scalls\s'realpath("simplefs:")'\swhich\sreturns\s\nthe\sabsolute\spath\s"[pwd]/simplefs:",\sthis\sleads\sto\s\nTclpObjNormalizePath()\sreturning\sthe\sincorrect\svalue\s'[pwd]/\nsimplefs:/simpledir'.\n\nthe\sresult\sof\sthis\spath\snormalization\sis\sused\sto\sidentify\sthe\s\nfilesystem\sowning\sthe\spath\sin\squestion,\sthis\sfails\sto\sfind\sthe\s\nsimplefilesystem\sin\sthe\ssecond\scase\swhich\sends\sup\sleading\sto\sthe\s\ntest\sfailure\n\nthe\scrux\sof\sthe\sissue\sstems\sfrom\sthe\sbehaviour\sof\srealpath()\son\s\nrelative\spaths.\sThe\sBSD\sspec\ssays\sthat\srealpath()\salways\sreturns\san\s\nabsolute\spath,\sand\sthat\sall\sexcept\sthe\slast\spath\scomponent\sgiven\s\nmust\sexist\s(c.f.\smanpage\sbelow).\sThis\sis\sexactly\swhat\sseems\sto\s\nhappen\sin\sthis\scase\son\sdarwin,\sso\sit\slooks\slike\sthe\sdesign\sof\s\nTclpObjNormalizePath()\sdidn't\stake\sBSD\srealpath\sinto\saccount?\s\naccording\sto\sthe\scaveats\sin\sthe\smanpage,\ssolaris\srealpath()\sdoesn't\s\nbehave\sin\sthe\ssame\sway,\sthis\smay\salso\sbe\strue\son\sother\splatforms?\n\nas\sI've\sproposed\sin\sthe\spast,\smaybe\sa\scompat/\simplementation\sof\s\nrealpath()\sis\sneeded\sthat\sbehaves\sthe\ssame\son\sall\splatforms?\sthis\s\nwould\salso\ssolve\sthe\snon-thread\ssafeness\sissue\sof\srealpath()\son\s\ndarwin\sthat\srequires\sNO_REALPATH\sto\sbe\sdefined\sin\sthe\sthreaded\s\nbuild.\n\n\n\nREALPATH(3)\s\s\s\s\s\s\s\s\s\s\s\s\s\sBSD\sLibrary\sFunctions\sManual\s\s\s\s\s\s\s\s\s\s\s\s\s\s\nREALPATH(3)\n\nNAME\n\s\s\s\s\srealpath\s-\sreturns\sthe\scanonicalized\sabsolute\spathname\n\nLIBRARY\n\s\s\s\s\sStandard\sC\sLibrary\s(libc,\s-lc)\n\nSYNOPSIS\n\s\s\s\s\s#include\s<sys/param.h>\n\s\s\s\s\s#include\s<stdlib.h>\n\n\s\s\s\s\schar\s*\n\s\s\s\s\srealpath(const\schar\s*pathname,\schar\s\nresolved_path[PATH_MAX]);\n\nDESCRIPTION\n\s\s\s\s\sThe\srealpath()\sfunction\sresolves\sall\ssymbolic\slinks,\sextra\s``/''\s\ncharac-\n\s\s\s\s\sters\sand\sreferences\sto\s/./\sand\s/../\sin\spathname,\sand\scopies\sthe\s\nresulting\n\s\s\s\s\sabsolute\spathname\sinto\sthe\smemory\sreferenced\sby\s\nresolved_path.\s\sThe\n\s\s\s\s\sresolved_path\sargument\smust\srefer\sto\sa\sbuffer\scapable\sof\s\nstoring\sat\sleast\n\s\s\s\s\sPATH_MAX\scharacters.\n\n\s\s\s\s\sThe\srealpath()\sfunction\swill\sresolve\sboth\sabsolute\sand\srelative\s\npaths\sand\n\s\s\s\s\sreturn\sthe\sabsolute\spathname\scorresponding\sto\spathname.\s\sAll\s\nbut\sthe\slast\n\s\s\s\s\scomponent\sof\spathname\smust\sexist\swhen\srealpath()\sis\scalled.\n\nRETURN\sVALUES\n\s\s\s\s\sThe\srealpath()\sfunction\sreturns\sresolved_path\son\ssuccess.\s\sIf\san\s\nerror\n\s\s\s\s\soccurs,\srealpath()\sreturns\sNULL,\sand\sresolved_path\scontains\sthe\s\npathname\n\s\s\s\s\swhich\scaused\sthe\sproblem.\n\nERRORS\n\s\s\s\s\sThe\sfunction\srealpath()\smay\sfail\sand\sset\sthe\sexternal\svariable\s\nerrno\sfor\n\s\s\s\s\sany\sof\sthe\serrors\sspecified\sfor\sthe\slibrary\sfunctions\slstat(2),\n\s\s\s\s\sreadlink(2)\sand\sgetcwd(3).\n\nCAVEATS\n\s\s\s\s\sThis\simplementation\sof\srealpath()\sdiffers\sslightly\sfrom\sthe\s\nSolaris\n\s\s\s\s\simplementation.\s\sThe\s4.4BSD\sversion\salways\sreturns\sabsolute\s\npathnames,\n\s\s\s\s\swhereas\sthe\sSolaris\simplementation\swill,\sunder\scertain\s\ncircumstances,\n\s\s\s\s\sreturn\sa\srelative\sresolved_path\swhen\sgiven\sa\srelative\spathname.\n\nSEE\sALSO\n\s\s\s\s\sgetcwd(3)\n\nHISTORY\n\s\s\s\s\sThe\srealpath()\sfunction\sfirst\sappeared\sin\s4.4BSD.\n\nBSD\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sFebruary\s16,\s1994\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\nBSD\n
J foundin obsolete:\s8.5a2
J priority 5\sMedium
J resolution None
J status Open
J submitter das
J subsystem 37.\sFile\sSystem
J title filesystem-7.8\sfails\son\sdarwin\swithout\sNO_REALPATH
J type Bug
K 1064247fffffffffffffffffffffffffffffffff
U das
Z e823b0afd3d3236e9ef40d94c0dfebce