So assuming a relative URI
../file.ext
Would the parent be
../
or
../../file.ext
If its the first, then what’s the parent of
../
and it’s the second, what would terminate a potentially infinite cycle if one were to repeatedly call a hypothetical getParent method upon it?
Given a “current directory” of
then
../file.extwill beand
../../file.extwill beGiven a
getParent()function, it’d have to stop when it reaches the top level of the filesystem. That’s trivial to check for by looking at the inode numbers of.and... If they match, you’re at the top of the tree. By definition, doing ‘..’ at the top of the tree will just return the top of the tree again.