Fish is an alternative command-line shell which has gained some popularity. A frequently-asked question[1][2][3][4] is how to get fish and pkg-config to cooperate. While POSIX shells split their command substitutions into tokens based on whitespace, fish uses only newlines by default. That is, the following are equivalent: (sh) c++ `echo some args` (fish) c++ (echo some; echo args) This has been a deliberate design decision to avoid the problems with files containing embedded spaces and so on. Obviously it is still not resistant to embedded newlines but that is the tradeoff that has been made. So, in fish, the current "best" method of using pkg-config is: c++ (pkg-config --cflags somepkg | tr ' ' '\n') I'd like to improve this situation. The options I can see, in decreasing order of personal preference, are: - Have pkg-config produce its output for --cflags etc. newline-delimited (possibly iff $SHELL = fish) - Ship a small wrapper with fish that adjusts the output in a relatively conservative way (only in command substitutions) - Document the change required in the FAQ and leave it at that Would you take a patch that does the first? [1]: https://github.com/fish-shell/fish-shell/issues/982 [2]: https://github.com/fish-shell/fish-shell/issues/1947 [3]: http://stackoverflow.com/q/28128669/125549 [4]: https://sourceforge.net/p/fish/mailman/message/33053671/
I suppose I'd take a patch that prints each argument on a newline if it's not too intrusive. I'd prefer not to autodetect it but rather have it be an explicit option (--fish-syntax?). Not really sure, this is an unusual environment. I don't really see how command substitution is going to work well in fish unless all other tools are changed to output newlines or fish handles this natively. For what it's worth, pkg-config does try hard to quote output so that embedded whitespace works correctly. But that's for a POSIX shell and won't help you here. However, note that replacing spaces with newlines may not always work.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pkg-config/pkg-config/issues/39.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.