port & root

Bjarne D Mathiesen macintosh at mathiesen.info
Thu Apr 5 16:26:49 UTC 2018


When running port in certain situations under the root account, it fails

In particular, I've got at script

diffPorts :
#!/macports/bin/bash
diff <( port -q search ${1} ) \
     <( port -q installed name:^${1} | awk '{print $1}' ) \
| grep '<'

which I'm using to get a list of sub-ports not installed;
eg : ./diffPorts php72-

When running './diffPorts php72-' as root I get this :

Error: /macports/bin/port: Failed to initialize MacPorts, error deleting
"/macports/var/macports/home/Library/Preferences/com.apple.dt.Xcode.plist":
no such file or directory
< error deleting
"/macports/var/macports/home/Library/Preferences/com.apple.dt.Xcode.plist":
no such file or directory
<     while executing
< "file delete -force "${target_dir}/com.apple.dt.Xcode.plist""
<     (procedure "macports::copy_xcode_plist" line 5)
<     invoked from within
< "macports::copy_xcode_plist $env(HOME)"
<     (procedure "mportinit" line 540)
<     invoked from within
< "mportinit ui_options global_options global_variations"

each sub-part of the script works perfectly; that is
     port -q search php72-
     port -q installed name:^php72- | awk '{print $1}'
have no issues; but when combining them in the redirection for 'diff' I
get the error; but only when the script is being run under the root
account. When running it under an admin or normal user account, there
are no issues.

-- 
Bjarne D Mathiesen
Korsør ; Danmark ; Europa
----------------------------------------------------------------------
denne besked er skrevet i et totalt M$-frit miljø
macOS 10.13.4 High Sierra (17E199)
2 x 3,46 GHz 6-Core Intel Xeon ; 48 GB 1333 MHz DDR3 ECC
ATI Radeon HD 5770 1024 MB


More information about the macports-dev mailing list