microsoft/FHIR-Converter

Missing ampersand in Microsoft.Health.Fhir.TemplateManagement.csproj

emluk opened this issue · 1 comments

emluk commented

Hi everyone,

Line 89 of Microsoft.Health.Fhir.TemplateManagement.csproj seems to be missing an & which makes the build fail on linux.

OS: Arch Linux (Linux {user} 5.19.10-arch1-1 ... x86_64 GNU/Linux)

Problem

The build fails with message:

Downloading from "https://github.com/deislabs/oras/releases/download/v0.12.0/oras_0.12.0_windows_amd64.tar.gz" to "/home/lukas/repo/FHIR-Converter/bin/oras_win_amd64.tar.gz" (4,209,301 bytes).
  cp: cannot stat '../../bin/oras.exe': No such file or directory

Steps to reproduce

git clone git@github.com:microsoft/FHIR-Converter.git
cd FHIR-Converter/src/Microsoft.Health.Fhir.TemplateManagement
dotnet build .

Expected Behavior

Build should succeed

Suggested Fix

Editing Line 89 of Microsoft.Health.Fhir.TemplateManagement.csproj from

<Exec Command="tar -xvf $(BinFolder)$(OrasWinTarGzFile) -C $(BinFolder) &amp; $(CopyExecutable) $(BinFolder)oras.exe ." />

to

<Exec Command="tar -xvf $(BinFolder)$(OrasWinTarGzFile) -C $(BinFolder) &amp;&amp; $(CopyExecutable) $(BinFolder)oras.exe ." />

fixes the issue locally.

Possible explanation

A single ampersand (&amp;) in the linux shell is the operator to execute a command in the background. I think what was intended here was to first unpack and then copy the file. The linux shell operator to run a command once another one finishes successfully is && (&amp;&amp;). So what happens here is that the unpack command is executed in the background and once that command started, it is attempted to copy the not yet unpacked file, creating the error above.

I am not sure, if the double ampersand might break something for building on Microsoft Windows, since I do not really know my way around Windows too much.
If there is something I can do, other than forking the project and changing it myself, I am open for suggestions.

I wish all of you a great day!

Thanks for your contribution, your PR #433 is currently merged into dotliquid branch and will be merge in main branch in the next release.