Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed current_working_directory() to bypass static file links in path… #7

Merged
merged 1 commit into from
Nov 29, 2017
Merged

fixed current_working_directory() to bypass static file links in path… #7

merged 1 commit into from
Nov 29, 2017

Conversation

JorySchossau
Copy link
Contributor

@JorySchossau JorySchossau commented Nov 28, 2017

… and return the real path

Fixes #6

get_current_dir_name() returns a path that follows symlinks which is different from all(?) other paths used in zupply. The difference created a problem where the relative paths returned for a file would contain multiple circuitous "../sameDirAgain" in a row. This fix replaces get_current_dir_name() with realpath() which circumvents symlinks.

This change did not break any more unittests than before (2 related to images are broken?)

@zhreshold
Copy link
Owner

Can you double check if realpath is always available in GNU?

@JorySchossau
Copy link
Contributor Author

JorySchossau commented Nov 29, 2017

Does this matter? I only used it in this patch because it was being used elsewhere in zupply already.
To answer your question I'm not sure how to definitively check that, but I did find this:
"The advantage of using this function [realpath] is that it is more widely available [than the alternative canonicalize_file_name]. The drawback is that it reports failures for long path on systems which have no limits on the file name length."
from ftp://ftp.gnu.org/old-gnu/Manuals/glibc-2.2.3/html_chapter/libc_14.html

Also, get_current_dir_name has the extra stipulation that it is a GNU extension, whereas realpath does not, which I assume means it's part of basic GNU?

@zhreshold zhreshold merged commit 7c1f1bf into zhreshold:master Nov 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

relative paths are wrong when symlinks in path (*nix)
2 participants