Adalennis opened a new issue, #9315:
URL: https://github.com/apache/hop/issues/9315

   ### Apache Hop version?
   
   2.20.0
   
   ### Java version?
   
   Java 21
   
   ### Operating system
   
   macOS
   
   ### What happened?
   
   Reproduced on 2.20.0; the code involved is unchanged on main.
   
   The VFS File Explorer treats a symbolic link to a folder as the folder 
itself. Delete and Move then remove the files of the linked folder, and Copy 
loops on a link that points to its own folder or a parent.
   
   **1. Deleting a link to a folder deletes the files of the linked folder**
   
   Both Delete actions (folder tree and file table) go through 
`deleteEntries()`, which calls `VfsFileTransfer.delete()`. For a folder, this 
uses `file.delete(Selectors.SELECT_ALL)`, which walks into the linked folder.
   
   Steps:
   1. `mkdir -p /tmp/vfs-test/real /tmp/vfs-test/view`
   2. `echo keep > /tmp/vfs-test/real/keep.txt`
   3. `ln -s /tmp/vfs-test/real /tmp/vfs-test/view/link`
   4. Open `/tmp/vfs-test/view` in the VFS File Explorer and delete `link`.
   
   Result: `link` is removed, and so is `real/keep.txt`. The folder `real` is 
left empty.
   Expected: only the link is removed.
   
   **2. Moving a link to a folder onto another file system empties the linked 
folder**
   
   When a rename is not possible, a move copies the content and then calls 
`VfsFileTransfer.delete()` on the source. Moving `view/link` from the local 
disk to another file system (tested with `ram://`) copies the files of `real`, 
then deletes them from `real`. A move on the same disk is a rename and only 
moves the link.
   
   **3. Copying a folder that contains a link to itself or to a parent fails**
   
   `copyTree()` follows links to folders without a limit.
   - A folder with `self -> .` is copied as `self/self/self/…` until the 
operating system refuses the path, and the whole copy fails with 
`FileNotFoundException`.
   - A folder `sub` with `up -> ..` copies its parent folder again at each 
level. With a 1 MB file in the parent, 32 copies (32 MB) were written before 
the copy failed.
   
   The partial copy is removed afterwards.
   Expected: links are copied as links or skipped, or the copy stops at a loop 
with a clear message.
   
   
   ### Issue Priority
   
   Priority: 3
   
   ### Issue Component
   
   Component: Hop Gui


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to