This is the second post in a series about the interface description language Candid.
service A1 :
get_value : (variant current; previous : nat )
-> (record value : int; last_change : nat )
to
service A2 :
get_value : (variant current; previous : nat; default )
-> (record value : int; last_change : nat; committed : bool )
is fine: It doesn t matter that clients that still use the old interface don t know about the new constructor of the argument variant. And the extra field in the result record will silently be ignored by old clients.
In the Candid spec, this relation is written as A2 <: A1 (note the order!), and the formal footing this builds on is subtyping. We thus say that it is safe to upgrade a service to a subtype , and that A2 s interface is a subtype of A1 s.
In small examples, I often use nat and int, because every nat is also a int, but some int values are not not nat values, namely the negative ones. We say nat is a subtype of int, nat <: int. So a function that in the first returns a int can in the new version return a nat without breaking old clients. But the other direction doesn t work: If the old version s method had a return type of nat, then changing that to int would be a breaking change, as old clients would not be prepared to handle negative numbers.
Note that arguments of function types follow different rules. In fact, the rules are simply turned around, and in argument position (also called negative position ), we can evolve the interface to accept supertypes. Concretely, a function that originally expected an nat can be changed to expect an int, but the other direction doesn t work, because there might still be old clients around that send negative numbers. This reversing-of-the-rules is called contravariance.
The vision is that the developer s tooling will warn the developer before they upgrade the code of a running service to a type that is not a subtype of the old interface.
Let me stress, though, that all this is about not breaking existing clients that use the old interface. It does not mean that a client developer who fetches the new interface for your service won t have to change their code to make his programs compile again.
service B : add_listener : (text, func (int) -> ()) -> ()
says that the service with interface B has a method called add_listener which takes two arguments, a plain value of type text and a reference to a function that itself expects a int-typed argument.
The contravariance of the subtyping rules explained above also applies to the types of these function reference. And because the int in the above type is on the left of two function arrows, the subtyping rule direction flips twice, and it is therefore safe to upgrade the service to accept the following interface:
service B : add_listener : (text, func (nat) -> ()) -> ()
vec was more work than it s worth it, and I defensively blame Coq s not-so-great support for nested recursion.
The soundness relies on subtyping, and that is all fine and well as long as we stick to canonical rules. Unfortunately, practical considerations force us to deviate from these a bit, as we see in the next post of this series.
One of the technologies that was created by DFINITY as we built the Internet Computer is Candid. Candid is
service A :
add : (int) -> ();
get : () -> (int);
clearly communicates that a service called A provides two methods add and get, that add takes an integer as an argument, and that get returns such a number. Of course, this only captures the outer shape of the service, but not what it actually does we might assume it implements a counter of sorts, but that is not part of the Candid interface description.
In order to now use the service, we also need a (low-level) transport mechanism. Candid itself does not specify that, but merely assumes that it exists, and is able to transport the name of the invoked method and a raw sequence of bytes to the service, and a response (again a raw sequence of bytes) back.
Already on the Internet Computer we have two distinct transport mechanisms used are external calls via an HTTP-based RPC interface and on-chain inter-canister calls. Both are handled by the service in the same way. Here we can see that Candid succeeds in abstracting over differences in the low-level transport mechanism. Because of this abstraction, it is possible to use Candid over other transportation mechanisms as well (conventional HTTPS, E-Mail, avian carrier). I think Candid has potential there as well, so even if you are not interested in the Internet Computer, this post may be interesting to you.
The translation of argument and result values (e.g. numbers of type int) to the raw sequence of bytes is specified by Candid, defining a wire format. For example, the type int denotes whole numbers of arbitrary size, and they are encoded using the LEB128 scheme. The Candid wire format also contains a magic number (DIDL, which is 0x4449444c in hex) and a type description (more on that later). So when passing the value 2342 to the add, the raw bytes transported will be 0x4449444c00017da612.
Of course we want to transfer more data than just integers, and thus Candid supports a fairly complete set of common basic types (nat, int, nat8, nat16, nat32, nat64, int8, int16, int32, int64, float32, float64, bool, text, blob) and composite types (vectors, optional values , records and variants). The design goal is to provide a canonical set of types enough to express most data that you might want to pass, but no more than needed, so that different host languages can support these types easily.
The Candid type system is structural. This means that two types are the same when they are defined the same way. Imagine two different services defining the same
type User = record name : text; user_id : nat
then although User is defined in two places, it s still the same type. In other words, these name type definitions are always just simple aliases, and what matters is their right-hand side.
Because Candid types can be recursive (e.g. type Peano = opt Peano), this means we have an equirecursive type system, which makes some things relatively hard.
So far, nothing too special about Candid compared to other interface definition languages (although a structural equirecursive type system is already something). In the next post we look at reference types, and how such higher order features make Candid an interesting technology.
A song for Debconf21 ["What shall we do with the drunken sailor"]
What shall we do with the online Debconf?What shall we do with the online Debconf?What shall we do with the online Debconf?
Earl-y in the morning
Close it up as we agreed it
Save each script in case we need it
Work out how we best live-feed itNext year s Debconf s dawning
Next year s Kosovo and Pristina
This virtual Debconf needs no cleaner
Hope when COVID s gone we re keener
To meet up every morning
Thanks to the Debconf orga team
Thanks to those who Loopy meme
Things are not always as they seeem
In virtual Debconf s morning
Bullseye s out its share is rising
Debconf s fun and quite surprising
Linux 30 :)
Yours and my thing - Debian s 28
Thanks to all who video d sessions
Debconf T-shirts - prized possessions
Debcamp bug-fixed some regressions
Now onto next year!
A closing song for Debconf 21 [Frere Jacques/Brueder Martin]
DebConf21
Virtual DebConf s
Now all through
Closed for you
Kosovo is next year
See you in Pristina!!
DebConf 22
Twenty twenty-two
The Debian Janitor is an automated system that commits fixes for (minor) issues in Debian packages that can be fixed by software. It gradually started proposing merges in early December. The first set of changes sent out ran lintian-brush on sid packages maintained in Git. This post is part of a series about the progress of the Janitor. Linux distributions like Debian fulfill an important function in the FOSS ecosystem - they are system integrators that take existing free and open source software projects and adapt them where necessary to work well together. They also make it possible for users to install more software in an easy and consistent way and with some degree of quality control and review. One of the consequences of this model is that the distribution package often lags behind upstream releases. This is especially true for distributions that have tighter integration and standardization (such as Debian), and often new upstream code is only imported irregularly because it is a manual process - both updating the package, but also making sure that it still works together well with the rest of the system. The process of importing a new upstream used to be (well, back when I started working on Debian packages) fairly manual and something like this:
1 2 | version=4
http://somesite.com/dir/filenamewithversion.tar.gz
|
1 2 3 | ---
Repository: https://www.dulwich.io/code/dulwich/
Repository-Browse: https://www.dulwich.io/code/dulwich/
|
The vcswatch service that regularly
polls packaging repositories to see whether they have changed makes it a lot
easier to consume this information in usable way.
That means about 2300 packages updated, and about 4000 unchanged.
Or 5100 packages updated and 2100 for which there was nothing to do, i.e. no upstream commits since the last Debian upload.
As can be seen, this works for a surprising fraction of packages. It s possible to get the numbers up even higher, by both improving the tooling, the autopkgtests and the metadata that is provided by packages.
1 2 3 4 5 6 | echo deb "[arch=amd64 signed-by=/usr/share/keyrings/debian-janitor-archive-keyring.gpg]" \
https://janitor.debian.net/ fresh-snapshots main sudo tee /etc/apt/sources.list.d/fresh-snapshots.list
echo deb "[arch=amd64 signed-by=/usr/share/keyrings/debian-janitor-archive-keyring.gpg]" \
https://janitor.debian.net/ fresh-releases main sudo tee /etc/apt/sources.list.d/fresh-releases.list
sudo curl -o /usr/share/keyrings/debian-janitor-archive-keyring.gpg https://janitor.debian.net/pgp_keys
apt update
|
1 | apt install -t fresh-snapshots r-cran-roxygen2
|
| [1] | I m not saying that a monoculture is great here, but it does help distributions. |

