svn commit: r323302 - head/games/ltris

Alexey Dokuchaev danfe at FreeBSD.org
Fri Jul 19 15:27:27 UTC 2013


On Fri, Jul 19, 2013 at 03:12:47PM +0000, Johan van Selst wrote:
> New Revision: 323302
> URL: http://svnweb.freebsd.org/changeset/ports/323302
> 
> Log:
>   Use slashes as regex separators everywhere for consistency
>   
>   Suggested by:	danfe

Well, thanks, but... (see below)

> @@ -28,9 +28,9 @@ PLIST_SUB+=	NLS="@comment "
>  .endif
>  
>  post-patch:
> -	@${REINPLACE_CMD} -e 's|/icons|/pixmaps|g' ${WRKSRC}/Makefile.in
> -	@${REINPLACE_CMD} -e 's|= @mixer_flag@|= @INTLLIBS@ @mixer_flag@|g ; \
> -		 s|--mode=666||g' ${WRKSRC}/src/Makefile.in
> +	@${REINPLACE_CMD} -e 's/\/icons/\/pixmaps/g' ${WRKSRC}/Makefile.in
> +	@${REINPLACE_CMD} -e 's/= @mixer_flag@/= @INTLLIBS@ @mixer_flag@/g ; \
> +		 s/--mode=666//g' ${WRKSRC}/src/Makefile.in

The reason people are using commas, bars, carets, pluses, etc. for regex
separation is because these characters are less likely to clash with the
ones present in the search string.  Most notably, (and that's very well
illustrated by this example), is to avoid escaping slashes when dealing
with paths (which use slashes as separators in Unix).

My original point was not that you have to change it to slashes, but only
be consistent within the Makefile.  For example: I would usually use ,
(comma) or | (bar); when there's a clash (like when I have to patch some
function call, which uses comma for parameter separation), I may choose ^
(caret), or + (plus), or even @ (comm. "at") to avoid escaping.

Escaping should be avoided as it is error-prone and generally harder to
read and comprehend.  That said, in each particular case, the best char
for s-expression should be selected on per-case basis, wisely.

./danfe


More information about the svn-ports-all mailing list