openwrt / openwrt/packages

mailsend subject arg must not have a trailing space

Open
#17,470 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Makefile
Stars
4.6k
Forks
4k
Avg merge
3d 12h
Merged PRs (30d)
134

Description

Maintainer @thess
Environment: ath79 Archer A7 V5, OpenWrt-21.02.0

Basically, mailsend screws up if the -sub argument ends with a newline. Shouldn't it tolerate that, even if inadvisable?

But I didn't put a newline at the end of the -sub argument, which makes this more mysterious, even if that's not mailsend's fault. If the -sub arg has a trailing space, it somehow becomes a newline by the time the mailsend process appears in /procs/$$/cmdline. (I'm not sure how that character substitution happens. It does not happen when I use mailsend interactively, but it does happen when I call it from inside a script. Anyway, fascinating as that issue may be, that's not what this report is about, really.)
Assuming that the -sub argument to mailsend has a trailing newline (as reported in /procs/$$/cmdline), mailsend misbehaves, creating an incorrectly MIME-formatted mail which my spampd flags as such. Sample invocations, /proc/$$/cmdline files, and resulting messages are in the attached file
subject_arg_difference.txt
.
(This was hard for me to figure out because exactly the same invocation of mailsend -- with all args identical from the user perspective -- would either work and not work, depending on whether they were used interactively at a shell prompt or non-interactively from within a script. I would appreciate any enlightenment on how a space becomes a newline at the end of an argument. The workaround I'm using, of course, is to make very sure that there are no trailing spaces in the -sub arg, but the effort involved in finding the problem was, for me at least, nontrivial.)

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 with the attached subject_arg_difference.txt and reproduce the interactive and scripted mailsend invocations, comparing /proc/$$/cmdline with the resulting messages. Then trace mailsend's argument handling; done means the trailing-newline case no longer creates incorrectly MIME-formatted mail and the reported discrepancy is understood.

Written by the indexing model from the issue text.

Assessment

Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.