sbt icon indicating copy to clipboard operation
sbt copied to clipboard

Scripted tests delete sym linked files and directories

Open steinybot opened this issue 2 years ago • 3 comments

steps

  1. Write a scripted test that creates a sym link within the scripted test directory to something outside that directory (make sure it is nothing you care about loosing)
  2. Run scripted

problem

The source of the link is deleted, whether that is a file or directory, it is gone.

expectation

Nothing outside of the scripted test directory should be deleted.

notes

Reproduction: https://github.com/steinybot/bug-reports/tree/sbt/scripted-deletes-linked-files

steinybot avatar Jul 12 '23 03:07 steinybot

The way I ran into this was that I was using:

Compile / npmDevDependencies += "my-node-package" -> "link:/path/to/my/node/package"

and after the test ran it was nuked.

Fortunately I had committed everything and it was a subdirectory within my local git clone so I didn't loose anything that wasn't pushed.

steinybot avatar Jul 12 '23 03:07 steinybot

Thanks for the report @steinybot !

So put another way, the clean up code should not have follow symlink turned on, but it does now?

eed3si9n avatar Jul 12 '23 13:07 eed3si9n

Swoval already has support for not following symlinks. It is toggled by a boolean flag when initializing the FileTreeView:

https://github.com/sbt/io/blob/aec4504a26648df5295eff5b59770163f1ab809a/io/src/main/scala/sbt/internal/nio/SwovalConverters.scala#L42

I'm not sure how it would be best to configure this from sbt.

eatkins avatar Jul 24 '23 00:07 eatkins