leahneukirchen / mblaze

Unix utilities to deal with Maildir
Other
450 stars 50 forks source link

mquote: make sed expression to strip signature work with busybox sed #74

Closed nmeum closed 7 years ago

nmeum commented 7 years ago

Not sure if compatibility with non-GNU sed version is a goal of this project but you seem to have fixed non-POSIX sed usage in the past. Therefore I wanted to inform you that mquote doesn't work with busybox sed because the sed expression to strip the signature seems to strip all lines except the first one with busybox sed. For example:

$ printf "foo\nbar\n-- \nbaz" | sed -n '/^-- $/!p;//q'
foo

I am not a sed magician myself but I came up with a solution that seems to work with busybox sed as well. Not sure if it is ideal though...

leahneukirchen commented 7 years ago

Probably a bug in busybox, but this fix works.

leahneukirchen commented 7 years ago

I guess even better would be sed -n '/^-- $/q;p'

nmeum commented 7 years ago

That works as well, but this expression should be semantically equivalent to the one suggested by me. Mine specifies two addresses (beginning of signature separator and end of input) and prints the lines that are not in between those two while your expression prints everything until the first signature separator.

leahneukirchen commented 7 years ago

It's more efficient on really long footers. ;)