utils/bash: Import upstream patches for 5.0