tag:blogger.com,1999:blog-7094652.post3607911153254862627..comments2024-03-23T14:36:09.980+00:00Comments on Neil Mitchell's Blog (Haskell etc): FilePaths are subtle, symlinks are hardNeil Mitchellhttp://www.blogger.com/profile/13084722756124486154noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-7094652.post-9739442526369570862020-03-01T15:27:31.127+00:002020-03-01T15:27:31.127+00:00Big exclamation marks in documentation often goes ...Big exclamation marks in documentation often goes wrong. As it is, FilePath doesn't provide anything for producing relative paths in either way. If you think such functionality is needed, I recommend creating a library with it in. If others use it a lot, the functionality could be moved into filepath proper.Neil Mitchellhttps://www.blogger.com/profile/13084722756124486154noreply@blogger.comtag:blogger.com,1999:blog-7094652.post-68417044961107884182020-02-29T07:58:33.405+00:002020-02-29T07:58:33.405+00:00Well, you are right of course - but.
I don't ...Well, you are right of course - but.<br /><br />I don't think that is a good reason to not provide any functionality for resolving .. in paths, or to create a relative path from /a/b/c to /a/b/d == ../d.<br /><br />For example in my current situation I know exacty what the situation with symlinks is, I need a relative path of that kind - and now I need to look somewhere else for it, or do it myself :(<br /><br />If you want to create awareness of the issue, fine, create two separate functions, put big exclamation marks into the documentation, fine.<br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7094652.post-78740268825283795262015-10-31T16:22:51.953+00:002015-10-31T16:22:51.953+00:00I see. I looked at it from another angle, which c...I see. I looked at it from another angle, which caused the confusion. I think I should also try this mathematical way of thinking later on. Thank you.<br /><br />Sincerely yours,<br />Guanpeng XuAnonymoushttps://www.blogger.com/profile/05083291965149396265noreply@blogger.comtag:blogger.com,1999:blog-7094652.post-2380755770684505552015-10-30T13:29:10.940+00:002015-10-30T13:29:10.940+00:00Guanpeng: My use of equality was to imply somethin...Guanpeng: My use of equality was to imply something people thought was correct, and then show by following symlinks etc. that it wasn't correct, so all those equalities are intended to be "what people thought to be true, but is in fact false". I've noted that after the final one, saying they are untrue, which I forgot to do the first time round. Does that make it clear?Neil Mitchellhttps://www.blogger.com/profile/13084722756124486154noreply@blogger.comtag:blogger.com,1999:blog-7094652.post-51907956955014518112015-10-29T00:08:24.811+00:002015-10-29T00:08:24.811+00:00Yes but your example seemed to mean
/bob/home...Yes but your example seemed to mean<br /><br /> /bob/home/../cookies == /tony/cookies<br /><br />instead of<br /><br /> /tony/home/../cookies == /bob/cookies<br /><br />Sincerely yours,<br />Guanpeng XuAnonymoushttps://www.blogger.com/profile/05083291965149396265noreply@blogger.comtag:blogger.com,1999:blog-7094652.post-62892316086287742382015-10-28T10:40:48.927+00:002015-10-28T10:40:48.927+00:00Guanpeng: I've updated the post with the full ...Guanpeng: I've updated the post with the full example. Does that make it clearer?<br /><br />Unknown: That's a very interesting paper, thanks for the link and the information. I still find it weird that you can actually make .. point somewhere else entirely, and that by default getDirectoryContents (in Haskell at least) returns .. which is rarely what you want.Neil Mitchellhttps://www.blogger.com/profile/13084722756124486154noreply@blogger.comtag:blogger.com,1999:blog-7094652.post-12981831376062196152015-10-27T18:31:31.030+00:002015-10-27T18:31:31.030+00:00For whatever it's worth, this is one of the ma...For whatever it's worth, this is one of the major painpoints of UNIX: ".." is actually a dentry that points back up the tree (meaning that not only are filesystems not the DAGs we think they are, almost all inter-directory-node links are loopy!). People get confused easily because most *shells* deliberately provide the "a/b/../c == a/c" view, by keeping track of the path of chdirs rather than using the ".." dentry.<br /><br />This, like so many things, was fixed in Plan 9: See Rob Pike's "Lexical File Names in Plan 9 or Getting Dot-Dot Right".Unknownhttps://www.blogger.com/profile/11626470789240986650noreply@blogger.comtag:blogger.com,1999:blog-7094652.post-30827997461404325512015-10-27T05:33:37.963+00:002015-10-27T05:33:37.963+00:00Excuse me, but I have read this many times but sti...Excuse me, but I have read this many times but still fail to understand the subtle case. Could you please show the directory structures as in the format of `ls -lR`? Thanks.<br /><br />Sincerely yours,<br />Guanpeng XuAnonymoushttps://www.blogger.com/profile/05083291965149396265noreply@blogger.com