Skip to content

NaN shown in the progress bar with zero-length blob #1175

@qweeah

Description

@qweeah

What happened in your environment?

Suppose I have below artifact which refers a zero-length blob:

$ oras manifest fetch --pretty localhost:5000/test:config
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "artifactType": "my.test/example",
  "config": {
    "mediaType": "bar/test",
    "digest": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
    "size": 0
  },
  "layers": [
    {
      "mediaType": "application/vnd.oci.image.layer.v1.tar",
      "digest": "sha256:86c1503eb091280c98d8519c344f41ffcb03545662f0122c76d8f0e6b84e4a33",
      "size": 7,
      "annotations": {
        "org.opencontainers.image.title": "foo"
      }
    }
  ],
  "annotations": {
    "org.opencontainers.image.created": "2023-11-03T01:47:25Z"
  }
}

Copying the artifact will show

$ oras cp localhost:5000/test:config --to-oci-layout foo
✓ Copied  foo                                                                                   7/7  B 100.00%     0s
  └─ sha256:86c1503eb091280c98d8519c344f41ffcb03545662f0122c76d8f0e6b84e4a33
✓ Copied  bar/test                                                                            NaN/0       NaN%    2ms
  └─ sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
✓ Copied  application/vnd.oci.image.manifest.v1+json                                        522/522  B 100.00%     0s
  └─ sha256:34a441c3a3183228689768215fffe158c78ec7a94067cc43e54aa4961eacdc1d
Copied [registry] localhost:5000/test:config => [oci-layout] foo
Digest: sha256:34a441c3a3183228689768215fffe158c78ec7a94067cc43e54aa4961eacdc1d

What did you expect to happen?

Should show

$ oras cp localhost:5000/test:config --to-oci-layout foo
✓ Copied  foo                                                                                   7/7  B 100.00%     0s
  └─ sha256:86c1503eb091280c98d8519c344f41ffcb03545662f0122c76d8f0e6b84e4a33
✓ Copied  bar/test                                                                            0/0       100%    2ms
  └─ sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
✓ Copied  application/vnd.oci.image.manifest.v1+json                                        522/522  B 100.00%     0s
  └─ sha256:34a441c3a3183228689768215fffe158c78ec7a94067cc43e54aa4961eacdc1d
Copied [registry] localhost:5000/test:config => [oci-layout] foo
Digest: sha256:34a441c3a3183228689768215fffe158c78ec7a94067cc43e54aa4961eacdc1d

How can we reproduce it?

Bake a manifest with 0-length blob and oras copy it

What is the version of your ORAS CLI?

v1.1.0

What is your OS environment?

Ubuntu 20.04

Are you willing to submit PRs to fix it?

  • Yes, I am willing to fix it.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriageNew issues or PRs to be acknowledged by maintainers

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions