Code Monkey home page Code Monkey logo

ios_system's People

Contributors

cclauss avatar coldgrub1384 avatar harwood avatar holzschu avatar ian-mcdowell avatar louisdh avatar n-holzschuch avatar palmin avatar pducks32 avatar so898 avatar yury avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ios_system's Issues

ios_system should return non-zero exit code on "command not found"

When passing a gibberish string to ios_system, it prints "command not found" to stderr, but returns 0, meaning it was successful. This does not match what other shells do when commands are not found.

I tested Bash and Fish to see what they do, and they both return 127 when no command is found.

whois command

I found this command useful.

I tried to port it myself this time.

This command is in adv_cmds, don't find it framework.
so, I test it with in files.framework

And I don't get how to create patch file.
So this is my whois.c file
I hope it helps.

using openTerm on my iPad

Hi !

I am not able to go around that ‘permission denied’ 👎

Could you give me a hand ?

Thanks for your job !
Regards, François

iPad de François: ls
iPad de François: cd /
cd: /: permission denied

iPad de François: date
Sat Jan 20 13:33:01 CET 2018

iPad de François: ?
awk, cat, cd, chflags, chksum, clear, compress, cp, curl, date, du, echo, egrep, env, fgrep, grep, gunzip, gzip, help, link, ln, ls, mkdir, mv, printenv, pwd, readlink, rm, rmdir, scp, sed, setenv, sftp, stat, sum, tar, touch, tr, uname, uncompress, unsetenv, uptime, wc, whoami

iPad de François: cd ..
cd: ..: permission denied

iPad de François: login
login: command not found

iPad de François: man ls
man: command not found

iPad de François: uname
Darwin

iPad de François: whoami
mobile

iPad de François: cd /var
cd: /var: permission denied

iPad de François: cd /var/mobile
cd: /var/mobile: permission denied

iPad de François: cd /var/mobile/Containers
cd: /var/mobile/Containers: permission denied

iPad de François: cd /var/mobile/Containers/Data
cd: /var/mobile/Containers/Data: permission denied

iPad de François: cd /var/mobile/Containers/Data/Application
cd: /var/mobile/Containers/Data/Application: permission denied

iPad de François:

feature request for thread context.

I want to port all blink commands to ios_system commands.

Simple commands like help, config are ok. But some commands, like ssh, mosh need some sort of thread state.

I'm thinking about ios_setContext(void * thread_context) same as ios_setStreams. So it would be possible to grab that context inside the commands.

Does it make sense? If idea is acceptable, I can do PR for that.

request for md5

I found this command in text_cmds, but did get how to port common crypto part.

Update downloaded directories in the .gitignore

Unless I'm doing things wrong here, after checking out the project at master, and running:

  • get_sources.sh
  • get_frameworks.sh
  • Xcode build

