[Toybox] sed -e '$a\'

Patrick Ohly patrick.ohly at intel.com
Wed Mar 23 01:45:38 PDT 2016


Hello!

I mentioned on IRC recently that sed -e '$a\' /dev/null segfaults. It
was pointed out that commit 96a5ed118ce8ad fixes the segfault. I've now
tried that fix and it indeed fixes the segfault.

However, the sed invocation above still does not work because Toybox
complains about the missing text after "a\".

No idea whether that is a valid complaint. coreutils accepts it and
treats it as "add a newline (but only if needed) and then do nothing".

Debian's update-ca-certificates script uses that to conditionally add a
newline after a file which may or may not end with a newline:
http://anonscm.debian.org/cgit/collab-maint/ca-certificates.git/tree/sbin/update-ca-certificates#n100

  # Add trailing newline to certificate, if it is missing (#635570)
  sed -e '$a\' "$CERT" >> "$TEMPBUNDLE"

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.




 1458722738.0


More information about the Toybox mailing list