[GH-ISSUE #219] asciinema changes shell behaviour #777

Closed
opened 2026-03-15 10:21:53 +03:00 by kerem · 10 comments
Owner

Originally created by @ml0renz0 on GitHub (Aug 24, 2017).
Original GitHub issue: https://github.com/asciinema/asciinema/issues/219

This command gets stuck only when running inside asciinema:
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 40 | head -n 1
It works perfectly under a shell.

Originally created by @ml0renz0 on GitHub (Aug 24, 2017). Original GitHub issue: https://github.com/asciinema/asciinema/issues/219 This command gets stuck only when running inside asciinema: ```cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 40 | head -n 1``` It works perfectly under a shell.
kerem 2026-03-15 10:21:53 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@ku1ik commented on GitHub (Aug 31, 2017):

That's interesting. I am able to reproduce it on the latest version (1.4).

🤔

<!-- gh-comment-id:326237428 --> @ku1ik commented on GitHub (Aug 31, 2017): That's interesting. I am able to reproduce it on the latest version (1.4). 🤔
Author
Owner

@markasoftware commented on GitHub (Oct 17, 2017):

I have experienced the same issue with tr -dc a-zA-Z0-9 < /dev/urandom | head -c 20. It's very strange, doing head directly on /dev/urandom works fine, and doing tr without piping output also works fine (EDIT: not exactly, sometimes i can get head to fail actually). As I understand it this is a common way to get random values in a shell script, so this really should be fixed.

<!-- gh-comment-id:337112588 --> @markasoftware commented on GitHub (Oct 17, 2017): I have experienced the same issue with `tr -dc a-zA-Z0-9 < /dev/urandom | head -c 20`. It's very strange, doing head directly on /dev/urandom works fine, and doing tr without piping output also works fine (EDIT: not exactly, sometimes i can get head to fail actually). As I understand it this is a common way to get random values in a shell script, so this really should be fixed.
Author
Owner

@markasoftware commented on GitHub (Oct 18, 2017):

This does not appear to occur in certain shells. It does occur in Bash, but asciinema rec -c zsh works without error. Zsh is mostly compatible with Bash, so in most situations this can be worked around by simply recording a zsh session.

<!-- gh-comment-id:337428944 --> @markasoftware commented on GitHub (Oct 18, 2017): This does not appear to occur in certain shells. It does occur in Bash, but `asciinema rec -c zsh` works without error. Zsh is mostly compatible with Bash, so in most situations this can be worked around by simply recording a zsh session.
Author
Owner

@ku1ik commented on GitHub (Oct 18, 2017):

Thanks for the update @markasoftware. I'm not sure what exactly is happening here, but I suspect this has something to do with our PTY recorder: https://github.com/asciinema/asciinema/blob/develop/asciinema/pty_recorder.py

<!-- gh-comment-id:337483458 --> @ku1ik commented on GitHub (Oct 18, 2017): Thanks for the update @markasoftware. I'm not sure what exactly is happening here, but I suspect this has something to do with our PTY recorder: https://github.com/asciinema/asciinema/blob/develop/asciinema/pty_recorder.py
Author
Owner

@ku1ik commented on GitHub (Nov 26, 2017):

I'm no longer able to reproduce that on current develop branch. Can you try @markasoftware and @mlorenzo-stratio ? Here's how to run it from git: https://github.com/asciinema/asciinema#running-latest-version-from-source-code-checkout

<!-- gh-comment-id:346974890 --> @ku1ik commented on GitHub (Nov 26, 2017): I'm no longer able to reproduce that on current `develop` branch. Can you try @markasoftware and @mlorenzo-stratio ? Here's how to run it from git: https://github.com/asciinema/asciinema#running-latest-version-from-source-code-checkout
Author
Owner

@markasoftware commented on GitHub (Nov 26, 2017):

Still does not work for me on develop branch. Behavior is the same as before.

<!-- gh-comment-id:346975132 --> @markasoftware commented on GitHub (Nov 26, 2017): Still does not work for me on develop branch. Behavior is the same as before.
Author
Owner

@ku1ik commented on GitHub (Dec 2, 2017):

I think this may be related: https://github.com/ansible/ansible-modules-core/issues/2305#issuecomment-164170222

<!-- gh-comment-id:348710083 --> @ku1ik commented on GitHub (Dec 2, 2017): I think this may be related: https://github.com/ansible/ansible-modules-core/issues/2305#issuecomment-164170222
Author
Owner

@ku1ik commented on GitHub (Dec 2, 2017):

If it's about signal handling (like mentioned in the above linked comment) we may be doing something wrong here: github.com/asciinema/asciinema@1e5e20b213/asciinema/pty_recorder.py (L100-L109)

<!-- gh-comment-id:348712647 --> @ku1ik commented on GitHub (Dec 2, 2017): If it's about signal handling (like mentioned in the above linked comment) we may be doing something wrong here: https://github.com/asciinema/asciinema/blob/1e5e20b21381fbbd60ab05a986d0b26f464d59dc/asciinema/pty_recorder.py#L100-L109
Author
Owner

@luckydenis commented on GitHub (May 7, 2019):

Good afternoon. I'm on version 2.0.2 to reproduce failed. Already fixed?

<!-- gh-comment-id:490053125 --> @luckydenis commented on GitHub (May 7, 2019): Good afternoon. I'm on version 2.0.2 to reproduce failed. Already fixed?
Author
Owner

@ku1ik commented on GitHub (Feb 20, 2022):

This seems to be fixed now, cannot reproduce anymore.

<!-- gh-comment-id:1046260722 --> @ku1ik commented on GitHub (Feb 20, 2022): This seems to be fixed now, cannot reproduce anymore.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asciinema#777
No description provided.