You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Absolute BucketPath is passed to the bucket API with leading slash #329
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.
importexasol.bucketfsasbfsfromexasol.bucketfs._bucketsimportMountedBucketfromexasol.bucketfs._sharedimport_build_urlbucket=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.uploadprint(_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
#329: Fixed a bug with leading backslash (#331)