Skip to content

getAppPath mdfind command returning multiple paths - this causes packer to fail #63

@FredericoC

Description

@FredericoC

Overview of the Issue

I was getting the following error;

Build 'parallels-iso.linux-ubuntu-server' errored after 472 milliseconds 110 microseconds: Couldn't find Parallels Tools for the 'lin-arm' flavor!...

Parallels SDK was installed and I could see the iso files there, so I dug further. Turns out I have two "Parallels Desktop" folders due to a "Carbon Copy Cloner" backup which is mounted on another volume. So the output of my mdfind command is as follows;

~/Projects$ mdfind kMDItemCFBundleIdentifier == com.parallels.desktop.console
/Applications/Parallels Desktop.app
/Volumes/CarbonCopy Backup/Applications/Parallels Desktop.app

Since the getAppPath function simply returns the command output, it puts the two paths in the same string and the build fails straight away because it can't find the tools iso. Unmounting the carbon copy volume fixes the issue.

Since it's so unlikely to happen (and if it does it's likely because of a duplicate/backup like in my case), I've played around with simply changing it to;

pathOutput := strings.TrimSpace(strings.Split(stdout.String(), "\n")[0])

However did not get to test it since Go is not my normal dev environment and I couldn't figure out how to install custom plugins (I got to compile it but couldn't install it).

Reproduction Steps

Use Carbon Copy Cloner (can download a trial) to backup the Parallels Desktop folder to another volume. Run packer build.

Plugin and Packer version

Packer v1.8.4

Simplified Packer Buildfile

Not relevant

Operating system and Environment details

macOS, darwin_arm64

Log Fragments and crash.log files

Not relevant

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions