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

part of a path removed by cp #360

Closed
bartek-siudeja opened this issue Sep 22, 2021 · 2 comments · Fixed by #456
Closed

part of a path removed by cp #360

bartek-siudeja opened this issue Sep 22, 2021 · 2 comments · Fixed by #456

Comments

@bartek-siudeja
Copy link

I have run into the following strange behavior (on 1.4.0):

mkdir -p /mnt/data/folder/wildcard
touch /mnt/data/folder/wildcard/name
s5cmd cp "/mnt/data/folder/*/name" s3://bucket/folder/
cp /mnt/data/folder/wildcard/name s3://bucket/wildcard/name

For some reason target does not have folder.

@sonmezonur sonmezonur added the bug label Nov 4, 2021
@igungor
Copy link
Member

igungor commented Nov 11, 2021

Thanks for reporting this. It looks like a regression.

@gmarkey
Copy link

gmarkey commented May 10, 2022

sync also exhibits the same behaviour (2.0.0 beta).

@igungor igungor added this to s5cmd Jun 29, 2022
@igungor igungor added this to the v2.1.0 milestone Jun 29, 2022
@kucukaslan kucukaslan moved this to Todo in s5cmd Jun 29, 2022
@kucukaslan kucukaslan moved this from Todo to In Progress in s5cmd Jul 1, 2022
igungor pushed a commit that referenced this issue Jul 22, 2022
…oved by cp (#456)

The cause of problem is a little bit weird.

(url).SetRelative method was given the source (abs.) path as it was provided in command line arguments including the wildcard characters(* and ?). Hence it determined relative path incorrectly, where "expected" relative path became "../expected" which in turn caused the some part of destination to be lost (since path/filepath.Join converts e.g. /a/b/../c to /a/c)

We also need to identify whether the * and ? characters present in base strings are part of key or they are used for wildcard operation. So we need to know if the "raw" flag is given. To. solve this I changed (URL).SetRelative method to take argument of type URL rather than string.

Fixes #360

Co-authored-by: Selman Kayrancioglu <[email protected]>
Co-authored-by: Aykut Farsak <[email protected]>
Co-authored-by: Muhammed Can Küçükaslan <[email protected]>
Repository owner moved this from In Progress to Done in s5cmd Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

6 participants