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

From: Antoni V. <antoniv_AT_gmx.com>
Date: Wed, 7 Dec 2016 11:06:28 +0100

It was added by Landley - toybox author - as one ''POSIX-2008 shell script implementation''
https://github.com/torvalds/linux/commit/e0e2fa4b515cd61aabb5b32e8b816ed97dbe2490
He could not be in the know that \t isn't POSIX
Contact him?

> Sent: Wednesday, December 07, 2016 at 2:58 AM
> From: "Michael Forney" <mforney_AT_mforney.org>
> To: "dev mail list" <dev_AT_suckless.org>
> Subject: [dev] [sbase] Allow \t escape in sed?
>
> 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 - 11:06:28 CET

This archive was generated by hypermail 2.3.0 : Wed Dec 07 2016 - 11:12:12 CET