tools.deps.alpha, a library for dependency graph
resolution and classpath building, and the CLI tool clj, for REPL
interaction. If time permitted, I was also to improve the quality of
both new and existing Clojure packages, and the overall Debian Clojure
packaging process. My mentor was Louis-Louis-Philippe V ronneau, and my
co-mentor was Utkarsh Gupta.clojure-debian-helper). The second reason for which we only
currently have a suboptimal Clojure experience in Debian, and probably
the root of the previous one, is that many core build tools and
libraries for the language have not simply been packaged yet. My project
aimed to attack that seemingly root cause.As I said, another reason for me choosing this project is my own
experience as the Co-founder and Leader of, probably, the first Free
Software Community experience in my hometown of San Juan, Argentina.
That interest in Free Software evolved in a first PhD attempt in what is
now known as the field of Peer Production. A subject that has lived
within me as a research interest during my day job at a University.Being a Clojure fan, it felt only logical combining all those interests
somehow. And this project seemed like the ideal combination.clojure-cli.clojure-cli.clojure to use clojure-cli.clojure-cli scripts.private field in the API and Self-Service section in requesting tests to adding an option to publish them when ready through both interfaces.
Merge Requests:
Rspec for writing tests in ruby and understood how writing tests is an integral part of coding any project.
The third release of RcppFastFloat arrived on CRAN. The package wraps fastfloat, another nice library by Daniel Lemire. For details, see the recent arXiv paper showing that one can convert character representations of numbers into floating point at rates at or exceeding one gigabyte per second.
This release deals with a header include on everybody s favourite CRAN platform bringing the result status to a clean suite of all OKs.
Courtesy of my CRANberries, there is also a diffstat report for this release. If you like this or other open-source work I do, you can now sponsor me at GitHub.Changes in version 0.0.3 (2021-08-21)
- Account for SunOS with an additional
#define- Minor update to
DESCRIPTION
This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.
181. This version includes the following changes:
[ Chris Lamb ]
* New features and bug fixes:
- Don't require apksigner in order to compare .apk files using apktool.
- Add a special-case to squshfs image extraction to not fail if we aren't
root/superuser. (Closes: #991059)
- Reduce the maximum line length to avoid O(n^2) Wagner-Fischer algorithm,
which meant that diff generation took an inordinate amount of time.
(Closes: reproducible-builds/diffoscope#272)
- Include profiling information in --debug output if --profile is not set.
- Don't print an orphan newline when the Black source code formatter
self-test passes.
* Tests:
- Update test to check specific contents of squashfs listing, otherwise it
fails depending on the test systems uid-to-username mapping in passwd(5).
- Assign "seen" and "expected" values to local variables to improve
contextual information in/around failed tests.
* Misc changes:
- Print the size of generated HTML, text (etc.) reports.
- Profile calls to specialize and diffoscope.diff.linediff.
- Update various copyright years.
YNAB
On the advice of many friends, I tried to use You Need A
Budget. I gave it a seriously long, proper
evaluation: over a year. But I just couldn't get it to work for me. I don't
want to try and explain why. To be honest, those same friends who advocated for
it fairly strongly, also gave me a pretty hard time for giving up on it!
Despite it not clicking for me, there are a few concepts from YNAB that I quite
like:
hledger.
| Publisher: | Tordotcom |
| Copyright: | 2021 |
| ISBN: | 1-250-30112-2 |
| Format: | Kindle |
| Pages: | 151 |
I'm awfully lucky when you think about it. Garbagetown is the most wonderful place anybody has ever lived in the history of the world, even if you count the Pyramids and New York City and Camelot. I have Grape Crush and Big Bargains and my hibiscus flower, and I can fish like I've got bait for a heart so I hardly ever go hungry, and once I found a ruby ring and a New Mexico license plate inside a bluefin tuna. Everyone says they only hate me because I annihilated hope and butchered our future, but I know better, and anyway, it's a lie. Some people are just born to be despised. The Loathing of Tetley began small and grew bigger and bigger, like the Thames, until it swallowed me whole.Garbagetown is a giant floating pile of garbage in the middle of the ocean, and it is, so far as anyone knows, the only "land" left in the world. Global warming has flooded everything until the remaining Fuckwits (as their future descendants call everyone who was alive at the time) took to the Misery Boats and searched hopelessly for land. Eventually they realized they could live on top of the now-massive Pacific Garbage Patch and began the Great Sorting, which is fifty years into Tetley's past. All of the types of garbage were moved into their own areas, allowing small micronations of scavengers to form and giving each area its own character.
Candle Hole is the most beautiful place in Garbagetown, which is the most beautiful place in the world. All of the stubs of candles the Fuckwits threw out piled up into hills and mountains and caverns and dells, votive candles and taper candles and tea lights and birthday candles and big fat colorful pillar candles, stacked and somewhat melted into a great crumbling gorgeous warren of wicks and wax. All the houses are cozy little honeycombs melted into hillside, with smooth round windows and low golden ceilings. At night, from far away, Candle Hole looks like a firefly palace. When the wind blows, it smells like cinnamon, and freesia, and cranberries, and lavender, and Fresh Linen Scent, and New Car Smell.Two things should be obvious from this introduction. First, do not read this book looking for an accurate, technical projection of our environmental future. Or, for that matter, physical realism of any kind. That's not the book that Valente is writing and you'll just frustrate yourself. This is science fiction as concretized metaphor rather than prediction or scientific exploration. We Fuckwits have drowned the world with our greed and left our descendants living in piles of our garbage; you have to suspend disbelief and go with the premise. The second thing is that either you will like Tetley's storytelling style or you will not like this book. I find Valente very hit-and-miss, but this time it worked for me. The language is a bit less over-the-top than Space Opera, and it fits Tetley's insistent, aggressive optimism so well that it carries much of the weight of characterization. Mileage will definitely vary; this is probably a love-it-or-hate-it book. The Past is Red is divided into two parts. The first part is the short story "The Future is Blue," previously published in Clarkesworld and in Valente's short story collection of the same name. It tells the story of Tetley's early life, how she got her name, and how she became the most hated person in Garbagetown. The second part is much longer and features an older, quieter, more thoughtful, and somewhat more cynical Tetley, more life philosophy, and a bit of more-traditional puzzle science fiction. It lacks some of the bubbly energy of "The Future is Blue" but also features less violence and abuse. The overall work is a long novella or very short novel. This book has a lot of feelings about the environment, capitalism, greed, and the desire to let other people solve your problems for you, and it is not subtle about any of them. It's satisfying in the way that a good rant is satisfying, not in the way that a coherent political strategy is satisfying. What saves it from being too didactic or self-righteous is Tetley, who is happy to record her own emotions and her moments of wonder and is mostly uninterested in telling other people what to do. The setting sounds darkly depressing, and there are moments where it feels that way in the book, but the core of the story and of Tetley's life philosophy is a type of personal resilience: find the things that make you happy, put one foot in front of the other, and enjoy the world for what it is rather than what it could be or what other people want to convince you it might be. It's also surprisingly funny, particularly if you see the humor in bizarrely-specific piles of the detritus of civilization. The one place where I will argue with Valente a bit is that The Past is Red thoroughly embraces an environmental philosophy of personal responsibility. The devastating critique aimed at the Fuckwits is universal and undistinguished except slightly by class. Tetley and the other inhabitants of Garbagetown make no distinction between types of Fuckits or attempt to apportion blame in any way more granular than entire generations and eras. This is probably realistic. I understand why, by Tetley's time, no one is interested in the fine points of history. But the story was written today, for readers in our time, and this type of responsibility collapse is intentionally and carefully constructed by the largest polluters and the people with the most power. Collective and undifferentiated responsibility means that we're using up our energy fretting about whether we took two showers, which partly deflects attention from the companies, industries, and individuals that are directly responsible for the vast majority of environmental damage. We don't live in a world full of fuckwits; we live in a world run by fuckwits and full of the demoralized, harried, conned, manipulated, overwhelmed, and apathetic, which is a small but important difference. This book is not the right venue to explore that difference, but I wish the vitriol had not been applied quite so indiscriminately. The rest, though, worked for me. Valente tends to describe things by piling clauses on top of adjectives, which objectively isn't the best writing but it fits everything about Tetley's personality so well that I think this is the book where it works. I found her strange mix of optimism, practicality, and unbreakable inner ethics oddly endearing. "The Future is Blue" is available for free on-line, so if in doubt, read some or all of it, and that should tell you whether you're interested in the expansion. I'm glad I picked it up. Content warning for physical and sexual abuse of the first-person protagonist, mostly in the first section. Rating: 7 out of 10
nailing-cargo/1.0.0.
nailing-cargo
is a wrapper around the Rust build tool cargo. nailing-cargo can:
Cargo.toml)
crates.io, which is a minimally-curated repository.
I didn't want to expose my main account to that.
And, at the time, I was working on a project which for which I was
also writing a library as a dependency, and I found that cargo
couldn't cope with this unless I were to commit (to my git repository)
the path (on my local laptop) of my dependency.
I filed some bugs, including about the unpublished crate problem.
But also, I was stubborn enough to try to find
a workaround that didn't involve committing junk to my git history.
The result was a
short but horrific shell script.
I wrote about this
at the time (March 2019).
Over the last few years the difficulties I have with cargo have
remained un-resolved. I found my
interactions
with
upstream
rather discouraging.
It didn't seem like I would get anywhere by trying to help
improve cargo to better support my needs.
So instead I have gradually improved nailing-cargo. It is now a Perl
script. It is rather less horrific, and has
proper documentation
(sorry, JS needed because GitLab).
Why Perl ?
Rust would have been my language of choice. But I wanted to avoid a
chicken-and-egg situation. When you're doing privsep, nailing-cargo
has to run in your more privileged environment. I wanted something
easy to get going with.
nailing-cargo has to contain a TOML parser; and I found a small one,
TOML-Tiny, which was good enough as a starting point, and small enough
I could bundle it as a git subtree. Perl is nicely fast to start up
(nailing-cargo --- true runs in about 170ms on my
laptop), and it is easy to write a Perl script that will work on
pretty much any Perl installation.
Still unsolved: embedding cargo in another build system
A number of my projects contain a mixture of Rust code with other
languages. Unfortunately, nailing-cargo doesn't help with the
problems which arise trying to integrate cargo into another build
system.
I generally resort to find runes for finding Rust source
files that might influence cargo, and stamp files for seeing if I have
run it recently enough; and I simply live with the fact that cargo
sometimes builds more stuff than I needed it to.
Future
There are a number of ways nailing-cargo could be improved.
Notably, the need to overwrite your actual Cargo.toml is
very annoying, even if nailing-cargo puts it back afterwards.
A big problem with this is that it means that
nailing-cargo has to take a lock, while your cargo rune runs.
This effectively prevents using nailing-cargo with long-running
processes. Notably, editor integrations like rls and racer.
I could perhaps solve this with more linkfarm-juggling, but that
wouldn't help in-tree builds and it's hard to keep things up to date.
I am considering using
LD_PRELOAD trickery or maybe bwrap(1) to "implement"
the alternative Cargo.toml feature which was
rejected by cargo upstream in 2019
(and
again in April
when someone else asked).
Currently there is no support for using sudo for
out-of-tree privsep. This should be easy to add but it needs someone
who uses sudo to want it (and to test it!)
The documentation has some other
dicusssion of limitations, some of
which aren't too hard to improve.
Patches welcome!| Series: | Between Earth and Sky #1 |
| Publisher: | Saga Press |
| Copyright: | October 2020 |
| ISBN: | 1-5344-3769-X |
| Format: | Kindle |
| Pages: | 454 |
Yesterday I upgraded a machine from Debian buster to bullseye without
apt-listchanges installed, oops. Here s a way to get new NEWS.Debian entries
after the fact.
perl -MDpkg::Changelog::Debian -wE'$parser = Dpkg::Changelog::Debian->new;
for (</usr/share/doc/*/NEWS.Debian*>)
$parser->load($_);
$_->get_timepiece && $_->get_timepiece->year < 2020 ? last : say
for $parser->@* ' 2>&1 mail -s"News for $(hostname)" you@example.com
So today is the day when a new Debian release comes out!
Congratulations to everybody, and thanks a lot mainly to the Release
Team. Lots of very hard work was put into making Debian 11 Bullseye
a reality!
My very personal way to celebrate this was to do a somewhat different
Debian install at home. Why different? Well, I have quite a bit of
old, older and frankly elderly laptops at home. And as many of you
know, I have done more than my fair share of Raspberry Pi
installs I have played and worked with
assorted ARM machines at least since 2013, and I cannot consider
myself a newbie with them by any means.
But this is the first time I installed Debian on a mass-market,
decently-specced ARM64-based laptop. Yes, I know the Pinebook has been
there like for ages, but it really does feel like a computer to show
off and not to use seriously (and I ve seen probably too many people
fiddling with it, unable to get $foo to work). So I got myself a used
Lenovo Yoga
C630. Yes,
a discontinued product it seems Lenovo was not able to properly
market this machine, and it had a pretty short shelf life the
machine was available for samples in late 2018 and for general sale in
2019! The specs are quite decent:
Installing it via an almost-standard debian-installer i3, as it s
fundamental for me to work happily.
Of course, the computer has quirks, more than I d expect from a
regular x86 system, but well within what I expected to achieve during
my first day with it. The issues I have most noted are:
/usr/local/bin/install-dtbs.py
/usr/lib/linux-image-5.12.19-custom/ /boot/efi/dtb. And this should
remain handy, as I ll have to do so for every new kernel I install
(hint, hint: It should be called from /etc/kernel/postinst.d or
something like that. I should check and propose a patch!)
openvpn client configuration with systemd.
Spent a while trying to figure out why my configuration
file /etc/openvpn does not take effect. It was
because I needed to tell systemd to reload the daemon stuff
and trying to restart openvpn only did not have any
meaningful effect. After I learnt how things work it made some sense,
but I expected /etc/init.d/openvpn restart to do the right thing.
data-xml-clojure package was accepted[1] in experimental on Wednesday night :-)clj dependencies. And after the precious feedback from Louis-Philippe, Elana, Utkarsh, and Alex Miller (the upstream developer of clj, among many other libraries), I came up with the following packaging strategy.org.clojure:data.xml (data-xml-clojure) to 0.2.0-beta6.org.clojure:tools.gitlibs (tools-gitlibs-clojure).libjsch-agent-proxy-java, jgit, libtools-cli-clojure (all of them already in Debian).com.cognitec.aws:* packages.data-codec-clojure (not currently in Debian).debian/).sbuild[3] to make it work with gbp[4] (when I had rebuilt bidi-clojure from scratch, I had used plain sbuild.)quilt[5] (actually, via the dquilt frontend). This was the first really difficult task to do, since it took me quite some time to grasp it. Looking back, I think I was simply scared of breaking something :)debian/ files.debian/tests (autopkgtest) files. This was particularly difficult, since the doc wasn't clear about it. So I then improved the Clojure Packaging Tutorial[2] to make the process easier to follow.data-xml-clojure package was accepted[1] in experimental on Wednesday :-)[1] https://tracker.debian.org/news/1244465/accepted-data-xml-clojure-020alpha6-1-source-into-experimental/Now that I've tools-gitlibs-clojure, you're next :-)Thank you very much Louis-Philippe, Elana, and Utkarsh (plus a special mention to Alex) for your precious support during the last few weeks!
data-xml-clojure package was accepted[1] in experimental on Wednesday night :-)clj dependencies. And after the precious feedback from Louis-Philippe, Elana, Utkarsh, and Alex Miller (the upstream developer of clj, among many other libraries), I came up with the following packaging strategy.org.clojure:data.xml (data-xml-clojure) to 0.2.0-beta6.org.clojure:tools.gitlibs (tools-gitlibs-clojure).libjsch-agent-proxy-java, jgit, libtools-cli-clojure (all of them already in Debian).com.cognitec.aws:* packages.data-codec-clojure (not currently in Debian).debian/).sbuild[3] to make it work with gbp[4] (when I had rebuilt bidi-clojure from scratch, I had used plain sbuild.)quilt[5] (actually, via the dquilt frontend). This was the first really difficult task to do, since it took me quite some time to grasp it. Looking back, I think I was simply scared of breaking something :)debian/ files.debian/tests (autopkgtest) files. This was particularly difficult, since the doc wasn't clear about it. So I then improved the Clojure Packaging Tutorial[2] to make the process easier to follow.data-xml-clojure package was accepted[1] in experimental on Wednesday :-)[1] https://tracker.debian.org/news/1244465/accepted-data-xml-clojure-020alpha6-1-source-into-experimental/Now that I've tools-gitlibs-clojure, you're next :-)Thank you very much Louis-Philippe, Elana, and Utkarsh (plus a special mention to Alex) for your precious support during the last few weeks!
Next.