Skip to content

Paket deletes the home directory #4306

@queil

Description

@queil

I am using Paket.Core 10.0.0-alpha011

With the following invalid paket.dependencies file (look at the last line):

source https://api.nuget.org/v3/index.json

storage: none
framework: net10.0
nuget Spectre.Console ~> 0.54
github myorg/repo:main ~>

I often make this mistake due to mostly referencing nugets. As soon as I type ~ in the last line, (or compile the script), my home dir gets wiped out. Incidentally the delete fails due to access denied on some files, hence I can see what code is responsible:

System.Exception: Error during cleaning of /home/me
  - Access to the path '/home/me/.local/share/docker/image' is denied.
 ---> System.IO.IOException: Access to the path '/home/me/.local/share/docker/image' is denied.
   at System.IO.FileSystem.RemoveEmptyDirectory(String fullPath, Boolean topLevel, Boolean throwWhenNotEmpty)
   at System.IO.DirectoryInfo.Delete()
   at Paket.Utils.emptyDir(DirectoryInfo dirInfo) in C:\code\Paket\src\Paket.Core\Common\Utils.fs:line 184
   at Paket.Utils.deleteDir(DirectoryInfo dirInfo) in C:\code\Paket\src\Paket.Core\Common\Utils.fs:line 190
   at Paket.Utils.emptyDir(DirectoryInfo dirInfo) in C:\code\Paket\src\Paket.Core\Common\Utils.fs:line 184
   at Paket.Utils.deleteDir(DirectoryInfo dirInfo) in C:\code\Paket\src\Paket.Core\Common\Utils.fs:line 190
   at Paket.Utils.emptyDir(DirectoryInfo dirInfo) in C:\code\Paket\src\Paket.Core\Common\Utils.fs:line 184
   at Paket.Utils.deleteDir(DirectoryInfo dirInfo) in C:\code\Paket\src\Paket.Core\Common\Utils.fs:line 190
   at Paket.Utils.emptyDir(DirectoryInfo dirInfo) in C:\code\Paket\src\Paket.Core\Common\Utils.fs:line 184
   at Paket.Utils.CleanDir(String path) in C:\code\Paket\src\Paket.Core\Common\Utils.fs:line 199
   --- End of inner exception stack trace ---
   at Paket.Utils.CleanDir(String path) in C:\code\Paket\src\Paket.Core\Common\Utils.fs:line 201
   at [email protected](Tuple`2 tupledArg) in C:\code\Paket\src\Paket.Core\Dependencies\RemoteDownload.fs:line
336
   at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 x) in D:\a\_work\1\s\src\fsharp\src\FSharp.Core\loc
al.fs:line 247
   at Microsoft.FSharp.Collections.ListModule.Map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 list) in D:\a\_work\1\s\src\fsharp\src\FSharp.Core\
list.fs:line 98
   at Paket.RemoteDownload.DownloadSourceFiles(String rootPath, GroupName groupName, Boolean force, FSharpList`1 sourceFiles) in C:\code\Paket\src\
Paket.Core\Dependencies\RemoteDownload.fs:line 323

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions