Repository: minio/minio (language: go)

Issue:
Critical Error on Auto-Extraction of .tar.gz file with subdir after upload to bucket
Its a tar.gz file with Elasticsearch snapshots in it. Its fail when i attemp to untar on fly to bucket. 


mc admin info minio
●  xxx.x.xx.xx:9002
   Uptime: 18 hours 
   Version: 2023-02-10T18:48:39Z
   Network: 1/1 OK 
   Drives: 1/1 OK 
   Pool: 1

Pools:
   1st, Erasure sets: 1, Drives per erasure set: 1

143 GiB Used, 9 Buckets, 23,740 Objects
1 drive online, 0 drives offline

mc --version #
mc version RELEASE.2023-01-28T20-29-38Z (commit-id=2e95a70c98fb9c2629cd89817b8759bfa109a4d0)
Runtime: go1.19.4 linux/amd64


mc cp /home/dbases/elastic/snapshots/drive-snap/backups-logs-auditoria/2022/12/filebeat-2022.12.31.tar.gz minio/snap-elastic-7 --disable-multipart --attr "X-Amz-Meta-Snowball-Auto-Extract=true" --debug
mc: <DEBUG> GET /snap-elastic-7/?location= HTTP/1.1
Host: xxx.x.xx.xx:9002
User-Agent: MinIO (linux; amd64) minio-go/v7.0.46 mc/RELEASE.2023-01-28T20-29-38Z
Authorization: AWS4-HMAC-SHA256 Credential=minio/20230216/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=**REDACTED**
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20230216T133050Z
Accept-Encoding: gzip

mc: <DEBUG> HTTP/1.1 200 OK
Content-Length: 128
Accept-Ranges: bytes
Content-Security-Policy: block-all-mixed-content
Content-Type: application/xml
Date: Thu, 16 Feb 2023 13:30:50 GMT
Server: MinIO
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
Vary: Accept-Encoding
X-Amz-Id-2: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Request-Id: 1744513559D64A6E
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block

mc: <DEBUG> Response Time:  3.513585ms

mc: <DEBUG> HEAD /snap-elastic-7/ HTTP/1.1
Host: xxx.x.xx.xx:9002
User-Agent: MinIO (linux; amd64) minio-go/v7.0.46 mc/RELEASE.2023-01-28T20-29-38Z
Authorization: AWS4-HMAC-SHA256 Credential=minio/20230216/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=**REDACTED**
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20230216T133050Z

mc: <DEBUG> HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Security-Policy: block-all-mixed-content
Content-Type: application/xml
Date: Thu, 16 Feb 2023 13:30:50 GMT
Server: MinIO
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
Vary: Accept-Encoding
X-Amz-Id-2: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Request-Id: 1744513559F82B1E
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Content-Length: 0

mc: <DEBUG> Response Time:  1.910832ms

mc: <DEBUG> HEAD /snap-elastic-7/ HTTP/1.1
Host: xxx.x.xx.xx:9002
User-Agent: MinIO (linux; amd64) minio-go/v7.0.46 mc/RELEASE.2023-01-28T20-29-38Z
Authorization: AWS4-HMAC-SHA256 Credential=minio/20230216/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=**REDACTED**
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20230216T133050Z

mc: <DEBUG> HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Security-Policy: block-all-mixed-content
Content-Type: application/xml
Date: Thu, 16 Feb 2023 13:30:50 GMT
Server: MinIO
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
Vary: Accept-Encoding
X-Amz-Id-2: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Request-Id: 174451355A1E320F
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Content-Length: 0

mc: <DEBUG> Response Time:  1.556893ms

 0 B / ? ━┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉━━mc: <DEBUG> GET /snap-elastic-7/?object-lock= HTTP/1.1
Host: xxx.x.xx.xx:9002
User-Agent: MinIO (linux; amd64) minio-go/v7.0.46 mc/RELEASE.2023-01-28T20-29-38Z
Authorization: AWS4-HMAC-SHA256 Credential=minio/20230216/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=**REDACTED**
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20230216T133050Z
Accept-Encoding: gzip

