[dev] [sbase] Allow \t escape in sed?

From: Michael Forney <mforney_AT_mforney.org>
Date: Tue, 6 Dec 2016 20:58:43 -0800

I recently came across an issue running `make headers_install` for
installing kernel headers. The headers_install.sh script runs

sed -r \
  -e 's/([ \t(])(__user|__force|__iomem)[ \t]/\1/g' \
  -e 's/__attribute_const__([ \t]|$)/\1/g' \
  -e 's_AT_^#include <linux/compiler.h>@@' \
  -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g'
  -e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \
  -e 's_AT_#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \
  "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1

which doesn't work correctly with sbase sed because it doesn't support
escaped tabs. There is a comment at the top of sed.c wondering about
allowing this. POSIX says "For each other <backslash> encountered, the
following character shall lose its special meaning (if any)", so for
strict compliance, '\t' should be treated as just 't', as in the
current version of sed.

How should we resolve this? Replace '\t' with a literal tab character
in the headers_install.sh script, or add '\t' to the list of
characters handled by escapes() in sed.c? Other sed implementations I
looked at do not support escaped tabs, but I'm not sure how willing
the kernel people would be to removing the tab escapes.

What do others think? I'm leaning towards just trying to fix this by
patching the headers_install.sh locally and hoping it gets accepted.
Received on Wed Dec 07 2016 - 05:58:43 CET

This archive was generated by hypermail 2.3.0 : Wed Dec 07 2016 - 06:00:16 CET