Accept a file path in pull-files --only - #564
Conversation
41d7a0b to
107af9f
Compare
|
cc @fredrikekelund @adamziel I am looking for early review. |
ae9860a to
5f33fbb
Compare
Named paths were indexed without the storage-path and default-skip checks that traversal applies, so a file inside the Reprint storage path was indexed when selected explicitly. They were also all inspected in start() and returned by one step, which could exceed the batch size and left them out of the cursor. Each named path is now one step, carried in the cursor, and subject to the same omissions as a path reached by traversal.
|
Could we test this repro: pull |
|
Hey @adamziel, I am able to reproduce the issue on this branch. The The same thing happens on trunk with a directory root, so it looks pre-existing rather than new here. What we can do here is skip vanished entries in Also, without |
|
|
||
| $entries = []; | ||
| if ($this->follow_symlinks) { | ||
| // dirname() so a symlinked file is not repeated as an intermediate entry. |
There was a problem hiding this comment.
| // dirname() so a symlinked file is not repeated as an intermediate entry. | |
| // Record any symlinked descendants. The `index_entries_for_path` call | |
| // below ignores them and only considers one specific path. |
There was a problem hiding this comment.
Actually that's not true, it does not ignore symlinks 👀 :
$resolved_symlink = self::resolve_symlink_target($path);
$link_target = $resolved_symlink["target"];
if ($follow_symlinks) {
$intermediate_symlinks = $resolved_symlink["intermediates"];
}There was a problem hiding this comment.
@gavande1 Suppose /current is a symlink to /releases/42, and the user requests --only /current/wp-config.php. This code receives /releases/42/wp-config.php because the parent path was already resolved. It can no longer find the /current symlink, so pull creates <fs-root>/releases/42/wp-config.php but not <fs-root>/current. Let's preserve the requested path when finding parent symlinks and add a test for this case.
There was a problem hiding this comment.
Do you prefer it as a follow-up, or in this PR?
A follow-up sounds fine! That being said, I found one blocker
|
Rahul is AFK this week, so I'm taking over this PR. Thanks for the initial review, @adamziel 👍 |
pull-files --only
|
@adamziel, I've refactored this pretty drastically. The big thing is that I opened #572 on Thursday to fix a case where |
Related issues
pull-files --onlyshould support file paths, not just directories #539Proposed Changes
pull-files --only PATHused to accept only directory paths. Passing a single file crashed the export server withlist_dir does not exist or is not accessible, and the whole pull failed.This PR changes that so the exporter now accepts a file, directory, or symlink for the
directoryparam sent to thefile_indexendpoint. The endpoint tracks the requested path and resolves symlinks (if--follow-symlinksis enabled).Aside from making
pull-files --only PATH_TO_FILEwork, this PR also makespull-files --only PATH_TO_SYMLINKED_DIRwork better in the sense that Reprint will now return an index containingsymlink_dir -> target(this was previously implemented separately in #572, but I folded it into this PR).Testing Instructions
TBD