zopencommunity / zopencommunity/bashport

Bash garbling output after stderr to stdout redirection and then piping to tee

Open
#68 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Groovy
Stars
12
Forks
7
PR merge metrics
No merged PRs in 30d

Description

Here's a reduced scenario:
a.sh:

#!/bin/sh
echo "blabla" >&2
echo "blabla" >&2

The output is garbled:

$ ./a.sh 2>&1 | tee a.txt
blabla
�%/�%/�
$ _TAG_REDIR_OUT= ./a.sh 2>&1 | tee a.txt
blabla
blabla

Works when _TAG_REDIR_OUT is unset as above

There might be some double conversion happening due to _TAG_REDIR_OUT=txt and bash tagging stdout

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the reduced a.sh example with ./a.sh 2>&1 | tee a.txt, then repeat with _TAG_REDIR_OUT= and compare the captured output. Trace the redirection and stdout-tagging path implicated by the report. Done means the piped output remains blabla on both lines without requiring the environment variable workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.