LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 27743 - Spaces in paths from llvm-config should be quoted
Summary: Spaces in paths from llvm-config should be quoted
Status: NEW
Alias: None
Product: tools
Classification: Unclassified
Component: llvm-config (show other bugs)
Version: trunk
Hardware: PC Windows NT
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-13 20:20 PDT by Peter Marheine
Modified: 2016-06-11 04:31 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Marheine 2016-05-13 20:20:25 PDT
When LLVM is installed in a path containing spaces, paths output from llvm-config have no way to indicate breaks between parameters and spaces within paths. For example, --cflags on Windows for MSVC might include "-IC:\Program Files\LLVM\include" which parses as "-IC:\Program" "Files\LLVM\include".

This could be fixed with escaping or quoting by llvm-config, perhaps as simple as quoting each individual element it emits. I believe quoting paths is portable to all major shells, though this would involve trading one error case (space in path) for another (quote in path) unless shell escaping logic were added.

Adding quotes to the output might break some existing tools, but given the usual use case is feeding the output to a shell it may not be worth worrying about.

Source issue: https://bitbucket.org/tari/llvm-sys.rs/issues/9/include-path-for-llvm-headers-on-windows
Comment 1 Paul Robinson 2016-05-16 09:09:09 PDT
(In reply to comment #0)
> This could be fixed with escaping or quoting by llvm-config, perhaps as
> simple as quoting each individual element it emits. I believe quoting paths
> is portable to all major shells, though this would involve trading one error
> case (space in path) for another (quote in path) unless shell escaping logic
> were added.

IIRC the double-quote is not a legal pathname character on Windows,
so using double-quote to handle paths with spaces should be fine.