I'm kind of confused about frameworks on iOS. I think they are basically a directory containing a dynamic library, headers and resources.
But in my device the frameworks directories in System/Library/Frameworks don't contain the dynamic library. How is this possible? Shouldn't it be present to be loaded in memory when the application requiring it is launched?
The binaries no longer exist on-device (and have not since iOS 3.1): Apple has merged them all into one large mmap()'ed cache file, to make app launch a bit more efficient. As the pages usually never change, the kernel can effectively share them between every running image. You can still use dlopen() on files held within the cache, as dyld short-circuits file lookup when the given library exists in the cache.
The cache file is in /System/Library/Caches/com.apple.dyld, and is named after the architecture (armv6 or armv7). The libraries within can be extracted using dsc_extractor or KennyTM's dyld_decache, available in this repository, but once extracted they can't actually be loaded into memory properly (as they all effectively get their symbol tables merged in the cache.)
There's a bit of a better (though older and less informed, more in-depth) write-up here: http://blog.howett.net/2009/09/cache-or-check/.
I've noticed this, too. Strange. I can't explain to you "where they are", but I have observed, for example:
If I list out a (private) framework directory:
iPhone4:/System/Library/PrivateFrameworks/BluetoothManager.framework root# ls -alt
total 8
lrwxr-xr-x 1 root wheel 28 Nov 4 2011 CodeResources -> _CodeSignature/CodeResources
drwxr-xr-x 3 root wheel 170 Nov 2 2011 ./
drwxr-xr-x 2 root wheel 102 Nov 2 2011 _CodeSignature/
-rw-r--r-- 1 root wheel 740 Nov 2 2011 Info.plist
drwxr-xr-x 170 root wheel 5814 Dec 31 2007 ../
iPhone4:/System/Library/PrivateFrameworks/BluetoothManager.framework root# ls -alt _CodeSignature/
total 0
drwxr-xr-x 3 root wheel 170 Nov 2 2011 ../
drwxr-xr-x 2 root wheel 102 Nov 2 2011 ./
-rw-r--r-- 1 root wheel 1222 Nov 2 2011 CodeResources
You don't see a BluetoothManager.framework/BluetoothManager dylib file. However, this code does actually work to dynamically open that framework, as if that file exists:
handle = dlopen("/System/Library/PrivateFrameworks/BluetoothManager.framework/BluetoothManager", RTLD_LAZY);
Using the find command from the root filesystem ("/") location also finds no file on the device named BluetoothManager.
I know that's probably not the answer you're looking for, but depending on why you want to know, maybe it helps?
Related
I am trying to make a Mac app where the user can open a document file and use keys or menus to scroll through the next/previous files in the directory (as some image viewer apps do with images).
I was trying to do this by getting the folder URL for the current main document window, and getting the list of files in the folder in order. But it seems I can't get permission to do this. I run
fullPaths = try fileManager.contentsOfDirectory(at: folderURL, includingPropertiesForKeys: nil)
and I get the error:
The file “Journal DF” couldn’t be opened because you don’t have permission to view it.
"Journal DF" is a folder. I have read/write permissions on it.
I found an Apple developer thread that suggests this might have to do with sandboxing: although I'm getting the open document itself from an NSOpenPanel, I'm not getting the folder contents from that panel, so it doesn't want to give me permission. It looks like I could change a setting to turn off this sandboxing, which would mean the file couldn't go in the Mac App Store. This is an app mainly intended for my personal use, so I'll do that if I have to, but is there any more elegant way to access the contents of the open document's folder?
Here is the result of ls -lea#hO on a folder that gives the error:
total 8480
drwxr-xr-x# 26 Main staff - 832B Jul 3 11:28 .
com.dropbox.attributes 83B
drwxrwxrwx# 267 Main staff - 8.3K Aug 7 08:30 ..
com.apple.FinderInfo 32B
-rw-r--r--# 1 Main staff - 10K Jul 3 11:28 .DS_Store
com.apple.FinderInfo 32B
drwxr-xr-x 11 Main staff - 352B Jul 29 18:19 Current Skeletons
-rw-r--r--# 1 Main staff - 30K May 24 16:14 Foundation sources and opposition.xlsx
com.apple.FinderInfo 32B
com.apple.quarantine 30B
-rw-r--r--# 1 Main staff - 34K Apr 8 2018 Foundations Lucidchart 8-Apr-2018.pdf
com.apple.metadata:_kMDItemUserTags 42B
com.apple.metadata:kMDItemWhereFroms 1.2K
com.apple.quarantine 68B
-rw-------# 1 Main staff - 22K Feb 19 2018 Foundations Lucidchart.pdf
com.apple.metadata:_kMDItemUserTags 42B
com.apple.quarantine 32B
-rw-r--r--# 1 Main staff - 261K Feb 19 2018 Foundations Lucidchart.vdx
com.apple.metadata:_kMDItemUserTags 42B
com.apple.metadata:kMDItemWhereFroms 1.2K
com.apple.quarantine 68B
-rw-r--r--# 1 Main staff - 61K Feb 6 2016 Foundations Skeleton 5.tbx
com.dropbox.attributes 83B
-rw-r--r--# 1 Main staff - 151K Apr 28 2015 Journal Foundations A.md
com.apple.lastuseddate#PS 16B
com.apple.quarantine 21B
com.dropbox.attributes 83B
com.metaclassy.byword.selectedRange 10B
-rw-r--r--# 1 Main staff - 500K Apr 15 2016 Journal Foundations C (Dakini's conflicted copy 2016-04-15).md
com.dropbox.attributes 83B
-rw-r--r--# 1 Main staff - 528K Jun 5 2017 Journal Foundations C.md
com.apple.TextEncoding 15B
com.apple.lastuseddate#PS 16B
com.apple.quarantine 21B
com.dropbox.attributes 83B
com.metaclassy.byword.selectedRange 11B
-rw-r--r--# 1 Main staff - 736K Sep 25 2017 Journal Foundations D.md
com.apple.TextEncoding 15B
com.apple.lastuseddate#PS 16B
com.apple.quarantine 21B
com.dropbox.attributes 83B
com.metaclassy.byword.selectedRange 11B
drwxr-xr-x# 524 Main staff - 16K Nov 25 2017 Journal Foundations E
com.dropbox.attributes 83B
drwxr-xr-x# 765 Main staff - 24K Dec 10 2017 Journal Foundations F
com.dropbox.attributes 83B
drwxr-xr-x# 885 Main staff - 28K May 25 2018 Journal Foundations G
com.dropbox.attributes 83B
drwxr-xr-x# 682 Main staff - 21K Sep 8 2018 Journal Foundations H
com.dropbox.attributes 83B
drwxr-xr-x# 641 Main staff - 20K Jun 26 14:41 Journal Foundations I
com.dropbox.attributes 83B
-rw-r--r--# 1 Main staff - 528K May 28 2017 Journal Synthesis A.md
com.apple.TextEncoding 15B
com.apple.lastuseddate#PS 16B
com.apple.quarantine 21B
com.dropbox.attributes 83B
com.metaclassy.byword.selectedRange 10B
drwxr-xr-x 213 Main staff - 6.7K Apr 17 21:40 Old Skeletons
-rw-r--r--# 1 Main staff - 1.2M May 17 2017 Reflect alias
com.apple.FinderInfo 32B
com.dropbox.attributes 83B
-rw-r--r-- 1 Main staff - 16K Jun 24 2017 True Foundations 1Sk.mellel
-rw-r--r--# 1 Main staff - 19K Feb 6 2018 True Foundations 2Sk.mellel
com.apple.metadata:kMDLabel_od4iyi2dtvvg7c4mdb6hnpcupi 105B
-rw-r--r--# 1 Main staff - 13K Aug 27 2014 foundations.mellel
com.apple.lastuseddate#PS 16B
com.dropbox.attributes 83B
-rw-r--r--# 1 Main staff - 13K May 10 2017 old discussion from pipeline.mellel
com.dropbox.attributes 83B
-rw-r--r--# 1 Main staff - 46K May 14 2017 parameter zero.mellel
com.dropbox.attributes 83B
Vadian's comment was correct: it is indeed about sandboxing. I looked up the process for security-scoped bookmarks and it seems way more complicated than I want to deal with, given that this app is primarily for my personal use. So I went into the .entitlements file and changed App Sandbox from YES to NO, and now it works as it was supposed to. That's good enough for me. If other people are having this problem and need to use the App Store, well, here's the info on security-scoped bookmarks and I hope it works for you.
Fist, let's check if that Apple thread fits your situation or not.
Compile your app, once compiled, give it full disk access via:
System Preferences -> Security & Privacy,
by adding it to the Full Disk Access applications list. (You are eliminating the first layer of security and allowing your app to access your Documents folder, pictures folder, desktop folder, music folder, contact folder and another 3 or 4 protected folders.
Attempt 1) Run it and try to browser files with it on any folder inside your home dir. See if it works or not.
Attempt 2) Also is valid to test it to browse files on any usb stick (because they don't have permissions flags). See if it works on USB Sticks
If it still says you don't have permissions, post your results and more details about your system version, and if possible, a result from terminal of the command ls -lea#hO /path/to/folder of the folder where it is giving error, so we can check the Unix/ACL and sandbox permissions of that folder.
The postgres image I am currently deploying with openshift is generally working great. However I need to persistently store the database data (of course) and to do so i created a persistent volume claim and mounted it to the postgres data directory like so:
- mountPath: /var/lib/pgsql/data/userdata
name: db-storage-volume
and
- name: db-storage-volume
persistentVolumeClaim:
claimName: db-storage
The problem I am facing now is that the initdb script wants to change the permission of that data folder, but it cant and the directory is assigned to a very weird user/group, as the output of ls -la /var/lib/pgsql/data indicates (including the failing command output):
total 12
drwxrwxr-x. 3 postgres root 21 Aug 30 13:06 .
drwxrwx---. 3 postgres root 17 Apr 5 09:55 ..
drwxrwxrwx. 2 nobody nobody 12288 Jun 26 11:11 userdata
chmod: changing permissions of '/var/lib/pgsql/data/userdata': Permission denied
How can I handle this? I mean the permissions are enough to read/write but initdb (and the base images initialization functions) really want to change the permission of that folder.
Just as I had sent my question I had an idea and it turns out it worked:
Change the mount to the parent folder /var/lib/pgsql/data/
Modify my entry script to include a mkdir /var/lib/pgsql/data/userdata when it runs first (aka the folder does not exist yet)
Now it is:
total 16
drwxrwxrwx. 3 nobody nobody 12288 Aug 30 13:19 .
drwxrwx---. 3 postgres root 17 Apr 5 09:55 ..
drwxr-xr-x. 2 1001320000 nobody 4096 Aug 30 13:19 userdata
Which works. Notice that the folder itself is still owned by nobody:nobody and is 777, but the created userdata folder is owned by the correct user.
I'm running Postgres 9.4 installed on Ubuntu 16.04.3. Postgres was installed using apt-get, I downloaded the sources and dependencies with apt-get too. I downloaded pg_rewind REL9_4_STABLE branch and built it. When I try to run my pg_rewind command I get the following:
The servers diverged at WAL position 0/6148D50 on timeline 1.
Rewinding from Last common checkpoint at 0/5000098 on timeline 1
SQL command failed
CREATE OR REPLACE FUNCTION rewind_support.rewind_support_ls_dir(text, boolean) RETURNS SETOF text AS '$libdir/pg_rewind_support' LANGUAGE C STRICT;
ERROR: could not access file "$libdir/pg_rewind_support": No such file or directory
Failure, exiting
I found the pg_rewind_support.so library file and I placed it in the locations returned by pg_config --libdir and --pkglibdir with no success. I even created a copy without .so extension.
$ls -la $(pg_config --pkglibdir)/pg_rewind_support*
-rw-r--r-- 1 root root 18768 Jul 16 17:59 /usr/lib/postgresql/9.4/lib/pg_rewind_support
-rw-r--r-- 1 root root 18768 Jul 16 17:50 /usr/lib/postgresql/9.4/lib/pg_rewind_support.so
$ls -la $(pg_config --libdir)/pg_rewind_support*
-rw-r--r-- 1 root root 18768 Jul 16 17:59 /usr/lib/x86_64-linux-gnu/pg_rewind_support
-rw-r--r-- 1 root root 18768 Jul 16 17:44 /usr/lib/x86_64-linux-gnu/pg_rewind_support.so
Any ideas how can I make my apt-get installed Postgres recognize the pg_rewind library? I don't want to end up running in production a full postgres that was packaged and built in-house.
In working through this with the OP, the steps to build pg_rewind were:
Download the appropriate PostgreSQL 9.4.18 tarball, unpack.
Download pg_rewind, move into contrib/
Configure PostgreSQL to match the directory layout that Debian/Ubuntu uses:
./configure --libdir=/usr/lib/postgresql/9.4/lib --bindir=/usr/lib/postgresql/9.4/bin
Do a "make" on PostgreSQL.
Do a "make" and a "sudo make install" on pg_rewind.
pg_rewind must be installed on both the source system (so that the .so is available there) and on the target system (so the pg_rewind binary is available there).
I'm trying to setup MAMP pro 3 and I have a symbolic link from my Documents folder to /Application/MAMP/htdocs:
lrwxr-xr-x 1 msteudel admin 33 Jun 24 15:11 htdocs -> /Users/msteudel/Documents/wwwroot
In the options for my host I have FollowSymlink checked (I have tried all sorts of various combinations of options from all of them to just symlink):
Screenshot of settings
I'm still getting in my apache error log:
[Tue Jun 24 15:15:00 2014] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /Applications/MAMP/htdocs
And in the browser getting:
403 Forbidden
You don't have permission to access / on this server.
This all used to work when I was just using the free MAMP.
I tried changing the permissions of the symlink but that didn't work. The group is Admin whereas MAMP might be expecting Staff? I'm not sure that's a problem... I'm on a Mac in case someone missed that.
I also checked that all the folders were set to at least 755...
drwxr-xr-x 5 root admin 170 Oct 23 2013 Users
drwxr-xr-x+ 72 msteudel staff 2448 Jun 24 14:43 msteudel
drwxr-xr-x+ 87 msteudel staff 2958 Jun 23 14:22 Documents
drwxrwxrwx 69 msteudel staff 2346 Jun 23 11:18 wwwroot
I'm trying the use the Tanuki Java Service Wrapper.
The hardware I'm using is a Raspberry Pi with the Raspbian wheezy distribution.
(see http://www.raspberrypi.org/downloads)
I've tried the Wrapper 32-bit armel release, but get problems with reading the libwrapper.so.
INFO | jvm 1 | 2013/04/24 20:15:34 | WrapperManager: Initializing...
INFO | jvm 1 | 2013/04/24 20:15:42 | WrapperManager Debug: Attempt to load native library with name: libwrapper.so Result: /usr/iHome/lib/libwrapper.so: /usr/iHome/lib/libwrapper.so: cannot open shared object file: No such file or directory
I've also tried the armhf release, since it seems that "apt-get java-7-openjdk", installed the jdk-armhf version, but there I did get "Segmentation fault" when starting the Wrapper.
Some extra info:
pi#raspberrypi /usr/lib/jvm $ java -version
java version "1.7.0_07" OpenJDK Runtime Environment (IcedTea7 2.3.2)
(7u7-2.3.2a-1+rpi1)OpenJDK Zero VM (build 22.0-b10, mixed mode)
pi#raspberrypi /usr/lib/jvm $ ls -altr
total 28
-rw-r--r-- 1 root root 2437 Sep 26 2012 .java-1.7.0-openjdk-armhf.jinfo
lrwxrwxrwx 1 root root 20 Sep 26 2012 java-1.7.0-openjdk-armhf -> java-7-> openjdk-armhf
drwxr-xr-x 3 root root 4096 Jan 17 20:59 java-7-openjdk-common
drwxr-xr-x 5 root root 4096 Jan 17 21:00 java-7-openjdk-armhf
drwxr-xr-x 4 root root 4096 Jan 17 21:00 .
drwxr-xr-x 74 root root 12288 Apr 24 20:32 ..
pi#raspberrypi /usr/lib/jvm $ uname -a
Linux raspberrypi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l GNU/Linux
Thanks in advance,
BR, Rob
This issue has already been discussed on the Java Service Wrapper user mailing list in this thread, but here is the summary of the resolution.
The armhf version of the Wrapper is being built on an armv7 platform and apparently this is not compatible for armv6 hard float architectures. When using the armel version of the Wrapper with an armhf jvm then loading the native library fails due to the target mismatch.
The suggested solutions were to either use an armel jvm with the armel version of the Wrapper (since armv6 boards should support both) or to create the armhf binary for his board himself.
For the second suggestion, the pre-release (from the sourceforge project site of the Wrapper) package has to get downloaded, extracted and the following shell script executed:
./build32.sh release
With the created binary the Wrapper was able to launch successfully. (the build process requires a JDK and Apache-Ant installed)
Cheers,