Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find string terminator '"' anywhere before EOF at -e line 1 #160

Open
paulocoutinhox opened this issue Nov 13, 2023 · 12 comments
Open

Comments

@paulocoutinhox
Copy link

My error:

create-dmg \
		--volname "MyApp" \
		--icon "extras/macos/icon.icns" \
		--hide-extension "dist/MyApp.app" \
		--hdiutil-quiet \
		"MyApp.dmg" \
		"dist/MyApp.app"
Creating disk image...
Mounting disk image...
Device name:     /dev/disk18
Searching for mounted interstitial disk image using /dev/disk18s... 
Mount dir:       /Volumes/dmg.YI9n9f
String found where operator expected at -e line 1, at end of line
	(Missing semicolon on previous line?)
Can't find string terminator '"' anywhere before EOF at -e line 1.
make: *** [dmg] Error 255

Can you help me?

@octopus-russell
Copy link

I'm also getting this issue

@pzhlkj6612
Copy link
Contributor

Hi. It looks like the perl scripts didn't work properly.

create-dmg/create-dmg

Lines 477 to 480 in 6d23359

| perl -pe "s/POSITION_CLAUSE/$POSITION_CLAUSE/g" \
| perl -pe "s/QL_CLAUSE/$QL_CLAUSE/g" \
| perl -pe "s/APPLICATION_CLAUSE/$APPLICATION_CLAUSE/g" \
| perl -pe "s/HIDING_CLAUSE/$HIDING_CLAUSE/" \

I didn't dig into this but want to provide a way to analyze the issue.

Please execute set -x before executing create-dmg ... . The number of output lines will increase a lot. Paste the log between "Mount dir: ..." and "String found where operator expected ..." in your new comment. After that, execute set +x to revert the change.

@octopus-russell
Copy link

octopus-russell commented Nov 18, 2023

Hi, thanks for having a look, with set -x, I've obtained the following log:

Mounting disk image...
Device name: /dev/disk10
Searching for mounted interstitial disk image using /dev/disk10s...
Mount dir: /Volumes/dmg.KKJF9v
Making link to Applications dir...
/Volumes/dmg.KKJF9v
Unknown regexp modifier "/U" at -e line 1, at end of line
Can't find string terminator '"' anywhere before EOF at -e line 1.
Error: Process completed with exit code 255.

Thanks

@pzhlkj6612
Copy link
Contributor

Hi, thanks for having a look, with set -x, I've obtained the following log:

Sorry, specifying set -x outside does not work. Please try this:

env SHELLOPTS=xtrace create-dmg ...

No set +x required.

The output will be too much verbose, so please only paste the log between "Mount dir: ..." and "Can't find string terminator ..." in your new comment.

@Cy0u
Copy link

Cy0u commented Dec 11, 2023

Hi, since there was no response from the author I am facing the same issue now.
Here is my output from

env SHELLOPTS=xtrace create-dmg ...
Mount dir:       /Volumes/dmg.sRtJLK
+ [[ -n /vsts-agent-osx-x64-3.227.1/_work/1/s/App/App.MacOs/installer.png ]]
+ echo 'Copying background file '\''/vsts-agent-osx-x64-3.227.1/_work/1/s/App/App.MacOs/installer.png'\''...'
+ [[ -d /Volumes/dmg.sRtJLK/.background ]]
Copying background file '/vsts-agent-osx-x64-3.227.1/_work/1/s/App/App.MacOs/installer.png'...
+ mkdir /Volumes/dmg.sRtJLK/.background
+ cp /vsts-agent-osx-x64-3.227.1/_work/1/s/App/App.MacOs/installer.png /Volumes/dmg.sRtJLK/.background/installer.png
+ [[ -n 593 ]]
+ echo 'Making link to Applications dir...'
+ echo /Volumes/dmg.sRtJLK
+ ln -s /Applications /Volumes/dmg.sRtJLK/Applications
Making link to Applications dir...
/Volumes/dmg.sRtJLK
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
++ basename /Volumes/dmg.sRtJLK
+ VOLUME_NAME=dmg.sRtJLK
++ mktemp -t createdmg.tmp.XXXXXXXXXX
+ APPLESCRIPT_FILE=/var/folders/qh/3mwgzh5j4wndm11mjqpxc3p40000gn/T/createdmg.tmp.XXXXXXXXXX.dxkMShQy
+ [[ 0 -eq 1 ]]
+ [[ 0 -eq 0 ]]
+ cat /opt/homebrew/share/create-dmg/support/template.applescript
+ sed -e s/WINX/200/g -e s/WINY/120/g -e s/WINW/835/g -e s/WINH/500/g -e 's/BACKGROUND_CLAUSE/set background picture of opts to file ".background:installer.png"/g' -e 's/REPOSITION_HIDDEN_FILES_CLAUSE/set position of every item to {theBottomRightX + 100, 100}/g' -e s/ICON_SIZE/128/g -e s/TEXT_SIZE/16/g
+ perl -pe 's/POSITION_CLAUSE/set position of item "/vsts-agent-osx-x64-3.227.1/_work/1/s/App/App.MacOs/bin/Release/Archive/2023-12-11/Archive.xcarchive/Products/Applications/Application.app" to {230, 295}
			/g'
