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

Some errors do not result in a non-zero exit code #304

Closed
weisdd opened this issue Jun 20, 2021 · 2 comments · Fixed by #328 or #404
Closed

Some errors do not result in a non-zero exit code #304

weisdd opened this issue Jun 20, 2021 · 2 comments · Fixed by #328 or #404
Assignees
Labels
Milestone

Comments

@weisdd
Copy link

weisdd commented Jun 20, 2021

System info

OS: Alpine Linux 3.13.1
s5cmd version: v1.2.1-3fc01af

Observations

The host is resolvable and reachable, but credentials are not passed through envs:

/ $ s5cmd --log error --endpoint-url https://minio.localhost cp "s3://tmp/*" tmp/
ERROR session: fetching region failed: NoCredentialProviders: no valid providers in chain. Deprecated.
	For verbose messaging see aws.Config.CredentialsChainVerboseErrors
ERROR "cp s3://tmp/* tmp/": NoCredentialProviders: no valid providers in chain. Deprecated. For verbose messaging see aws.Config.CredentialsChainVerboseErrors
/ $ echo $?
0

The host was resolvable, unreachable:

/ $ s5cmd --log error --endpoint-url https://minio.localhost cp "s3://tmp/*" tmp/
ERROR session: fetching region failed: RequestError: send request failed
caused by: dial tcp 255.255.255.254:443: connect: connection refused
ERROR "cp s3://tmp/* tmp/": RequestError: send request failed caused by: Get "https://minio.localhost/tmp?list-type=2&prefix=": dial tcp 255.255.255.254:443: connect: connection refused
/ $ echo $?
0

The host is unresolvable:

/ $ s5cmd --log error --endpoint-url https://bvsdfdjsfs cp "s3://tmp/*" tmp/
ERROR session: fetching region failed: RequestError: send request failed
caused by: dial tcp: lookup bvsdfdjsfs on 127.0.0.1:53: no such host
ERROR "cp s3://tmp/* tmp/": RequestError: send request failed caused by: Get "https://bvsdfdjsfs/tmp?list-type=2&prefix=": dial tcp: lookup bvsdfdjsfs on 127.0.0.1:53: no such host
/ $ echo $?
0

All of that means that we can't be sure that pipelines fail in case there's something wrong with s3cmd cp.

@ilkinulas ilkinulas added this to the v1.4.0 milestone Jun 30, 2021
@ilkinulas ilkinulas assigned igungor and aykutfarsak and unassigned igungor Jun 30, 2021
@igungor igungor added the bug label Jul 2, 2021
igungor pushed a commit that referenced this issue Aug 5, 2021
…de error (#328)

Creating two error objects instead of one, is to avoid data race. Since there is a goroutine running which tries to write merror object, there might be a data race for merror object in cp, rm and select commands. We can create 1 error object for the goroutine and 1 for the main routine, and append them at the end of the execution.

Tested #304 's first case, it returns exit code 1.

Resolves #304
@igungor
Copy link
Member

igungor commented Aug 5, 2021

@weisdd Hi. Could you please try with the master branch to see if the problems you experience are fixed?

@ocakhasan
Copy link
Contributor

Hi @weisdd we had a PR which solves this issue but since it will break some code, we will release it in version 2.0.0, fyi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment