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)
Tue, Oct 29, 4:45 AM
Unknown Object (File)
Tue, Oct 29, 4:45 AM
Unknown Object (File)
Tue, Oct 29, 4:45 AM
Unknown Object (File)
Tue, Oct 29, 4:45 AM
Unknown Object (File)
Tue, Oct 29, 4:23 AM
Unknown Object (File)
Sep 30 2024, 12:27 PM
Unknown Object (File)
Sep 30 2024, 12:20 PM
Unknown Object (File)
Sep 30 2024, 12:12 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.