Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-1649

codesign modules fails to sign macOS bundle if version is set

    XMLWordPrintable

    Details

    • Platform/s:
      macOS
    • Commits:
      fb3b51013323d76c301a36c20fb4b53cc93fb45b (qbs/qbs/1.19)

      Description

      codesign an app bundle on macOS fails if the application has a version set:

      import qbs
      
      CppApplication {
      	Depends { name: "codesign" }
      	Depends { name: "bundle" }
      	
      	version: "3.4.1"
      
      	codesign.enableCodeSigning: true
      	bundle.isBundle: true
      	bundle.identifierPrefix: "org.example"
      
      	// next line: workaround
      	bundle.frameworkVersion: ""
      
      	files: [	
      		"main.cpp"
      	]
      }
      

      setting the version lets BundleModule.qbs frameworkVersion() accidentally derive a framework version which then lets codesign deduce the product is a framework rather than an application and will append "Content" to the signing file path which lets codesign fail with "invalid bundle".

      My proposed fix is:

      bundle/BundleModule.qbs::135:
      
          property string frameworkVersion: {
      +        if( product.type.contains("application") )
      +            return "";
              var n = parseInt(product.version, 10);
              return isNaN(n) ? bundleSettingsProbe.xcodeSettings["FRAMEWORK_VERSION"] : String(n);
          }
      
      

      Cheers,

      Max

       

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            arch Ivan Komissarov
            Reporter:
            hrabowski Maximilian Hrabowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes