On 6/18/25 5:37 PM, Alvaro Falagan wrote:
Hi,

I would like to report an issue I’ve found in Bash (5.0.17) regarding the
use of pipelines involving built-in commands and here-documents.

### Summary

When a built-in (e.g., `echo`, `export`, `cd`, etc.) is used in a pipeline,
and the next command starts with a malformed or incomplete `<<EOF` heredoc,
Bash does not clean up all its internal memory and leaves at least one file
descriptor (`/dev/pts/0`, fd 255) open at exit.

Bash does not make any effort to free allocated memory before exiting:
there is no need to, since the system will clean up any resources attached
to the exiting process.

The same with file descriptors. The kernel closes and deallocates any open
file descriptors associated with an exiting process.

This issue is not limited to `echo`; it happens with any built-in command,
as long as a heredoc follows it improperly in a pipeline.

When I try this with the current bash-5.3 release candidate, I don't see
any memory leaks reported.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to