+ perl -pe s/QL_CLAUSE//g
+ perl -pe 's/APPLICATION_CLAUSE/set position of item "Applications" to {593, 295}
			/g'
+ perl -pe 's/HIDING_CLAUSE/set the extension hidden of item "/vsts-agent-osx-x64-3.227.1/_work/1/s/App/App.MacOs/bin/Release/Archive/2023-12-11/Archive.xcarchive/Products/Applications/Application.app" to true
			/'
Unknown regexp modifier "/U" at -e line 1, at end of line
Can't find string terminator '"' anywhere before EOF at -e line 1.
Unknown regexp modifier "/U" at -e line 1, at end of line
Can't find string terminator '"' anywhere before EOF at -e line 1.

I do execute that as a part of our pipeline, so the call is made from a terminal.
The terminal got full disk permissions in MacOs.
I hope that helps, if not please ask me which information I can provide.

Thanks and kind regards,
Aron

@Cy0u
Copy link

Cy0u commented Dec 21, 2023

So we figured out why this wasn't working on the hosted agent.
We allowed "APPLESCRIPT" on the agent and then everything worked like excpected. :-)

@aonez
Copy link
Member

aonez commented Dec 21, 2023

If this can be verified by others that had the same issue maybe we can add a check to properly fail when this is needed.

@Cy0u
Copy link

Cy0u commented Dec 21, 2023

We did run that script:

epochdate=$(($(date +'%s * 1000 + %-N / 1000000')))
tcc_service_appleevents="replace into access (service,client,client_type,auth_value,auth_reason,auth_version,indirect_object_identifier_type,indirect_object_identifier,flags,last_modified) values (\"kTCCServiceAppleEvents\",\"/run\",1,2,4,1,0,\"com.apple.finder\",0,$epochdate);"
sudo sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" "$tcc_service_appleevents"  

/run was the startup shell script for the dev ops agent.

@octopus-russell
Copy link

So we figured out why this wasn't working on the hosted agent. We allowed "APPLESCRIPT" on the agent and then everything worked like excpected. :-)

How does one 'allow' applescript?

@Cy0u
Copy link

Cy0u commented Jan 7, 2024

So we figured out why this wasn't working on the hosted agent. We allowed "APPLESCRIPT" on the agent and then everything worked like excpected. :-)

How does one 'allow' applescript?

I posted the script one comment above yours.

@paulocoutinhox
Copy link
Author

paulocoutinhox commented Feb 2, 2024

Im getting the same error and when try the script i get Error: unable to open database "/Library/Application Support/com.apple.TCC/TCC.db": authorization denied.

And it exists:

ls -lah "/Library/Application Support/com.apple.TCC/TCC.db"
-rw-r--r--  1 root  wheel    56K Feb  2 12:13 /Library/Application Support/com.apple.TCC/TCC.db

@aonez
Copy link
Member

aonez commented Feb 9, 2024

Does this also occur with version 1.1.0?

https://github.com/create-dmg/create-dmg/releases/tag/v1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants