Skip to content

With Minio, info cmd on a bucket result in a xml parsing error #1093

@fviard

Description

@fviard

When using Minio as a s3 server, when issuing using "info" command directly on a bucket, following error is encountered:
"ERROR: Error parsing xml: no element found: line 1, column 0"

Root cause:
Minio doesn't support ?requestPayment sub-resource, but reply ok(200) with an empty string as response data.

Log:

$ s3cmd -c s3cfg_localminio mb s3://boom
Bucket 's3://boom/' created

$ s3cmd -c s3cfg_localminio info s3://boom -v
ERROR: Error parsing xml: no element found: line 1, column 0
ERROR: 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    An unexpected error has occurred.
  Please try reproducing the error using
  the latest s3cmd code from the git master
  branch found at:
    https://github.com/s3tools/s3cmd
  and have a look at the known issues list:
    https://github.com/s3tools/s3cmd/wiki/Common-known-issues-and-their-solutions
  If the error persists, please report the
  following lines (removing any private
  info as necessary) to:
   s3tools-bugs@lists.sourceforge.net


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Invoked as: ./s3cmd -c s3cfg_localminio info s3://boom -v
Problem: ParseError: no element found: line 1, column 0
S3cmd:   2.1.0+
python:   2.7.15+ (default, Oct  7 2019, 17:39:04) 
[GCC 7.4.0]
environment LANG=fr_FR.UTF-8

Traceback (most recent call last):
  File "./s3cmd", line 3164, in <module>
    rc = main()
  File "./s3cmd", line 3073, in main
    rc = cmd_func(args)
  File "./s3cmd", line 971, in cmd_info
    info = s3.bucket_info(uri)
  File "/home/flo/dev/s3cmd/s3cmd-fviard/S3/S3.py", line 473, in bucket_info
    response['requester-pays'] = self.get_bucket_requester_pays(uri)
  File "/home/flo/dev/s3cmd/s3cmd-fviard/S3/S3.py", line 466, in get_bucket_requester_pays
    payer = getTextFromXml(response['data'], "Payer")
  File "/home/flo/dev/s3cmd/s3cmd-fviard/S3/Utils.py", line 142, in getTextFromXml
    tree = getTreeFromXml(xml)
  File "/home/flo/dev/s3cmd/s3cmd-fviard/S3/Utils.py", line 106, in getTreeFromXml
    tree = ET.fromstring(xml)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1312, in XML
    return parser.close()
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1671, in close
    self._raiseerror(v)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1523, in _raiseerror
    raise err
ParseError: no element found: line 1, column 0

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    An unexpected error has occurred.
  Please try reproducing the error using
  the latest s3cmd code from the git master
  branch found at:
    https://github.com/s3tools/s3cmd
  and have a look at the known issues list:
    https://github.com/s3tools/s3cmd/wiki/Common-known-issues-and-their-solutions
  If the error persists, please report the
  above lines (removing any private
  info as necessary) to:
   s3tools-bugs@lists.sourceforge.net
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Detailed debug log:

DEBUG: Canonical Request:
GET
/boom/
requestPayment=
host:127.0.0.1:9000
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20200420T140300Z

host;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
----------------------
DEBUG: signature-v4 headers: {'x-amz-content-sha256': u'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'Authorization': u'AWS4-HMAC-SHA256 Credential=/20200420/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=adc7d4c4d19b0621c60819671edcdbf6656485cde132f83a2814ba37d514166e', 'x-amz-date': '20200420T140300Z'}
DEBUG: Processing request, please wait...
DEBUG: get_hostname(boom): 127.0.0.1:9000
DEBUG: ConnMan.get(): re-using connection: http://127.0.0.1:9000#3
DEBUG: format_uri(): /boom/?requestPayment
DEBUG: Sending request method_string='GET', uri=u'/boom/?requestPayment', headers={'x-amz-content-sha256': u'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'Authorization': u'AWS4-HMAC-SHA256 Credential=/20200420/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=adc7d4c4d19b0621c60819671edcdbf6656485cde132f83a2814ba37d514166e', 'x-amz-date': '20200420T140300Z'}, body=(0 bytes)
DEBUG: ConnMan.put(): connection put back to pool (http://127.0.0.1:9000#4)
DEBUG: Response:
{'data': '',
 'headers': {'accept-ranges': 'bytes',
             'content-length': '0',
             'content-security-policy': 'block-all-mixed-content',
             'date': 'Mon, 20 Apr 2020 14:03:00 GMT',
             'server': 'MinIO/RELEASE.2020-03-14T02-21-58Z',
             'vary': 'Origin',
             'x-amz-request-id': '16078C0CEDCC8049',
             'x-xss-protection': '1; mode=block'},
 'reason': 'OK',
 'status': 200}
ERROR: Error parsing xml: no element found: line 1, column 0
ERROR: 

Expected reply from the server (Aws s3):

DEBUG: Response:
{'data': b'<?xml version="1.0" encoding="UTF-8"?>\n<RequestPaymentConfigurat'
         b'ion xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Payer>BucketOwn'
         b'er</Payer></RequestPaymentConfiguration>',
 'headers': {'date': 'Mon, 20 Apr 2020 14:06:16 GMT',
             'server': 'AmazonS3',
             'transfer-encoding': 'chunked',
             'x-amz-id-2': '.../...=',
             'x-amz-request-id': '...'},
 'reason': 'OK',
 'status': 200}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions