I have a script for building a particular flavor of GCC cross-compiler. Throughout the script there are many paths that are not in canonical form, such as duplicate path separators (/xxx/foo//bar/yyy
) and intervening "this" directories (/xxx/foo/./bar/yyy
).
I was about to canonicalize all of them, but I wonder if these forms are significant rather than just a case of the script not being cleaned up. In addition to the forms just mentioned, I am also curious whether including an "up directory" in a path can also be significant in any particular situation (ie. "/xxx/foo/../bar/yyy
instead of /xxx/bar/yyy
). For example, I came across a path like /xxx/foo/.//bar/yyy
.
The only potential situation that I can think of is when links are involved. I can imagine that the ..
form might behave differently, but how about the other two forms above?
Perhaps there is also platform-specific reasons for constructing paths in this way..?
dir1/./dir2
to limit relative paths. The manual page contains more information at the--relative
option entry. Only the structure following the dot will be transferred to the destination side. – lgarzo May 31 '12 at 16:19foo//bar
), see How linux handles multiple path separators (/home////username///file) – Gilles 'SO- stop being evil' May 31 '12 at 22:58