diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bb9d596b3a..a67b830ac1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -145,6 +145,30 @@ Just do the same procedure to create a new, merged pill before committing the merge. Otherwise, just make sure to use the correct `urbit.pill` for each commit. +## Debug urbit with `gdb` + +Follow the build instructions in README.md but run `make` with argument `DEBUG=yes`: + +(If you've already built urbit first run `make clean`.) + + make DEBUG=yes + +Run `gdb`, while loading `bin/urbit` and its symbol table: + + gdb bin/urbit + +Set a breakpoint on `main()` (optional): + + break main + +Run your urbit comet `mycomet`: + + run mycomet + +Continue from the breakpoint on `main()`: + + continue + ## What to work on If you are not thinking of contributing with a specific goal in mind, diff --git a/Makefile b/Makefile index 7160cb2c2d..a4ed3c5029 100644 --- a/Makefile +++ b/Makefile @@ -70,10 +70,18 @@ endif INCLUDE=include MDEFINES=-DU3_OS_$(OS) -DU3_OS_ENDIAN_$(ENDIAN) -D U3_LIB=\"$(LIB)\" +DEBUG=no + +ifeq ($(DEBUG),yes) +DEBUGFLAGS=-g +else +DEBUGFLAGS=-O3 +endif + # NOTFORCHECKIN - restore -O3 # -DGHETTO \ # -DHUSH -CFLAGS= $(COSFLAGS) -O3 -ffast-math \ +CFLAGS= $(COSFLAGS) $(DEBUGFLAGS) -ffast-math \ -funsigned-char \ -I/usr/local/include \ -I/opt/local/include \ diff --git a/README.md b/README.md index 4f735d65cf..36e250904e 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,85 @@ -urbit +Urbit ===== -Urbit is a new computing environment designed from scratch. +Urbit is a clean-slate system software stack defined as a +deterministic computer. An encrypted P2P network, `%ames`, runs on a +functional operating system, Arvo, written in a strict, typed +functional language, Hoon, which compiles itself to a combinator +interpreter, Nock, whose spec gzips to 340 bytes. -At present urbit is under heavy development. It's not useful for any -external purpose. Documentation is completely inadequate. Anyone can use -the interpreter, of course, but the network is invitation-only. +What is this for? Most directly, Urbit is designed as a personal +cloud server for self-hosted web apps. It also uses HTTP APIs to +manage data stuck in traditional web applications. -If you're interested in keeping in touch or following the project you -can: +More broadly, Urbit's network tackles identity and security problems +which the Internet can't easily address. Programming for a +deterministic single-level store is also a different experience from +Unix programming, regardless of language. -- Enter your email address at [urbit.org](http://urbit.org). -- Subscribe to the +Getting involved +---------------- + +If you're interested in following Urbit, you can: + +- Read our documentation at [urbit.org](http://urbit.org/docs) +- Subscribe to our newsletter at [urbit.org](http://urbit.org). +- Check out the [urbit-dev](https://groups.google.com/forum/#!forum/urbit-dev) mailing list. - Follow [@urbit_](https://twitter.com/urbit\_) on Twitter. -- Get in touch with us via email, +- Hit us up by email, `urbit@urbit.org`. We're nice! -All of the source code is distributed under the MIT license. +Code of conduct +--------------- -Packages --------- +Everyone involved in the Urbit project needs to understand and +respect our code of conduct, which is: "don't be rude." -#### Ubuntu or Debian +Documentation +============= -Third-party package files are maintained at -https://github.com/yebyen/urbit-deb. Urbit is only supported on Jessie -onward. +In-progress documentation can be found at +[urbit.org/docs](http://urbit.org/docs). -#### OS X - Homebrew +These docs ship with your urbit. If you're running one locally you +can access them at + + http://localhost:8080/home/docs + +Assuming you're running on port 8080. The port is printed on startup. + +Install +======= + +Urbit can be installed on most Unix systems. There is no Windows +port. Windows is a wonderful OS, we just haven't gotten to it yet. +Use a VM. + +Install as a package +-------------------- + +### OS X - Homebrew brew install --HEAD homebrew/head-only/urbit -Dependencies ------------- +### Ubuntu or Debian + +Third-party packages are available, at: + + https://github.com/yebyen/urbit-deb + +Urbit is only supported on Jessie onward (but outbound HTTPS requests only work on Stretch; I wish we knew why; help us!) + +Hand-build from source +---------------------- + +First, install all external dependencies. Then, make. + +### Dependencies urbit depends on: - gcc + gcc (or clang) gmp libsigsegv openssl @@ -54,9 +96,6 @@ urbit depends on: sudo apt-get install libgmp3-dev libsigsegv-dev openssl libssl-dev libncurses5-dev git make exuberant-ctags automake autoconf libtool g++ ragel cmake re2c -*note: http requests are not supported on debian jessie due to an ssl -issue* - #### Fedora sudo dnf install gcc gcc-c++ git gmp-devel openssl-devel openssl ncurses-devel libsigsegv-devel ctags automake autoconf libtool ragel cmake re2c @@ -81,8 +120,7 @@ three packages, at least with Homebrew. Your mileage may vary. pkg install git gmake gmp libsigsegv openssl automake autoconf ragel cmake re2c libtool -Build ------ +### Download and make Clone the repo: @@ -92,144 +130,82 @@ Clone the repo: cd urbit -Just run `make`: +Run `make`: make (On FreeBSD, use `gmake` instead.) -Run (with a network invitation) -------------------------------- +The executable is `bin/urbit`. Install it somewhere, or just use it +where it is. -If you have a planet named `~fintud-macrep` and a ticket -`~fortyv-tombyt-tabsen-sonres`, run +Launch +====== - bin/urbit -w fintud-macrep -t fortyv-tombyt-tabsen-sonres +An urbit is a persistent server on the `%ames` P2P network. You'll +create one of these servers now. -Your pier (all Urbit state, log and checkpoint) will be in -`./fintud-macrep`. +If you have an invitation, it's a planet like `~fintud-macrep` and a +ticket like `~fortyv-tombyt-tabsen-sonres`. Run -To start Urbit again omit the `-w` and `-t` flags: + urbit -w fintud-macrep -t fortyv-tombyt-tabsen-sonres - bin/urbit fintud-macrep +(You can leave the `~` on, but it annoys some Unix shells.) -Run (without a network invitation) ----------------------------------- +If you don't have an invitation, pick a nickname for your comet, like +`mycomet`. Urbit will randomly generate a 128-bit plot: - bin/urbit -c mypier + urbit -c mycomet -Urbit will create a comet in `mypier`. +Either way, creating your urbit will take some time. Some of this +time involves creating keys; some of it involves downloading code +over Urbit itself. Go get a cup of coffee. Or a beer. -To start Urbit again omit the `-c` flag: +Wait until you see a prompt, something like - bin/urbit mypier + ~fintud-macrep:talk() -Basics ------- +or -`^v` will switch between the task manager and the focussed process. `^x` -will switch between processes. + ~fintud-macrep:dojo> -To start a process that is not yet started, run `*proc` from the task -manager. +Your urbit is launched! Ladies and gentlemen, we are floating in +space. -To connect your console to a process that has already been started, run -`+proc` from the task manager. Note that the process must be one that -supports console access, such as dojo and talk. +Docs +==== -`^d` will exit the pier from the task manager. No matter how you shut -your urbit down you'll be returned to exactly the same state as when you -turned it off. +Your urbit is your personal web server. The best place to read its +docs is by pointing your browser at it. -Talk ----- +Urbit prints the HTTP port it's serving when it starts up: -If you're on the network, you can use its most basic application, -`talk`. + http: live (insecure) on 8080 -If `talk` is not running, start it with `*talk` from the task manager. +8080 is the default. When it's not available we use 8081. Then 8082, and so on. If you're running on AWS or another cloud +service, this port may be firewalled; go to the firewall +configuration to open it. -Use `^x` to switch to the `talk` prompt and then run +(*Always run any urbit HTTP server which is even semi-serious inside a reliable, battle-proven frontline server like nginx.*) - ;join ~doznec/urbit-meta +Urbit's own official planet `~winsen-pagdel` is also bound to just +plain `urbit.org`, and hosts the public docs +[here](http://urbit.org/docs). (They are, of course, the same as +those that ship with your urbit.) -to join the `urbit-meta` channel. People in there are helpful. +Assuming your Urbit is on `localhost:8080`, your copy of the docs are at -There are three main `talk` commands: + http://localhost:8080/home/docs - ;join ~urbit-name/channel +To continue getting setup, start here: -`;join` subscribes your main feed to a remote channel. - - ; - -`;` activates a previous message number, like a URL that got -clipped. - - ; - -`;` sets the target for your messages, such as `;~urbit-name` -for a private message. - -Filesystem Sync ---------------- - -The Urbit filesystem, `%clay` doesn't automatically sync to unix. If -you'd like to browse the contents of your Urbit from unix you'll need to -use `|mount`. - -`|mount` creates a mirror in unix of files from `%clay` that is always -watching for changes. To sync your entire `home/` desk run: - - |mount % - -you should see a directory called `home/` get created inside your pier. -When you change files in this directory the changes will get synced into -your urbit. - -Since each mount point is always watching for changes you may also want -to unmount from time to time. - -The full syntax is as follows (from `dojo`): - - |mount [] - -The `` is optional and defaults to the last part of -the ``. - - |unmount - -or: - - |unmount - -Sysadmin --------- - -For the most part, updates to the system are automatically synced to -your urbit across the network. - -When we make updates to the interpreter you should be able to shut down -your urbit and: - - git pull origin master - make - bin/urbit pier - -where pier is the name of your pier. - -While the network is still young from time to time we reboot the entire -universe. We call this a 'continuity breach' since we're breaking the -continuity of our crypto. - -When this happens you'll need to back up your data and start a fresh -pier. Your original ticket will still work. + http://localhost:8080/home/docs/user/start Contributing ------------- +============ The first step in contributing to urbit is to come and join us on `:talk`. For more detailed instructions check out -[`contributing.md`](https://github.com/urbit/urbit/blob/master/CONTRIBUTING.md),. +[`contributing.md`](https://github.com/urbit/urbit/blob/master/CONTRIBUTING.md). \ No newline at end of file diff --git a/Spec/u3.md b/Spec/u3.md index ed03df0dc3..09fa140b0d 100644 --- a/Spec/u3.md +++ b/Spec/u3.md @@ -163,8 +163,8 @@ Regular symbols follow this pattern: u3w[a-g] jets (retain, nock core) i/j/w.h j/[a-g]/*.c Irregular symbols always start with `u3` and obey no other rules. -They're defined in `i/n/u.h`. Finally, `i/all.h` includes all -these headers (fast compilers, yay) and is all you need to +They're defined in `i/n/aliases.h`. Finally, `i/all.h` includes +all these headers (fast compilers, yay) and is all you need to program in `u3`. ### u3: noun internals @@ -175,10 +175,10 @@ If your `u3_noun` is less than `(1 << 31)`, it's a direct atom. Every unsigned integer between `0` and `0x7fffffff` inclusive is its own noun. -If bit `31` is set in a `u3_noun`, bit `30` is always set - this -bit is reserved. Bit `29` is `1` if the noun is a cell, `0` if -it's an atom. Bits `28` through `0` are a word pointer into the -loom - see below. The structures are: +If bit `31` is set in a `u3_noun` and bit `30` is `1` the noun +is an indirect cell. If bit `31` is set and bit `30` is `0` the +noun is an indirect atom. Bits `29` through `0` are a word +pointer into the loom - see below. The structures are: typedef struct { c3_w mug_w; @@ -400,9 +400,10 @@ A "south" road is the other way around: Legend: `-` is durable storage (heap); `+` is temporary storage (stack); `~` is deep storage (immutable); `$` is the allocation -frame `#` is free memory. +frame; `#` is free memory. Pointer restrictions: pointers stored in `+` can point anywhere. +Of course, pointing to `#` (free memory) would be a bug. Pointers in `-` can only point to `-` or `~`; pointers in `~` only point to `~`. diff --git a/include/vere/vere.h b/include/vere/vere.h index 0160640a95..1326d901d9 100644 --- a/include/vere/vere.h +++ b/include/vere/vere.h @@ -819,7 +819,7 @@ void u3_term_ef_bake(u3_noun fav); - /* u3_term_ef_blit(): send %blit effect to to terminal. + /* u3_term_ef_blit(): send %blit effect to terminal. */ void u3_term_ef_blit(c3_l tid_l, @@ -950,7 +950,7 @@ void u3_unix_ef_ogre(u3_noun mon); - /* u3_unix_ef_ogre(): delete mount point + /* u3_unix_ef_hill(): enumerate mount points */ void u3_unix_ef_hill(u3_noun hil); diff --git a/noun/vortex.c b/noun/vortex.c index 8f99608959..7b4851d01a 100644 --- a/noun/vortex.c +++ b/noun/vortex.c @@ -105,7 +105,14 @@ u3v_wish(const c3_c* str_c) // It's probably not a good idea to use u3v_wish() // outside the top level... // - return _cv_nock_wish(u3i_string(str_c)); + u3_noun txt = u3i_string(str_c); + u3_noun exp = u3kdb_get(u3A->yot, u3k(txt)); + + if ( u3_none != exp ) { + u3z(txt); + return exp; + } + else return _cv_nock_wish(u3i_string(str_c)); } } diff --git a/vere/http.c b/vere/http.c index 9adcede813..64155fda44 100644 --- a/vere/http.c +++ b/vere/http.c @@ -1054,9 +1054,11 @@ _http_start(u3_http* htp_u) uL(fprintf(uH, "http: listen: %s\n", uv_strerror(ret))); } } +#if 0 uL(fprintf(uH, "http: live (%s) on %d\n", (c3y == htp_u->sec) ? "\"secure\"" : "insecure", htp_u->por_w)); +#endif break; } } diff --git a/vere/main.c b/vere/main.c index f167ffc85e..3756c27a4b 100644 --- a/vere/main.c +++ b/vere/main.c @@ -225,7 +225,8 @@ u3_ve_usage(c3_i argc, c3_c** argv) "-f Fuzz testing\n", "-k stage Start at Hoon kernel version stage\n", "-Xwtf Skip last event\n"}; - for ( c3_i i=0; i < sizeof(use_c)/sizeof(c3_c*); i++ ) { + c3_i i; + for ( i=0; i < sizeof(use_c)/sizeof(c3_c*); i++ ) { fprintf(stderr,use_c[i],argv[0]); } exit(1); @@ -341,11 +342,16 @@ main(c3_i argc, if ( c3y == u3_Host.ops_u.nuu ) { struct stat s; if ( !stat(u3_Host.dir_c, &s) ) { - fprintf(stderr, "used -c but %s already exists\n", u3_Host.dir_c); + fprintf(stderr, "tried to create, but %s already exists\n", u3_Host.dir_c); exit(1); } - } - + } +#if 0 + if ( 0 == getuid() ) { + chroot(u3_Host.dir_c); + u3_Host.dir_c = "/"; + } +#endif u3_ve_sysopt(); printf("~\n"); diff --git a/vere/term.c b/vere/term.c index c22c8956fd..750ffc3a34 100644 --- a/vere/term.c +++ b/vere/term.c @@ -355,7 +355,9 @@ u3_term_io_talk(void) uL(fprintf(uH, "term: listen: %s\n", uv_strerror(ret_w))); } } +#if 0 uL(fprintf(uH, "term: live (but unsupported) on %d\n", tel_u->por_s)); +#endif break; } }