Skip to content

Absolute BucketPath is passed to the bucket API with leading slash #329

Closed

Description

@ahsimb

Summary

The docstring of BucketPath.__init__ says a path may be given in absolute form, e.g. '/dir1/...', and is still relative to the bucket. Only part of BucketPath follows this:

  • exists(), is_file(), is_dir(), iterdir(), walk() and rm()'s existence check use _get_relative_posix(), which strips the leading /.
  • read(), write() and rm() pass str(self._path) to the bucket API, including the leading /.
  • as_udf_path() joins the absolute path onto the bucket's udf_path, which discards the bucket root.

Reproduction

Tested with exasol-bucketfs 2.3.0 on Linux.

import exasol.bucketfs as bfs
from exasol.bucketfs._buckets import MountedBucket
from exasol.bucketfs._shared import _build_url

bucket = MountedBucket(base_path="/tmp/bucket")
path = bfs.path.BucketPath("/dir/a.txt", bucket)

print(path.as_udf_path())                  # '/dir/a.txt'
print(bucket.root / str(path))             # '/dir/a.txt', used by MountedBucket.upload
print(_build_url("http://localhost:2580", "default", str(path)))
                                           # 'http://localhost:2580/default//dir/a.txt'

Consequences

  • MountedBucket: write() creates /dir/a.txt on the local file system, outside the bucket's base path; read() and rm() also act outside the bucket.
  • On-prem Bucket: the URL contains a double slash, .../default//dir/a.txt.
  • as_udf_path() returns /dir/a.txt instead of /buckets/bfsdefault/default/dir/a.txt, which is not a valid path inside a UDF.
  • exists() etc. look up dir/a.txt, so they disagree with where write() put the data.

Expected

An absolute BucketPath behaves like the corresponding relative one: read(), write(), rm() and as_udf_path() use the path without the leading /.

Context

Found while fixing #322. That fix leaves this behaviour unchanged, as it is not specific to Windows.

Activity

  1. added
    bugUnwanted / harmful behavior
    on Oct 21, 2026
  2. added theissue type on Oct 21, 2026
  3. added a commit that references this issue on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugUnwanted / harmful behavior

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions