Skip to content

oras blob fetch failed to output to stdout in TTY mode #1268

Description

@qweeah

What happened in your environment?

I tried to fetch a blob with oras blob fetch and output the content into stdout in terminal mode. The blob content is not printed to stdout as expected

➜  oras blob fetch ghcr.io/oras-project/oras@sha256:488a49baab43328b45444fc9c13861da4408f279ba5247569bbe06a732265fdc --output -
✓ Downloaded  application/octet-stream                                                                  167/167  B 100.00%     0s
  └─ sha256:488a49baab43328b45444fc9c13861da4408f279ba5247569bbe06a732265fdc

With --no-tty, the content can be printed

➜  oras blob fetch ghcr.io/oras-project/oras@sha256:488a49baab43328b45444fc9c13861da4408f279ba5247569bbe06a732265fdc --output - --no-tty
{"architecture":"unknown","os":"unknown","config":{},"rootfs":{"type":"layers","diff_ids":["sha256:31e4a5298aed7d277e1784bc57ff297a450e25eb59d5b7ac89f6bb229ac1a18a"]}}%

What did you expect to happen?

The blob content should be printed to stdout

How can we reproduce it?

Run below command

oras blob fetch ghcr.io/oras-project/oras@sha256:488a49baab43328b45444fc9c13861da4408f279ba5247569bbe06a732265fdc --output -

What is the version of your ORAS CLI?

v1.2.0-beta.1

What is your OS environment?

ubuntu 20.04

Are you willing to submit PRs to fix it?

  • Yes, I am willing to fix it.

Activity

  1. added
    bug
    triage
    on Feb 5, 2024
  2. added this to the v1.2.0 milestone on Feb 5, 2024
  3. removed
    triage
    on Mar 11, 2024
  4. FeynmanZhou commented on Mar 12, 2024

    @FeynmanZhou
    Member

    To fix this issue, it would be reasonable to make --output - emit the content of "oras blob fetch" to stdout. That's being said, the flag --output - implies --no-tty in oras blob fetch. A sample experience is as follows:

    $ oras blob fetch ghcr.io/oras-project/oras@sha256:488a49baab43328b45444fc9c13861da4408f279ba5247569bbe06a732265fdc --output -
    {"architecture":"unknown","os":"unknown","config":{},"rootfs":{"type":"layers","diff_ids":["sha256:31e4a5298aed7d277e1784bc57ff297a450e25eb59d5b7ac89f6bb229ac1a18a"]}}%
    
  5. qweeah commented on Mar 15, 2024

    @qweeah
    ContributorAuthor

    We should also allow user to avoid TTY resetting via explicitly put --no-tty=false.

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

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions