Skip to content
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

azcopy cp fails if the destination path is at the root of the file system (i.e. /) #2036

Closed
matthiasplappert opened this issue Jan 26, 2023 · 1 comment · Fixed by #2588
Closed

Comments

@matthiasplappert
Copy link

Which version of the AzCopy was used?

10.16.2 and 10.17.0

Which platform are you using? (ex: Windows, Mac, Linux)

Linux

What command did you run?

cd /
azcopy cp <remote-path>/archive.zip archive.zip

What problem was encountered?

azcopy crashes with the following error:

INFO: Scanning...
INFO: Any empty folders will not be processed, because source and/or destination doesn't have full folder support

Job f16add00-4c91-6540-75ba-a088289c557f has started
Log file is located at: /tmp//f16add00-4c91-6540-75ba-a088289c557f.log

panic: runtime error: slice bounds out of range [:-1]

goroutine 109 [running]:
github.com/Azure/azure-storage-azcopy/v10/common.CreateParentDirectoryIfNotExist({0xc000590800, 0x0}, {0x403886fdf8, 0x17258d8})
	/home/vsts/work/1/s/common/writeThoughFile.go:46 +0x6e
github.com/Azure/azure-storage-azcopy/v10/common.CreateDirectoryIfNotExist({0xc000590800, 0x0}, {0x403886fdf8, 0x17258d8})
	/home/vsts/work/1/s/common/writeThoughFile.go:62 +0x16b
github.com/Azure/azure-storage-azcopy/v10/common.CreateParentDirectoryIfNotExist({0xc000590800, 0x3a}, {0x403886fdf8, 0x17258d8})
	/home/vsts/work/1/s/common/writeThoughFile.go:47 +0x5c
github.com/Azure/azure-storage-azcopy/v10/common.CreateFileOfSizeWithWriteThroughOption({0xc000590800, 0x3a}, 0x3767442, 0x0, {0x403886fdf8, 0x17258d8}, 0xe0)
	/home/vsts/work/1/s/common/writeThoughFile_linux.go:31 +0x45
github.com/Azure/azure-storage-azcopy/v10/ste.createDestinationFile({0x10379b8, 0xc000528070}, {0xc000590800, 0x3a}, 0x3767442, 0xcf)
	/home/vsts/work/1/s/ste/xfer-remoteToLocal-file.go:287 +0xf7
github.com/Azure/azure-storage-azcopy/v10/ste.remoteToLocal_file({0x10379b8, 0xc000528070}, {0xffe7e0, 0xc0005a00c0}, {0x406bac9c90, 0xc0005a0000}, 0xef6740)
	/home/vsts/work/1/s/ste/xfer-remoteToLocal-file.go:175 +0x74b
github.com/Azure/azure-storage-azcopy/v10/ste.remoteToLocal({0x10379b8, 0xc000528070}, {0xffe7e0, 0xc0005a00c0}, {0x406bac9c90, 0xc0005a0000}, 0x2c)
	/home/vsts/work/1/s/ste/xfer-remoteToLocal-file.go:44 +0x13f
github.com/Azure/azure-storage-azcopy/v10/ste.computeJobXfer.func4({0x10379b8, 0xc000528070}, {0xffe7e0, 0xc0005a00c0}, {0x406bac9c90, 0xc0005a0000})
	/home/vsts/work/1/s/ste/xfer.go:70 +0x43
github.com/Azure/azure-storage-azcopy/v10/ste.(*jobPartMgr).StartJobXfer(0x1684020, {0x10379b8, 0xc000528070})
	/home/vsts/work/1/s/ste/mgr-JobPartMgr.go:715 +0x50
github.com/Azure/azure-storage-azcopy/v10/ste.(*jobPartTransferMgr).StartJobXfer(0xc000528070)
	/home/vsts/work/1/s/ste/mgr-JobPartTransferMgr.go:237 +0x32
github.com/Azure/azure-storage-azcopy/v10/ste.(*jobMgr).transferProcessor.func1({0x10379b8, 0xc000528070})
	/home/vsts/work/1/s/ste/mgr-JobMgr.go:1015 +0x1b9
github.com/Azure/azure-storage-azcopy/v10/ste.(*jobMgr).transferProcessor(0xc000447880, 0xc0003609c0)
	/home/vsts/work/1/s/ste/mgr-JobMgr.go:1027 +0xc2
created by github.com/Azure/azure-storage-azcopy/v10/ste.NewJobMgr
	/home/vsts/work/1/s/ste/mgr-JobMgr.go:200 +0xbf4

How can we reproduce the problem in the simplest way?

See above. Importantly this only happens if you copy to /, either by cd / or by specifying an absolute path like /archive.zip

Have you found a mitigation/solution?

A workaround is to always copy to /tmp/archive.zip instead and then move out the file via mv /tmp/archive.zip /archive.zip. But I would expect this to work. The error is also extremely cryptic and I spent a lot of time trying to understand why this happens

@siminsavani-msft
Copy link
Contributor

Hi @matthiasplappert , thank you for bringing this up! AzCopy does not work well with root files such as '/' because of the current design. I do agree that the error message could be better and will discuss with the team to see what we can do here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants