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

blob/fileblob: bucket.List is not working for /tmp folder #3304

Closed
ducquangkstn opened this issue Aug 21, 2023 · 4 comments
Closed

blob/fileblob: bucket.List is not working for /tmp folder #3304

ducquangkstn opened this issue Aug 21, 2023 · 4 comments
Labels
needs info Further discussion or clarification is necessary

Comments

@ducquangkstn
Copy link

Describe the bug

  • blob/fileblob: bucket.List is not working for /tmp folder

To Reproduce

  • echo "aaa" > /tmp/report.txt
  • run the
bucket, err := fileblob.OpenBucket("/tmp", nil)
if err != nil {
  panic(err)
}
it := bucket.List(&blob.ListOptions{Prefix: "report.txt"})
for {
  obj, err := it.Next(context.TODO())
  if err == io.EOF {
     break
  } else if err != nil {
     panic(err)
  }
  fmt.Println(obj.Key)
}

Expected behavior

  • It should printout report.txt

Version

0.33.0

Additional context

I am using Mac OS

@vangent
Copy link
Contributor

vangent commented Aug 21, 2023

That exact thing works for me on Linux, and the unit tests should cover this as well (and run on MacOS).

Can you try again without the Prefix option and see what it prints? Does it work in a different directory other than /tmp?

You're going to have to help me debug this since I can't reproduce it.

@vangent vangent added the needs info Further discussion or clarification is necessary label Aug 22, 2023
@luongthanhlam
Copy link

I'm not sure why but changing /tmp to /private/tmp fixes the issue on MacOS

@vangent
Copy link
Contributor

vangent commented Sep 19, 2023

What happens if you do

$ cd /tmp
$ pwd
$ ls

in a terminal on your MacOS? And same for /private/tmp.

@vangent
Copy link
Contributor

vangent commented Sep 19, 2023

lrwxr-xr-x@  1 root  wheel    11 Sep  2 00:35 tmp -> private/tmp

It looks like /tmp might be a symbolic link on MacOS; os.WalkDir does not follow symbolic links:
https://pkg.go.dev/path/filepath#WalkDir

@vangent vangent closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info Further discussion or clarification is necessary
Projects
None yet
Development

No branches or pull requests

3 participants