I get a bunch of untracked files in git:

  • ios_system.xcodeproj/xcuserdata/<username>.xcuserdatad
  • Frameworks/*.framework
  • curl/*
  • file_cmds/*
  • libarchive/*
  • libinfo/*
  • libutil/*
  • shell_cmds/*
  • text_cmds/*

I would recommend updating the .gitignore file in the repo to ignore these directories.

ssh_main returns without printing if no ssh key is found

I've stepped through the ssh_main method to see why nothing is happening when I run ssh Ian@<ip> pwd.

I have no SSH keys on my device, and no .ssh folder.

After checking the userauthlist, rc = 0. It searches through my ~/Documents folder in a while loop, and rc is still 0. On line 537, it checks whether rc is greater than or equal to zero, and returns if so, without printing any error code.

P.S. "Authentification" is not a word, "Authentication" is.

awk crash

It works ok on:

echo "welcome" | awk '{ print substr( $0, 0, 4 ) }'
welc

But crashes on:

echo "welcome" | awk '{ print substr( $0, length($0) - 3, length($0) ) }'

Way to pthread_kill to main thread

Hi @holzschu,

I need to send SIGWINCH to main command thread. I tried following code (called on main thread):

pthread_t tid = ios_getLastThreadId(); // result is always 0
pthread_kill(tid, SIGWINCH);

But ios_getLastThreadId() always return 0.

I'm thinking to add ios_pthread_kill to send signals to similar to ios_kill but with pthread_kill instead of pthread_cancel. Or I missing something and there is a better way to do that?

Thank you for any help.

multiple mini roots

Hi,

Originals of this request:

I wanted to link iCloud Drive/Documents to ~/Documents/iCloud. My first try was with hard links, but turns out iCloud do not refresh live in that case. Soft link is worked, but if I cd ~/iCloud I got permission denied if I set miniroot to app/Documents.

Proposal:

Add ios_setMiniRoots(NSArray<NSString *> *paths) and use collection of paths to check.

Changing miniroot is not very good option.

So, if you don't mind, I can create PR with that.

Break up into separate dylibs

I'd suggest building each command as a dynamic library (either .dylib or .framework), and lazy loading them at runtime.

As noted in the README, all the code for all of the commands is loaded into memory at app launch. This seems wasteful & unnecessary, and probably won't scale too well when adding more commands over time.

Additionally, it looks like they are currently being built into a single Xcode target. It'd be great if each command was its own target, with defined inputs/outputs (i.e. build these source files into this dylib). That way it's easier to pick & choose, and scales better.

Request for bc

bc is a very useful calculator app, the most recent version has the gnu license.
There is also a Lucent (Plan 9) version.

Scan dynamic libraries for functions without opening them

Currently, all functions are loaded at startup time in an NSDictionary, or later added to the dictionary using replaceCommand. In order to be executed a function must be both:

  • in this dictionary,
  • in a dynamic library, that is signed and embedded in the application.

It would be good to also scan unknown embedded libraries for functions that can be used. This must be done without dlopen-ing the library, as it would defeat the purpose (dlclose does not always release the dynamic library).

Something like: nm unknown.dylib | grep _main$ should extract the name of the functions, if it works on a signed library (and if I can find the source of nm).

Honor ">>" in command lines, to append result to existing files

Currently, command line parsing in ios_system.m works with ">", "&>" and "2>&1", all of which erase and open the output file. It would be useful to have ">>" as well, to append to an existing file. Especially with "echo", which can put a marker in the file.

Work with pipelining (`| command`)

Currently, we can output the result of a command into a file: ls -lhrt > listing. It would be useful to also have the ability to pipe commands: ls -R | grep .dylib.

Most of the work is here (inside the commands themselves). What needs to be done:

  • parse the "|", "&|"
  • setup channels for communication between commands
  • start the multiple commands in separate threads, all non-blocking
  • wait for all threads to finish
  • make sure the process is non-blocking.

Support for UTF-8 encoding

OpenTerm passes UTF-8 commands to ios_system, and expects UTF-8 output from commands. However, argument parsing & command parsing converts the string to ASCII, which causes data loss.

Try: echo 😀 in OpenTerm to see results.

Need to chose a license for ios_system (and the rest)

I just realized I did not pick a license for the common parts of ios_system. The utilities themselves (mkdir, ls, pwd...) are covered by their original license (Free BSD, mostly). But the "glue" code (ios_system.m and the other files) is currently not covered, which is a very bad idea.

I'm open to suggestions. I'm leaning towards a revised-BSD license (3 clause BSD license).

Those of you who contributed to the code: @yury, @louisdh, @IMcD23, @palmin, @pducks32 : any opinion about the type of license?

Minimalist `ssh` command

A full ssh command is impossible without interactivity (and Blink does it perfectly well already). But a minimalist ssh that launches a command on the remote site and disconnects (ssh user@host ls -lhrt) would be useful in several cases (including inside iVim).

Single tilde ("~") command crashes

Executing the command ~ crashes at line 760 in ios_system.m.

for (int i = 0; i < argc; i++) free(argv_ref[i]);

Fwiw, any amount of tildes crashes (e.g. ~~~).

New release?

Hello. Do you plan to release a new version? I use pre-built frameworks.

Add ssh-keygen

Not sure which OpenSSH we are using, but it'd be great if we could get the ssh-keygen utility to generate SSH keys.

Source

Make ios_system thread-safe

As requested by @yury and @IMcD23 : ios_system() should be made thread-safe, allowing people to launch commands in multiple tabs.

This is not trivial, since making current_command_root_thread a thread-local variable results in it not being set in most threads, and ios_kill() having no thread ID available to kill.

Ideally, I'd like an implementation that is compatible with current applications.

Making ios_system itself thread-safe will leave the issue of some commands being not thread-safe themselves (2 "python" in separate tabs will almost certainly not work).

Can't compile current iVim

I'm having trouble compiling the latest master version of iVim
I'm doing the same steps that worked before. The compilation ends with the error message

CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
    cd /Users/goerz/Documents/Programming/iVim/iVim
    export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name iVim -Onone -enforce-exclusivity=checked -DDEBUG -sdk [...]

<unknown>:0: error: no such file or directory: '/Users/goerz/Documents/Programming/iVim/iVim/URLRealizer.swift'
<unknown>:0: error: no such file or directory: '/Users/goerz/Documents/Programming/iVim/iVim/ArgumentToken.swift'
<unknown>:0: error: no such file or directory: '/Users/goerz/Documents/Programming/iVim/iVim/URLOpener.swift'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

The swift files it complains about are actually in /Users/goerz/Documents/Programming/iVim/iVim/iVim (an extra iVim). I've tried copying the entire content of that directory up one level, to the path where Xcode seems to be asking for.

This gets me further in the compilation, but then the linker fails with

ld: illegal data reference in _Py_NoSiteFlag to thread local variable _Py_NoSiteFlag in dylib /Users/goerz/Documents/Programming/iVim/iVim/Frameworks/Python_ios.framework/Python_ios for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any ideas?

Decrease iOS Deployment Target

The deployment targets of new dylibs that were added are iOS 11.3, which is higher than OpenTerm's. There is no need for them to be so high, and it's causing warnings.

Return proper exit codes from commands

It seems that most everything currently returns 0, even when things fail. The following should be happening:

When a command calls exit(status_code), or its main method returns, store exit code, then call pthread_exit, and return exit code.

ls looses colors

Something in ls command is not thread safe.
After some time ls -la output plane text instead of colored. Still can't track it down.

'libssh2.h' file not found

I check out the most recent release and try to build the curl_ios_static. But it failed on this. Any ideas why?
I did the get_source.sh and get_frameworks.sh.
Thank you.

ls ~/tmp causes crash

This is with a build of your fork of iVIm.

running
:!ls ~/tmp

displays the directory contents, then crashes the app after hitting return.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.