-
Notifications
You must be signed in to change notification settings - Fork 15
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
Relative paths resolve incorrectly - #15
Comments
Python fixed here: 95ddc32 |
This needs to be fixed at some point, but the pf* wrapper scripts now change relative paths to full paths. So, we can get by without fixing this for Secure Campaign because we'll only allow users to use these wrapper scripts. |
pftool could generate absolute paths by either (a) calling realpath(), or (b) simulating realpath() by prepending cwd and then canonicalizing using just regular expressions. However, for marfs paths, the former approach would fail on back-end nodes where there is no marfs fuse-mount. The latter approach would produce unexpected results for paths that include symlinks that refer to directories with parents that are different from the parent of the symlink. (For example: "./my_dir_link/../blah" is not necessarily the same as "./blah".) Rather than having pf-scripts do explicit string-processing on the paths, it seems like one simple and safe alternative would be for pf-scripts to invoke realpath(). The nice thing about that approach is that those scripts run on the front-ends, with e.g. marfs_fuse mounted, so symlinks can be followed. Another option is for pftool to implement its own realpath(), using Path::readlink(), etc. |
On second thought, there's more to be discussed here. |
Another issue is that pftool called from pf-scripts doesn't know what the working-dir was, when the pf-scripts were invoked. This information could be passed as another argument to pftool, but it's starting to look easier to just call realpath() in the scripts. |
Seems like realpath in the scripts gets us pretty far Is there a scriptable version of realpath or do we need to write a 4 line C program? From: Jeff Inman [mailto:notifications@github.com] Another issue is that pftool called from pf-scripts doesn't know what the working-dir was, when the pf-scripts were invoked. This information could be passed as another argument to pftool, but it's starting to look easier to just call realpath() in the scripts. — |
I already modified the pf-scripts to use abspath to get rid of weirdness with relative paths, switching that over to realpath would be very trivial (or a combination of both).
|
@so, this popped up in production this week. I need to test it, but DNE is creating headaches. I used os.path.abspath in my patch, but not os.path.realpath. The former does not resolve symlinks, and DNE uses symlinks to shuffle users around between metadata servers. Anyone see any problems with simply resolving symlinks prior to handing them to pftool? Update: I can confirm this works with DNE. |
I think that will suffice for the next release. Leave the issue open so that someone can actually dig into the pftool issue. |
This has been fixed by 5e4fe55 in pftool proper. |
I don't have an exhaustive comparison of how paths are expanded, but they do seem to resolve improperly for special dirs like "." and ".." for source and destination.
I'll put in a pull request soon for the updates to the pfcp/pfcm/pfls scripts that launch pftool, I added an absolute path resolver in them so that pftool only has to deal with absolute paths (for now). The assumption I had to make is that nobody will have "/var/lib/perceus/vnfs/" along with "/rootfs/" in their path. I believe that's fairly safe, but I'm documenting it here just in case someone uses it outside of LANL and decides to Google.
The text was updated successfully, but these errors were encountered: