New issue
Advanced search Search tips

Issue 629437 link

Starred by 5 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Mac
Pri: 3
Type: Feature



Sign in to add a comment

Symbolic links are resolved when passed on the command line

Reported by pa...@cloudflare.com, Jul 19 2016

Issue description

Hello!

Chrome Version       : Version 51.0.2704.103 (64-bit)
OS version               : 10.11.5 (15F34)
Behavior in Safari 3.x/4.x (if applicable):
Behavior in Firefox 3.x (if applicable):
Behavior in Chrome for Windows:

What steps will reproduce the problem?
(1) Create folder with example file:

mkdir ~/myapp_original_path
echo "hello world" > ~/myapp_original_path/index.txt

(2) Create folder which symlinked to original folder:

mkdir ~/myapp_symlinked_path
ln -s  ~/myapp_original_path ~/myapp_symlinked_path/myproject

(3) At this step we have two names for index.txt:
~/myapp_original_path/index.txt
~/myapp_symlinked_path/myproject/index.txt


Then I tried to open this file with second name (with symlink part) with Chrome:
 /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome ~/myapp_symlinked_path/myproject/index.txt


What is the expected result?

I want to see path with symlinked component "~/myapp_symlinked_path/myproject/index.txt".

What happens instead?

I'm getting original path in address bar "file:///Users/pavel/myapp_original_path/index.txt". 

 
Does any other browser do what you expect?
Labels: Needs-Feedback OS-Linux
Also reproducible on Linux. 
Hello!

Safari handles this task correctly as I've expected. FireFox is doing this in same way as Chrome.
Firefox.png
96.3 KB View Download
Safari.png
49.9 KB View Download
Labels: Te-NeedsFurtherTriage
Project Member

Comment 5 by sheriffbot@chromium.org, Jul 20 2016

Labels: -Needs-Feedback Needs-Review
Owner: karandeepb@chromium.org
Thank you for providing more feedback. Adding requester "karandeepb@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Components: UI>Browser>Navigation
Labels: -Needs-Review -Te-NeedsFurtherTriage
Owner: ----
Status: Untriaged (was: Unconfirmed)
Hi, guys!

May I ask about status?

That's really mandatory for any Atom IDE users who want to develop in Go language.

This feature broke all black magic for GOPATH.
Cc: creis@chromium.org clamy@chromium.org mea...@chromium.org
+people who might have an opinion on this.

Comment 9 by mea...@chromium.org, Jul 29 2016

Would there be a command line flag to choose between these, or would we default to always showing the symlink? I can't think of a particular security concern with the latter, but I haven't thought it thoroughly either.

Comment 10 by creis@chromium.org, Jul 29 2016

Cc: pkasting@chromium.org
Owner: brettw@chromium.org
Sounds like a URL canonicalization issue.  brettw@ or pkasting@ may have thoughts on whether it can be fixed.
I don't know enough about canonicalization to know where this would be offhand, and lack a Linux box to set up true symlinks to test.
URl parsing and canonicalization doesn't touch disk. If any code is doing this, it's in the net component.
Cc: mmenke@chromium.org
Components: Internals>Network
mmenke@: Do you know any network folks who might be familiar with this (per comment 12)?
Labels: -Type-Bug Type-Feature
net/ doesn't actually support symlinked paths.  You can verify this by going to file:///Users/pavel/myapp_symlinked_path/index.txt (Modified as appropriate).  I'd guess that this behavior is handled by the code that handles processing/validating of URLs passed to Chrome on the command line.  This code does not live in net/.

Presumably if we wanted to remove that logic, we'd want to add support in net/ for using symlinked paths, first.  Note that this raises potential security questions for any code that does security checks on file URLs (We do this on Android, not sure if we do it elsewhere).
Summary: Symbolic links are resolved when passed on the command line (was: I would like to open local file without following symbolic link)
I looked into this.

This doesn't happen if you type in the URL bar, it only happens from the command-line.

This is happening in the code that interprets the command line. The command-line handling is special because you can type "google.com" to go to Google (despite this not being a real URL), or relative file names.

As part of this, url_fixer.cc's ValidPathForFile calls base::MakeAbsoluteFilePath to get the absolute path to the input. This function ends up calling (on Posix) realpath(). This resulting path is then used to construct the final file URL.

realpath() is doing a bunch of work for us in terms of resolving ".." stuff and probably handles a bunch of weird edge cases that I can't even think of.

If you want to work around this, you can always supply a real file URL on the command line, or type the URL you want in the URL bar.
Is it even possible to avoid having ValidPathForFile() call MakeAbsoluteFilePath()?  In other words, if we left relative paths as relative, could we successfully open them?

I'm wondering if the "resolving .. stuff" etc. is fixup that we truly need to do.
file URLs don't support relative paths.  If you prefixed relative paths with the current directory, though, and then just wrapped them in a file GURL, that would work.
Brett, do you think converting MakeAbsoluteFilePath() to do the dumber implementation in comment 17 would break things?
I can't think of what comment 17 would break offhand. It would need to be implemented carefully. The obvious way is to do FilePathToFileURL(GetCurrentDirectory() + "/").ResolveRelative(input)
but if there are special characters in the input like # or ? they won't be escaped properly for file URLs.
Owner: ----
Components: -Internals>Network
Removing Internals>Network based on c#14/15; it sounds like the locus of this problem isn't in net/

Sign in to add a comment