I have a super simple script to confirm this behavior:
leak.sh
#! /bin/bash
echo "Am I leaking?"
Execute under valgrind...
$ valgrind ./leak.sh
==1365336== Memcheck, a memory error detector
==1365336== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1365336== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==1365336== Command: ./leak.sh
==1365336==
Am I leaking?
==1365336==
==1365336== HEAP SUMMARY:
==1365336== in use at exit: 50,076 bytes in 766 blocks
==1365336== total heap usage: 858 allocs, 92 frees, 59,487 bytes allocated
==1365336==
==1365336== LEAK SUMMARY:
==1365336== definitely lost: 12 bytes in 1 blocks
==1365336== indirectly lost: 0 bytes in 0 blocks
==1365336== possibly lost: 0 bytes in 0 blocks
==1365336== still reachable: 50,064 bytes in 765 blocks
==1365336== suppressed: 0 bytes in 0 blocks
==1365336== Rerun with --leak-check=full to see details of leaked memory
==1365336==
==1365336== For lists of detected and suppressed errors, rerun with: -s
==1365336== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
If you change the script to use the dash, the default shell (sh) for Pop!_OS (and I assume all Debian distros), then it will run without leaking.
no_leak.sh
#! /bin/dash
echo "Am I leaking?"
$ valgrind ./no_leak.sh
==1365800== Memcheck, a memory error detector
==1365800== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1365800== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==1365800== Command: ./no_leak.sh
==1365800==
Am I leaking?
==1365800==
==1365800== HEAP SUMMARY:
==1365800== in use at exit: 10,666 bytes in 77 blocks
==1365800== total heap usage: 80 allocs, 3 frees, 14,809 bytes allocated
==1365800==
==1365800== LEAK SUMMARY:
==1365800== definitely lost: 0 bytes in 0 blocks
==1365800== indirectly lost: 0 bytes in 0 blocks
==1365800== possibly lost: 0 bytes in 0 blocks
==1365800== still reachable: 10,666 bytes in 77 blocks
==1365800== suppressed: 0 bytes in 0 blocks
==1365800== Rerun with --leak-check=full to see details of leaked memory
==1365800==
==1365800== For lists of detected and suppressed errors, rerun with: -s
==1365800== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Where can I report this observation, or find out if it has already been addressed?
bash Version
$ bash --version
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
As mentioned by @oguz_ismail in the comments,
[email protected]is the appropriate place to report the bug.However, a certain format for the email is required/requested, when you need to report a bug.
You can find ALL the details at: https://www.gnu.org/software/bash/manual/html_node/Reporting-Bugs.html
Finally, there is a helper script built into
bashitself. Callbashbugfrom the command line, and it will populate most of the requirements, leaving you to fill out the description and the steps required to reproduce the bug.Once you have filled in the template, you will be prompted if you would like to send the email. It's okay if you don't have an email client connected, it will store the completed form at
~/dead.bashbugand you can copy paste it into your email client.