mc: <DEBUG> HTTP/1.1 404 Not Found
Content-Length: 346
Accept-Ranges: bytes
Content-Security-Policy: block-all-mixed-content
Content-Type: application/xml
Date: Thu, 16 Feb 2023 13:30:50 GMT
Server: MinIO
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
Vary: Accept-Encoding
X-Amz-Id-2: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Request-Id: 174451355AF21E13
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block

<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>ObjectLockConfigurationNotFoundError</Code><Message>Object Lock configuration does not exist for this bucket</Message><BucketName>snap-elastic-7</BucketName><Resource>/snap-elastic-7/</Resource><RequestId>174451355AF21E13</RequestId><HostId>3b6fc91f-5bfd-488b-85ff-813bd75c0e20</HostId></Error>mc: <DEBUG> Response Time:  1.492065ms

mc: <DEBUG> HEAD /snap-elastic-7/ HTTP/1.1
Host: xxx.x.xx.xx:9002
User-Agent: MinIO (linux; amd64) minio-go/v7.0.46 mc/RELEASE.2023-01-28T20-29-38Z
Authorization: AWS4-HMAC-SHA256 Credential=minio/20230216/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=**REDACTED**
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20230216T133050Z

mc: <DEBUG> HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Security-Policy: block-all-mixed-content
Content-Type: application/xml
Date: Thu, 16 Feb 2023 13:30:50 GMT
Server: MinIO
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
Vary: Accept-Encoding
X-Amz-Id-2: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Request-Id: 174451355B19976D
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Content-Length: 0

mc: <DEBUG> Response Time:  1.995818ms

...at-2022.12.31.tar.gz: 4.75 MiB / 15.86 GiB ━━┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉━ 680.78 KiB/s





Discussion / hints:
I don't see any error here what is the exact error do you see, don't use --debug 
ok, this is the message without --debug mc cp /home/dbases/elastic/snapshots/drive-snap/backups-logs-auditoria/2022/12/filebeat-2022.12.31.tar.gz minio/snap-elastic-7 --disable-multipart --attr "X-Amz-Meta-Snowball-Auto-Extract=true" 
mc: <ERROR> Failed to copy `/home/dbases/elastic/snapshots/drive-snap/backups-logs-auditoria/2022/12/filebeat-2022.12.31.tar.gz`. Object name contains unsupported characters.   But there isn't any strange characters. It fail when attempt to extract a subdir. 
> ok, this is the message without --debug mc cp /home/dbases/elastic/snapshots/drive-snap/backups-logs-auditoria/2022/12/filebeat-2022.12.31.tar.gz minio/snap-elastic-7 --disable-multipart --attr "X-Amz-Meta-Snowball-Auto-Extract=true" mc: Failed to copy `/home/dbases/elastic/snapshots/drive-snap/backups-logs-auditoria/2022/12/filebeat-2022.12.31.tar.gz`. Object name contains unsupported characters. But there isn't any strange characters. It fail when attempt to extract a subdir.

Can you provide the list of object names in tar.gz ? 
> > ok, this is the message without --debug mc cp /home/dbases/elastic/snapshots/drive-snap/backups-logs-auditoria/2022/12/filebeat-2022.12.31.tar.gz minio/snap-elastic-7 --disable-multipart --attr "X-Amz-Meta-Snowball-Auto-Extract=true" mc: Failed to copy `/home/dbases/elastic/snapshots/drive-snap/backups-logs-auditoria/2022/12/filebeat-2022.12.31.tar.gz`. Object name contains unsupported characters. But there isn't any strange characters. It fail when attempt to extract a subdir.
> 
> Can you provide the list of object names in tar.gz ?

