On 16 Jan 2018, at 2:25pm, Richard Hipp <d...@sqlite.org> wrote:

> On 1/16/18, Paul Sanderson <sandersonforens...@gmail.com> wrote:
> 
>> That terminal app is still sandboxed. AFAIAA you essentially get access to
>> the applictaios data folder and you can add, create, delete, etc files
>> within it.
> 
> Right.  And so it is apparently not possible to compile a command-line
> application (like "sqlite3" or "kvtest"), download that application to
> the phone, then run it from the terminal app.  If I am underestimating
> the capabilities of the terminal app, please correct me.

There is no 'Terminal' App.  None are supplied.  There’s no command-line access 
to Unix.  You cannot let the user run arbitrary programs like 'ps' because the 
user has no access to any command-line shells like 'sh'.

The following is slightly simplified for clarity, and includes stuff Dr H knows 
so it is useful for other readers of this list.  Where I write 'phone', I mean 
iPhones and iPads.

Installing Apps under iOS
-------------------------

If you’re registered as an Apple Developer, and.installing Apps on phones 
belonging to your own organisation, you can install your own Apps on those 
phones, using Apple’s software on your Mac.  If you do not qualify for the 
above, you can install Apps on the phone only by downloading them from Apple’s 
App Store.  You could go to a web site and download an App, but there’s no way 
to tell the phone to run it.

Apps submitted to Apple for the App Store are supplied as a source code package 
suitable for compiling with Xcode (not quite, but you get the idea).  Apple 
scans the source code, checking to see which Unix calls they make, rejecting 
those which do things Apple doesn’t like, like trying to access the kernel or 
hardware directly.  Apps which do make it to the Store are compiled then 
'signed' with a checksum using Apple’s process.  If iOS tries to start up an 
App which fails its checksum it’ll issue an error message saying it’s corrupt.

Apps running under iOS
----------------------

Apps running under iOS think they have access to the full unix folder tree.  
But in reality they have access only to folders in their own sandbox, plus 
special read-only access to some commonly-used unix files.  Attempts to use 
standard unix calls to look around the drive/folder/file structure, to find 
other Apps and their data files, see only the current App’s sandbox.

Similar things are done with other Unix internals.  'kill', and its underlying 
Unix call, have no effect on processes which don’t belong to the App that calls 
'kill'.  I believe the last time I read anything about it, you could list other 
processes, you just couldn’t do anything to them.  You can’t use 'nice' to 
starve other processes of CPU time.  Stuff like that.

iOS supplies an API for moving files into and out of a common area, viewable in 
the GUI using an Apple App called "Files".  A special API must be used to 
access this area.  Each App can use that API to access the common area, list 
its contents, and copy to and from it.  An App has no way to find the shared 
area using normal drive/folder/file calls.  For two Apps to share a data file, 
one App would have to copy it into the common area and the other would have to 
copy it back out.

What would a 'Terminal' App do ?
--------------------------------

So suppose you took a copy of 'bash', added a 25-line 80-column user-interface 
to it, and made an App out of it.  What would happen ?  The answer is that it 
would apparently work fine but be subject to the above restrictions.  
Operations to iterate through drives would fail.  Attempts to read the folder 
structure of the default drive would reveal only the folder structure of the 
sandbox.  Unix utility calls which interfere with other Apps/processes would 
return error messages.

So you might create a 'Terminal'-style application, and include in its 
application Bundle a copy of sqlite3 compiled for iOS.  The only database files 
it could access would be ones stores in the sandbox of your 'Terminal' App.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to