Closed mikegray closed 5 years ago
Also tested with version 3.1.0-rc1
- same result.
More interesting information, the error seems to depend on how I reference the image:
./builddir/singularity pull library://alpine:latest
FATAL: image file already exists - will not overwrite
./builddir/singularity pull alpine:latest
FATAL: unable to check if /Users/mikegray/.singularity/cache/library/sha256.69ce2a3dcc6d3e559e20ced0df251046ee6ecff390a945d856fe0dcb3bcb3ce8 exists: read /Users/mikegray/.singularity/cache/library/sha256.69ce2a3dcc6d3e559e20ced0df251046ee6ecff390a945d856fe0dcb3bcb3ce8: is a directory
May or may not be helpful, but my initial git bisect
test pointed to commit a0e9446a
as being initial point of failing behavior.
Confirmed with my JMS build on Mac:
$ singularity -d pull alpine:latest
DEBUG [U=501,P=16958] apiGet() apiGet calling https://library.sylabs.io/v1/images///alpine:latest
DEBUG [U=501,P=16958] initCacheDir() Creating cache directory: /Users/gmk/.singularity/cache/library/sha256.69ce2a3dcc6d3e559e20ced0df251046ee6ecff390a945d856fe0dcb3bcb3ce8
DEBUG [U=501,P=16958] updateCacheSubdir() Caching directory set to /Users/gmk/.singularity/cache/library/sha256.69ce2a3dcc6d3e559e20ced0df251046ee6ecff390a945d856fe0dcb3bcb3ce8
DEBUG [U=501,P=16958] updateCacheSubdir() Caching directory set to /Users/gmk/.singularity/cache/library
DEBUG [U=501,P=16958] updateCacheSubdir() Caching directory set to /Users/gmk/.singularity/cache/library/sha256.69ce2a3dcc6d3e559e20ced0df251046ee6ecff390a945d856fe0dcb3bcb3ce8
DEBUG [U=501,P=16958] updateCacheSubdir() Caching directory set to /Users/gmk/.singularity/cache/library
FATAL [U=501,P=16958] pullRun() unable to check if /Users/gmk/.singularity/cache/library/sha256.69ce2a3dcc6d3e559e20ced0df251046ee6ecff390a945d856fe0dcb3bcb3ce8 exists: read /Users/gmk/.singularity/cache/library/sha256.69ce2a3dcc6d3e559e20ced0df251046ee6ecff390a945d856fe0dcb3bcb3ce8: is a directory
$ ./singularity -d pull alpine:latest
DEBUG [U=502,P=59392] pullRun()
transport =
args[i] = alpine:latest
imageName =
imagePath = /Users/andremarcelo-tanner/.singularity/cache/library/sha256.69ce2a3dcc6d3e559e20ced0df251046ee6ecff390a945d856fe0dcb3bcb3ce8
$ ./singularity -d pull library://alpine:latest
DEBUG [U=502,P=59481] pullRun()
transport = library
args[i] = library://alpine:latest
imageName = alpine_latest.sif
imagePath = /Users/andremarcelo-tanner/.singularity/cache/library/sha256.69ce2a3dcc6d3e559e20ced0df251046ee6ecff390a945d856fe0dcb3bcb3ce8/alpine_latest.sif
This returns a blank string if transport
is empty:
https://github.com/sylabs/singularity/blob/3b40262545fbf98250b8e055dd998308099400a3/cmd/internal/cli/pull.go#L123
because uri.GetName()
does not return an image name if there is no transport that can be found using uri.Split()
:
https://github.com/sylabs/singularity/blob/3b40262545fbf98250b8e055dd998308099400a3/internal/pkg/util/uri/uri.go#L56-L61
thus cache.LibraryImageExists(libraryImage.Hash, imageName);
will have a fatal error
https://github.com/sylabs/singularity/blob/3b40262545fbf98250b8e055dd998308099400a3/cmd/internal/cli/pull.go#L125-L126
Looks like this change to using uri.GetName()
was in https://github.com/sylabs/singularity/pull/2551/files#diff-9fc6fcacc2d343e38030add5fbd4b2dfR51
As I understand there is an ongoing task to refactor this as mentioned by @bauerm97 in https://github.com/sylabs/singularity/pull/2551#pullrequestreview-195133753
I think a simple solution for now is to prepend library://
when using uri.GetName()
if the
if transport == "" {
imageName := uri.GetName("library://" + args[i])
} else {
imageName := uri.GetName(args[i])
}
since that most methods assume that no transport means library://
Version of Singularity:
HEAD of master, 3.1.0-rc1.2.g3b402625
Expected behavior
Pull image from library to local file.
Actual behavior
Steps to reproduce behavior
Pull source code locally. Build on macOS Mojave -
mconfig
,make -C builddir/
, runsingularity pull
command as above. I also tried deleting the cache directoryrm -rf ~/.singularity/cache
, but the problem still occurs.