tar -ztvf /home/dbases/elastic/snapshots/drive-snap/backups-logs-auditoria/2022/12/filebeat-2022.12.31.tar.gz 
drwxrwxr-x elasticsearch/elasticsearch 0 2023-01-04 22:07 ./
-rw-rw-r-- elasticsearch/elasticsearch 29 2023-01-04 22:07 ./incompatible-snapshots
-rw-rw-r-- elasticsearch/elasticsearch  8 2023-01-04 22:07 ./index.latest
-rw-rw-r-- elasticsearch/elasticsearch 198 2023-01-04 22:07 ./index-0
drwxrwxr-x elasticsearch/elasticsearch   0 2023-01-04 22:00 ./indices/
drwxrwxr-x elasticsearch/elasticsearch   0 2023-01-04 22:00 ./indices/MflerzHUSOuZRGY4vdhvRQ/
drwxrwxr-x elasticsearch/elasticsearch   0 2023-01-04 22:07 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/
-rw-rw-r-- elasticsearch/elasticsearch 148036477 2023-01-04 22:01 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__a
-rw-rw-r-- elasticsearch/elasticsearch   1569126 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__t
-rw-rw-r-- elasticsearch/elasticsearch       440 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__g
-rw-rw-r-- elasticsearch/elasticsearch       440 2023-01-04 22:07 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__1n
-rw-rw-r-- elasticsearch/elasticsearch      1441 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__u
-rw-rw-r-- elasticsearch/elasticsearch 214080960 2023-01-04 22:03 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__1a
-rw-rw-r-- elasticsearch/elasticsearch       405 2023-01-04 22:07 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__1i
-rw-rw-r-- elasticsearch/elasticsearch       440 2023-01-04 22:03 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__13
-rw-rw-r-- elasticsearch/elasticsearch 124365598 2023-01-04 22:03 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__15
-rw-rw-r-- elasticsearch/elasticsearch 2217250625 2023-01-04 22:07 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__1h
-rw-rw-r-- elasticsearch/elasticsearch    4919236 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__j
-rw-rw-r-- elasticsearch/elasticsearch        405 2023-01-04 22:03 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__10
-rw-rw-r-- elasticsearch/elasticsearch        405 2023-01-04 22:01 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__9
-rw-rw-r-- elasticsearch/elasticsearch   80568519 2023-01-04 22:07 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__1j
-rw-rw-r-- elasticsearch/elasticsearch        405 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__n
-rw-rw-r-- elasticsearch/elasticsearch       6304 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__r
-rw-rw-r-- elasticsearch/elasticsearch        440 2023-01-04 22:07 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__1o
-rw-rw-r-- elasticsearch/elasticsearch        440 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__q
-rw-rw-r-- elasticsearch/elasticsearch        440 2023-01-04 22:01 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__8
-rw-rw-r-- elasticsearch/elasticsearch        440 2023-01-04 22:03 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__14
-rw-rw-r-- elasticsearch/elasticsearch        440 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__p
-rw-rw-r-- elasticsearch/elasticsearch  946155857 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__e
-rw-rw-r-- elasticsearch/elasticsearch        405 2023-01-04 22:03 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__16
-rw-rw-r-- elasticsearch/elasticsearch        405 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__f
-rw-rw-r-- elasticsearch/elasticsearch   13735278 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__l
-rw-rw-r-- elasticsearch/elasticsearch        440 2023-01-04 22:07 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__1q
-rw-rw-r-- elasticsearch/elasticsearch   98396821 2023-01-04 22:01 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__4   and so on
> tar -ztvf /home/dbases/elastic/snapshots/drive-snap/backups-logs-auditoria/2022/12/filebeat-2022.12.31.tar.gz
> drwxrwxr-x elasticsearch/elasticsearch 0 2023-01-04 22:07 ./
> -rw-rw-r-- elasticsearch/elasticsearch 29 2023-01-04 22:07 ./incompatible-snapshots
> -rw-rw-r-- elasticsearch/elasticsearch 8 2023-01-04 22:07 ./index.latest
> -rw-rw-r-- elasticsearch/elasticsearch 198 2023-01-04 22:07 ./index-0
> drwxrwxr-x elasticsearch/elasticsearch 0 2023-01-04 22:00 ./indices/
> drwxrwxr-x elasticsearch/elasticsearch 0 2023-01-04 22:00 ./indices/MflerzHUSOuZRGY4vdhvRQ/
> drwxrwxr-x elasticsearch/elasticsearch 0 2023-01-04 22:07 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/
> -rw-rw-r-- elasticsearch/elasticsearch 148036477 2023-01-04 22:01 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__a
> -rw-rw-r-- elasticsearch/elasticsearch 1569126 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__t
> -rw-rw-r-- elasticsearch/elasticsearch 440 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__g
> -rw-rw-r-- elasticsearch/elasticsearch 440 2023-01-04 22:07 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__1n
> -rw-rw-r-- elasticsearch/elasticsearch 1441 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__u
> -rw-rw-r-- elasticsearch/elasticsearch 214080960 2023-01-04 22:03 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__1a
> -rw-rw-r-- elasticsearch/elasticsearch 405 2023-01-04 22:07 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__1i
> -rw-rw-r-- elasticsearch/elasticsearch 440 2023-01-04 22:03 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__13
> -rw-rw-r-- elasticsearch/elasticsearch 124365598 2023-01-04 22:03 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__15
> -rw-rw-r-- elasticsearch/elasticsearch 2217250625 2023-01-04 22:07 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__1h
> -rw-rw-r-- elasticsearch/elasticsearch 4919236 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__j
> -rw-rw-r-- elasticsearch/elasticsearch 405 2023-01-04 22:03 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__10
> -rw-rw-r-- elasticsearch/elasticsearch 405 2023-01-04 22:01 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__9
> -rw-rw-r-- elasticsearch/elasticsearch 80568519 2023-01-04 22:07 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__1j
> -rw-rw-r-- elasticsearch/elasticsearch 405 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__n
> -rw-rw-r-- elasticsearch/elasticsearch 6304 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__r
> -rw-rw-r-- elasticsearch/elasticsearch 440 2023-01-04 22:07 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__1o
> -rw-rw-r-- elasticsearch/elasticsearch 440 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__q
> -rw-rw-r-- elasticsearch/elasticsearch 440 2023-01-04 22:01 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__8
> -rw-rw-r-- elasticsearch/elasticsearch 440 2023-01-04 22:03 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__14
> -rw-rw-r-- elasticsearch/elasticsearch 440 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__p
> -rw-rw-r-- elasticsearch/elasticsearch 946155857 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__e
> -rw-rw-r-- elasticsearch/elasticsearch 405 2023-01-04 22:03 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__16
> -rw-rw-r-- elasticsearch/elasticsearch 405 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__f
> -rw-rw-r-- elasticsearch/elasticsearch 13735278 2023-01-04 22:02 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__l
> -rw-rw-r-- elasticsearch/elasticsearch 440 2023-01-04 22:07 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__1q
> -rw-rw-r-- elasticsearch/elasticsearch 98396821 2023-01-04 22:01 ./indices/MflerzHUSOuZRGY4vdhvRQ/2/__4 and so on

Can you attach the pull file list here? @elfersoto 
Try trimming `./` from the file names, since that cannot be stored as-is.

Fix patch:
diff --git a/cmd/untar.go b/cmd/untar.go
index 1434624831341..f46a51874afe0 100644
--- a/cmd/untar.go
+++ b/cmd/untar.go
@@ -203,7 +203,8 @@ func untar(ctx context.Context, r io.Reader, putObject func(reader io.Reader, in
 		}
 
 		name := header.Name
-		if name == slashSeparator {
+		switch path.Clean(name) {
+		case ".", slashSeparator:
 			continue
 		}
 


Test patch: