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

object share crashes when given a URL without a path component following the namespace prefix #1697

Open
1 task done
brianaydemir opened this issue Oct 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@brianaydemir
Copy link
Contributor

Pelican Version:

Version: 7.10.11
Build Date: 2024-10-23T17:58:48Z
Build Commit: 5f47b175fe62f8f650ab4696a2cb90fcd351436c
Built By: goreleaser

Pelican Service:

  • Client

Describe the bug
object share crashes when given a URL without a path component following the namespace prefix.

For example (note the lack of a trailing / on the URL):

[baydemir@local ~]> pelican object share osdf://ospool/ap40/data
The client is able to save the authorization in a local file.
This prevents the need to reinitialize the authorization for each transfer.
You will be asked for this password whenever a new session is started.
Please provide a new password to encrypt the local OSDF client configuration file: 

panic: runtime error: slice bounds out of range [17:12]

goroutine 1 [running]:
github.com/pelicanplatform/pelican/oauth2.AcquireToken({0xc000b385d0, 0x1a}, 0xc0005eedc0, {{0xc0005fb320, 0x6, 0x6}, 0x0, {{0xc0008b8088, 0x1, 0x1}}, ...}, ...)
	/home/runner/work/pelican/pelican/oauth2/oauth2.go:86 +0xad0
github.com/pelicanplatform/pelican/client.AcquireToken(0xc0008cc240, {{0xc0005fb320, 0x6, 0x6}, 0x0, {{0xc0008b8088, 0x1, 0x1}}, {{0xc000afff1a, 0x11}, ...}, ...}, ...)
	/home/runner/work/pelican/pelican/client/acquire_token.go:283 +0x1085
github.com/pelicanplatform/pelican/client.CreateSharingUrl({0x3070f78, 0xc000a3def0}, 0xc0008cc240, 0x0)
	/home/runner/work/pelican/pelican/client/sharing_url.go:106 +0x37c
main.shareMain(0x3dacc20, {0xc000a14f20, 0x1, 0x25cacb8?})
	/home/runner/work/pelican/pelican/cmd/object_share.go:68 +0x154
github.com/spf13/cobra.(*Command).execute(0x3dacc20, {0xc000a14ee0, 0x1, 0x1})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:940 +0x87c
github.com/spf13/cobra.(*Command).ExecuteC(0x3dafd00)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
github.com/spf13/cobra.(*Command).ExecuteContext(...)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:985
main.Execute()
	/home/runner/work/pelican/pelican/cmd/root.go:89 +0x8f
main.handleCLI({0xc00003e080, 0x4, 0x4})
	/home/runner/work/pelican/pelican/cmd/main.go:66 +0x1cc
main.main()
	/home/runner/work/pelican/pelican/cmd/main.go:35 +0x28

To Reproduce

  1. Remove ~/.config/pelican/.
  2. Run pelican object share osdf://ospool/ap40/data.

Expected behavior
A descriptive error message instead of a stack trace. Alternatively, assume a trailing /.

Desktop (please complete the following information):

  • OS: macOS

Additional context
The lack of a trailing slash looks less obviously wrong when the namespace prefix itself contains no slashes, as in osdf://nsdf.

@brianaydemir brianaydemir added the bug Something isn't working label Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant