Page MenuHomeFreeBSD

rpcgen: Perform shell-style word expansion on RPCGEN_CPP
ClosedPublic

Authored by jrtc27 on Jul 13 2023, 5:30 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jun 27, 3:09 PM
Unknown Object (File)
Wed, Jun 5, 3:15 AM
Unknown Object (File)
May 23 2024, 7:23 PM
Unknown Object (File)
May 12 2024, 6:50 AM
Unknown Object (File)
May 9 2024, 9:48 PM
Unknown Object (File)
May 2 2024, 11:08 AM
Unknown Object (File)
May 1 2024, 6:07 PM
Unknown Object (File)
Mar 5 2024, 8:33 PM
Subscribers

Details

Summary

Up until recently, CPP has been a list of space-separated words, with no
quotes, backslashes or other characters with special meaning to a shell.
However, as of 8fad2cda93c7, (escaped) quotes appear in CPP, and the
rudimentary parser in rpcgen is insufficient, since it will leave the
escaped quotes as escaped rather than performing one level of expansion
as would be done by a shell (whether in a script or a Makefile).

Rather than hack around this in all the places RPCGEN_CPP gets set,
implement proper expansion inside rpcgen. Note that this only deals with
a subset of shell syntax, since we don't handle any of:

| & ; < > ( ) $ ` * ? [ # ˜ = %

having special meaning (with the exception of how a backslash behaves
inside double quotes, where \$ means a literal $ inside double quotes
but \a means a literal \a), instead using their literal value, but those
are all reasonable restrictions, and can be worked around by avoiding
their use; what's important is that we get the quoting and splitting
right.

This fixes -Winvalid-pp-token spew during build${libcompat}.

Fixes: 8fad2cda93c7 ("bsd.compat.mk: Provide new CPP and sub-make variables")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Jul 13 2023, 4:03 PM

Fix case label over-indentation

This revision now requires review to proceed.Jul 13 2023, 4:24 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jul 14 2023, 1:37 AM
This revision was automatically updated to reflect the committed changes.