Closed Bug 65562 Opened 25 years ago Closed 24 years ago

nsIFile Unix GetTarget does not resolve recursively

Categories

(Core :: XPCOM, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 88032
Future

People

(Reporter: dougt, Assigned: dougt)

Details

nsIFile GetTarget on windows and the macintosh resolve all alias/shortcut in the file path and returns a new file path to the "target" file free from symlinks. Unix should be modified to do the same. Also there is a possible name conflict here. Here is /be's comments: But when exec'ing on Unix, you want the kernel to get the symlink-laden pathname, not the "real path" -- you must not break symlink transparency, and since the process can get its exec'd name and some programs do depend on that to find other files (by looking at the parent dir), the pathname given to nsIFile or nsIProcess should be the one that the exec'd program sees in argv[0].
GetTarget (a readonly target attribute in IDL, JS, etc.) might be a good name for something that does readlink(2) on Unix, but for a method/attribute-getter that expands all symlinks in a pathname, we want GetRealPath (realPath in IDL) or some such name -- man 3 realpath on Unix-y systems for precedent. But wait: nsLocalFileUnix.cpp's nsLocalFile::Normalize calls realpath! It has to, otherwise it cannot safely remove ../ components. Given this existing method, why do we need a GetTarget? The answer can only be to provide readlink, i.e., given an nsIFile denoting a symlink, get its contents. This says that the current Windows GetTarget implementation, which expands all shortcuts, is wrong, and should be done only under Normalize on windows. Right? /be
Target Milestone: --- → Future
I beleive this bug can be closed based on the fix checked in for bug 88032 Unless Brendan feels otherwise? Thanks --pete
if you object, please reopen. *** This bug has been marked as a duplicate of 88032 ***
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
Component: Talkback → XPCOM
You need to log in before you can comment on or make changes to this bug.