Uploaded image for project: 'Swift'
  1. Swift
  2. SR-1304

Handle spaces in path when parsing flags from pkgconfig

    XMLWordPrintable

    Details

      Description

      cflags and libs obtained by parsing .pc are space separated files but paths can also contain spaces in them. Right now they're being split blindly on encounter of a space, this should be handled. For eg: a flag might be :
      "-I/usr/local/Cellar/gtk+3/3.18.9/include/gtk-3.0 -I/usr/local/Cellar/glib/2.46.2/include/gio-unix-2.0/" which is converted into string array :
      ["-I/usr/local/Cellar/gtk+3/3.18.9/include/gtk-3.0", "-I/usr/local/Cellar/glib/2.46.2/include/gio-unix-2.0/"]
      If the flag is:
      "-I/usr/local/Cel\ lar/gtk+3/3.18.9/include/gtk-3.0 -I/usr/local/Cellar/glib/2.46.2/include/gio-unix-2.0/"
      it would be converted to:
      ["-I/usr/local/Cel\", "lar/gtk+3/3.18.9/include/gtk-3.0", "-I/usr/local/Cellar/glib/2.46.2/include/gio-unix-2.0/"]
      The correct output should be :
      ["-I/usr/local/Cel\ lar/gtk+3/3.18.9/include/gtk-3.0", "-I/usr/local/Cellar/glib/2.46.2/include/gio-unix-2.0/"]

      Related FIXME in code: https://github.com/apple/swift-package-manager/blob/master/Sources/Build/PkgConfig.swift#L40

      What you'll learn:
      The problem is pretty easy to solve but it'll get one started on setting up the swiftpm development environment as well writing and running swiftpm tests.

        Attachments

          Activity

            People

            Assignee:
            aciid Ankit Aggarwal
            Reporter:
            aciid Ankit Aggarwal
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: