msmtp icon indicating copy to clipboard operation
msmtp copied to clipboard

Port msmtpq from bash to POSIX for busybox ash shell to save space for OpenWRT/embedded

Open CapitalF opened this issue 3 years ago • 2 comments

msmtp is a very popular lightweight MTA on OpenWRT and I've been experimenting with it recently.

I've noticed that msmtpq requires bash for it's interpreter and I would like to inquire if porting this to POSIX for the busybox ash shell would be a reasonable feature request.

In OpenWRT, bash requires roughly 420KB of storage, and it's not installed by default. While 420KB seems pathetically small in modern days, it's huge for typical OpenWRT systems, many of which will only have 1-2MB of free overlay space on their 8MB NOR flash chip.

In OpenWRT, the msmtp, msmtp-mta, and msmtp-queue packages themselves total to approximately 57KB in size, which is quite reasonable. The BASH dependency alone is multiples larger, so removing this dependency would be a huge improvement.

The default shell on OpenWRT is busybox's ash shell, While it's not POSIX it's pretty close.

Would you be open to accepting patches to port msmtpq away from bash to a POSIX or ash-compatible variant?

I've already run msmtpq through the shellcheck linter and it's come up with a number of issues. I think the most significant is that ash doesn't have arrays and there's some string indexing issues, but I don't think these would be too difficult to replace.

Please let me know what you think.

CapitalF avatar Jan 04 '22 06:01 CapitalF

The msmtpq scripts are currently unmaintained and any improvements would be welcome. However, please test the changes, we have been bitten in the past by bugs introduced by seemingly obvious removals of bashisms...

marlam avatar Jan 23 '22 14:01 marlam

Okay. Thanks. I'll come back with a pull request or patch some day or another when I get back to this.

CapitalF avatar Jan 26 '22 07:01 CapitalF

Well, it's been a year, so I'll close this for now.

marlam avatar Jan 23 '23 19:01 marlam

@CapitalF There is msmtpq-ng btw

knutov avatar Jan 23 '23 22:01 knutov