Re: [PATCH v4 1/4] Makefile: generate Perl header from template file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Dec 03 2017, Junio C. Hamano jotted:

> Johannes Sixt <j6t@xxxxxxxx> writes:
>
>>> +	sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
>>
>> This doesn't work, unfortunately. When $(pathsep) is ';', we get an
>> incomplete sed expression because ';' is also a command separator in
>> the sed language.
>
> It is correct that ';' can be and does get used in place of LF when
> writing a script on a single line, but even then, as part of a
> string argument to 's' command (and also others), there is no need
> to quote ';' or otherwise treat it any specially, as the commands
> know what their syntax is (e.g. 's=string=replacement=' after seeing
> the first '=' knows that it needs to find one unquoted '=' to find
> the end of the first argument, and another to find the end of the
> replacement string, and ';' seen during that scanning would not have
> any special meaning).
>
> If your sed is so broken and does not satisfy the above expectation,
> t6023 would not work for you, I would gess.
>
> t/t6023-merge-file.sh:sed -e "s/deerit.\$/deerit;/" -e "s/me;\$/me./" < new5.txt > new6.txt
> t/t6023-merge-file.sh:sed -e "s/deerit.\$/deerit,/" -e "s/me;\$/me,/" < new5.txt > new7.txt
> t/t6023-merge-file.sh:sed -e 's/deerit./&%%%%/' -e "s/locavit,/locavit;/"< new6.txt | tr '%' '\012' > new8.txt

Since this whole thing is guarded by "ifndef NO_PERL" Dan could just be
using "perl -pe" here instead of fiddling around with the portability
edge cases of sed, e.g.:

    perl -pe 's[foo][bar[g' <in >out



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux