fs.com s5850 and s8050 series type switches have a secret mode which
lets you enter a regular shell from the switch cli, like so:
hostname# start shell
Password:
The command and password are not documented by the manufacturer,
i wondered wether if its possible to extract that password from
the firmware. After all: its my device, and i want to have access
to all the features!
Download the latest firmware image for those switch types and let binwalk do
its magic:
Sometimes I have remote meetings with Google Meet. Unlike the other
video-conferencing services that I use (Bluejeans, Zoom), my video
was stretched out of proportion under Google Meet with Firefox.
I haven't found out why this was happening, but I did figure out a
work-around.
Thanks to Daniel Silverstone, Rob Kendrick, Gregor Herrmann and Ben Allen for
pointing me in the right direction!
Hardware
The lovely Sony RX-100 mk3 that I bought in 2015 has
spent most of its life languishing unused. During the Pandemic, once
I was working from home all the time, I decided to press-gang it into
service as a better-quality webcam. Newer models of this camera
the mark 4 onwards have support for a USB mode called "PC Remote",
which effectively makes them into webcams. Unfortunately my mark 3
does not support this, but it does have HDMI out, so I picked up a
cheap "HDMI to USB Video Capture Card" from eBay.
Video modes
Before: wrong aspect ratio
This device offers a selection of different video modes over a webcam
interface. I used qv4l2 to
explore the different modes. It became clear that the camera was
outputting a signal at 16:9, but the modes on offer from the dongle
were for a range of different aspect ratios. The picture for these
other ratios was not letter or pillar-boxed, but stretched to fit.
I also noticed that the modes which had the correct aspect ratio were
at very low framerates: 1920x1080@5fps, 1360x768@8fps, 1280x720@10fps.
It felt to me that I would look unnatural at such a low framerate. The
most promising mode was close to the right ratio, 720x480 and 30 fps.
Software
After: corrected aspect ratio
My initial solution is to use the v4l2loopback
kernel module, which provides a virtual loop-back webcam interface. I
can write video data to it from one process, and read it back from
another. Loading it as follows:
modprobe v4l2loopback exclusive_caps=1
The option exclusive_caps configures the module into a mode where it
initially presents a write-only interface, but once a process has opened
a file handle, it then switches to read-only for subsequent processes.
Assuming there are no other camera devices connected at the time of
loading the module, it will create /dev/video0.1
I experimented briefly with OBS Studio, the
very versatile and feature-full streaming tool, which confirmed that I
could use filters on the source video to fix the aspect ratio, and emit
the result to the virtual device. I don't otherwise use OBS, though, so
I achieve the same result using ffmpeg:
The source options are to select the source video mode I want. The
codec and pixel formats are to match what is being emitted (I determined
that using ffprobe on the camera device). The resizing is triggered by
supplying a different size to the -s parameter. I think that is equivalent
to explicitly selecting a "scale" filter, and there might be other filters
that could be used instead (to add pillar boxes for example).
This worked just as well. In Google Meet, I select the Virtual Camera,
and Google Meet is presented with only one video mode, in the correct aspect
ratio, and no configurable options for it, so it can't misbehave.
Future
I'm planning to automate the loading (and unloading) of the module and starting
the ffmpeg process in response to the real camera device being plugged or
unplugged, using systemd events and services. (I don't leave the camera plugged
in all the time due to some bad USB behaviour I've experienced if I do so.)
If I get that working, I will write a follow-up.
you can request a specific device name/number with another module option.
Wait! Just like yesterday when I was accepted as an Outreachy intern and the first half of the internship is finished . How time flies when you are having a good time
As part of the requirements for the final application during the contribution period for the Outreachy internship, I needed to provide a timeline to achieve our goal on my outreachy task which is transitioning of dependencies in node16 and webpack5. Having consulted my mentors who implied that the packages depending on webpack and nodejs combined are so numerous that its impossible to finish all within a space of three months but we have steps to guide us through the entire process to achieve most of our goals which are
Find a list of packages(failing rebuild and testing with autopkgtest, of reverse dependencies of webpack and nodejs) to fix.
See if new upstream versions are available that support nodejs16 and webpack5 respectively.
See if the new upstream version works and doesn't fail while rebuilding or testing with autopkgtest.
Report bug in Debian if any fails to rebuild or test with autopkgtest.
Forward bugs upstream if needed.
Fix packages and forward patches.
As of this writing(though a little late ) we have successfully rebuilt all reverse dependencies of webpack5 and split them equally each for I and my co-intern for all Javascript modules as ruby packages also depend on webpack which is a total of 44 packages. Filed a bug report on Debian bug tracking system for failing packages, also the original maintainer or uploader of the package to the Debian archive mostly Debian developers also get a mail in references to the package bug report. Sometimes the uploader who also receives the bug report decides to help out to fix the package and forward the patch upstream if need be. We have also filed an issue to upstream repo mostly via github where some respond and create PR to solve those errors and others are plain aversive to the whole idea. PR from the upstream developer is cherry-picked and a patch is created by us to incorporate the code into our own working repository. some package upstream maintainer rejects such issues or doesn't respond, we take it upon ourselves to fix the package. The total number of packages that are successfully updated and ready to be merged is 10 packages while 12 packages remain on my own end to be updated.
One of the most challenging packages to update so far was prop-type as its runs its large test suite using jest of a lower version 19.0.2 compared to that of Debian OS which is version 27.5.1 updating and migrating its API's and methods to use the Debian updated version is so challenging after several googling, testing out the solution from StackOverflow, trials, and errors, reading documentations we eventually made progress with the help of my mentor, co-intern and the whole community member. It's so crazy that when I got it working I said to myself. phew it's not rocket science why can I figure it out sooner than expected
I initially proposed that I would be halfway done with the project by now, I guess the reason am not able to achieve some of our goals which are finishing up with the packages for webpack and moving to transition some of the nodejs packages at all is DEBUGGING. Yes DEBUGGING! where you never can predict what the solution is. is the problem coming from Debian? or dependencies of the package you are working on, upstream bug, or dependencies of dependencies of the package you are working on, so many questions to answer. You can't easily find a solution to a bug as it takes time to try out so many guesses more of an educated guess, or even try out all the solutions from stack overflow and still no viable progress. Obviously, you cannot really know about something to set up a plan for unless you get right into it.
One way of doing this, if I have to start again is the truly understand how the javascript package work under the hood, how its handles different interaction between packages, some of its dos and don't of transpiling, bundling, testing, e.t.c
I guess my unrealistic goals need to be modified because some drawback that was not envisaged popped up and I underestimated the complexity of the tasks, which will be reducing the number of packages to update in transitioning of nodejs from what I planned
My major focus for the second half of the internship is to fix bugs and errors I discover, file bug reports for future bugs to seek help from co-maintainer or developers, file issues upstream and close those whose bugs are already resolved for the remaining 12 packages, and ultimately successfully uploading all reverse dependencies. Also diving into transitioning of nodejs16.
Thanks for stopping by
Leonardo and I are pleased to another update to our nanotime package bringing it to version 0.3.6 which landed on CRAN earlier today.
nanotime relies on the RcppCCTZ package (as well as the RcppDate package for additional C++ operations) and offers efficient high(er) resolution time parsing and formatting up to nanosecond resolution, and the bit64 package for the actual integer64 arithmetic. Initially implemented using the S3 system, it has benefitted greatly from a rigorous refactoring by Leonardo who not only rejigged nanotime internals in S4 but also added new S4 types for periods, intervals and durations.
This release corrects subsetting with %in% operator, integrates it better fit in the mixed S3/S4 setup, fixes a negative period parse, and updates class comparisons to rely on inherits(). The NEWS snippet has the full more details.
Changes in version 0.3.6 (2022-03-06)
Fix incorrect subsetting with operator %in% (Leonardo in #100 fixing #99).
Fix incorrect parsing for negative nanoperiod (Leonardo in #100 fixing #96).
FTP master
This month I accepted 484 and rejected 73 packages. The overall number of packages that got accepted was 495.
The overall number of rejected packages was 76, which is about 15% of the uploads to NEW. While most of the maintainers do a great job when creating their debian/copyright, others are a bit lax. Unfortunately those people seem to be more enthusiastic when fighting for changes in NEW processing or even removing NEW.
One argument in discussions about NEW is that the copyright verification of packages can be done by the community after accepting the packages in the archive.
Last month I did not get any hint that such checks have been done by anybody. As the past already showed several times, this community based checks simply do not exist.
So in the end poorly maintained copyright information will rot in the archive and I am not sure that this really corresponds with the Debian Social Contract.
Debian LTS
This was my ninety-second month that I did some work for the Debian LTS initiative, started by Raphael Hertzog at Freexian.
This month my all in all workload has been 40h. During that time I did LTS and normal security uploads of:
[DLA 2928-1] htmldoc security update for three CVEs
[#1004049] buster-pu: zziplib debdiff was approved and package uploaded
[#1004050] bullseye-pu: zziplib debdiff was approved and package uploaded
[#1004055] buster-pu: debdiff was approved and package uploaded
Unfortunately salsa went down at the end of the month, so several planned uploads did not happen and have to be delayed to March.
I also continued to work on security support for golang packages. Further I worked on packages in NEW on security-master and injected missing sources. Last but not least I did some days of frontdesk duties.
Debian ELTS
This month was the forty-fourth ELTS month.
During my allocated time I uploaded:
ELA-567-1 for apache2
ELA-567-2 for apache2
ELA-568-1 for ksh
ELA-569-1 for tiff
ELA-570-1 for htmldoc
Further I worked on cyrus-sasl but did not do an upload yet.
Last but not least I did some days of frontdesk duties.
Debian Printing
As announced last month I uploaded a new version of cups.
Altogether I uploaded new upstream versions or improved packaging of:
Welcome to the February 2022 report from the Reproducible Builds project. In these reports, we try to round-up the important things we and others have been up to over the past month. As ever, if you are interested in contributing to the project, please visit our Contribute page on our website.
Jiawen Xiong, Yong Shi, Boyuan Chen, Filipe R. Cogo and Zhen Ming Jiang have published a new paper titled Towards Build Verifiability for Java-based Systems (PDF). The abstract of the paper contains the following:
Various efforts towards build verifiability have been made to C/C++-based systems, yet the techniques for Java-based systems are not systematic and are often specific to a particular build tool (eg. Maven). In this study, we present a systematic approach towards build verifiability on Java-based systems.
We first define the problem, and then provide insight into the challenges of making real-world software build in a reproducible manner-this is, when every build generates bit-for-bit identical results. Through the experience of the Reproducible Builds project making the Debian Linux distribution reproducible, we also describe the affinity between reproducibility and quality assurance (QA).
In openSUSE, Bernhard M. Wiedemann posted his monthly reproducible builds status report.
On our mailing list this month, Thomas Schmitt started a thread around the SOURCE_DATE_EPOCH specification related to formats that cannot help embedding potentially timezone-specific timestamp. (Full thread index.)
The Yocto Project is pleased to report that it s core metadata (OpenEmbedded-Core) is now reproducible for all recipes (100% coverage) after issues with newer languages such as Golang were resolved. This was announced in their recent Year in Review publication. It is of particular interest for security updates so that systems can have specific components updated but reducing the risk of other unintended changes and making the sections of the system changing very clear for audit.
The project is now also making heavy use of equivalence of build output to determine whether further items in builds need to be rebuilt or whether cached previously built items can be used. As mentioned in the article above, there are now public servers sharing this equivalence information. Reproducibility is key in making this possible and effective to reduce build times/costs/resource usage.
diffoscopediffoscope is our in-depth and content-aware diff utility. Not only can it locate and diagnose reproducibility issues, it can provide human-readable diffs from many kinds of binary formats. This month, Chris Lamb prepared and uploaded versions 203, 204, 205 and 206 to Debian unstable, as well as made the following changes to the code itself:
Bug fixes:
Fix a file(1)-related regression where Debian .changes files that contained non-ASCII text were not identified as such, therefore resulting in seemingly arbitrary packages not actually comparing the nested files themselves. The non-ASCII parts were typically in the Maintainer or in the changelog text. [][]
Fix a regression when comparing directories against non-directories. [][]
If we fail to scan using binwalk, return False from BinwalkFile.recognizes. []
If we fail to import binwalk, don t report that we are missing the Python rpm module! []
Testsuite improvements:
Add a test for recent file(1) issue regarding .changes files. []
Use our assert_diff utility where we can within the test_directory.py set of tests. []
Don t run our binwalk-related tests as root or fakeroot. The latest version of binwalk has some new security protection against this. []
Codebase improvements:
Drop the _PATH suffix from module-level globals that are not paths. []
Tidy some control flow in Difference._reverse_self. []
Don t print a warning to the console regarding NT_GNU_BUILD_ID changes. []
In addition, Mattia Rizzolo updated the Debian packaging to ensure that diffoscope and diffoscope-minimal packages have the same version. []
Move the contributors.sh Bash/shell script into a Python script. [][][]
Daniel Shahaf:
Try a different Markdown footnote content syntax to work around a rendering issue. [][][]
Holger Levsen:
Make a huge number of changes to the Who is involved? page, including pre-populating a large number of contributors who cannot be identified from the metadata of the website itself. [][][][][]
Improve linking to sponsors in sidebar navigation. []
drop sponsors paragraph as the navigation is clearer now. []
Upstream patches
The Reproducible Builds project attempts to fix as many currently-unreproducible packages as possible. February s patches included the following:
Testing framework
The Reproducible Builds project runs a significant testing framework at tests.reproducible-builds.org, to check packages and other artifacts for reproducibility. This month, the following changes were made:
Daniel Golle:
Update the OpenWrt configuration to not depend on the host LLVM, adding lines to the .config seed to build LLVM for eBPF from source. []
Preserve more OpenWrt-related build artifacts. []
Holger Levsen:
Temporary use a different Git tree when building OpenWrt as our tests had been broken since September 2020. This was reverted after the patch in question was accepted by Paul Spooren into the canonical openwrt.git repository the next day.
Various improvements to debugging OpenWrt reproducibility. [][][][][]
Ignore useradd warnings when building packages. []
Update the script to powercycle armhf architecture nodes to add a hint to where nodes named virt-*. []
Update the node health check to also fix failed logrotate and man-db services. []
Mattia Rizzolo:
Update the website job after contributors.sh script was rewritten in Python. []
Make sure to set the DIFFOSCOPE environment variable when available. []
Vagrant Cascadian:
Various updates to the diffoscope timeouts. [][][]
Node maintenance was also performed by Holger Levsen [] and Vagrant Cascadian [].
Finally
If you are interested in contributing to the Reproducible Builds project, please visit our Contribute page on our website. However, you can get in touch with us via:
About the project
Debci exist to make sure packages work currently after an update, How it does this is by testing all of the packages that have tests written in them to make sure it works and nothing is broken
This project entails making improvements to the platform to make it easier to use and maintain.
Deliverables of the project:
Package landing page displaying pending jobs
web frontend: centralize job listings in a single template
self-service: request test form forgets values when validation fails
Improvement to status
Work done
Package landing page displaying pending jobs
Previously, Jobs that were pending were not displayed on the package page. Working on this added a feature to display pending jobs on package landing.
Working on this task made it known that the same block of codes was repeated in different files which led to the next task
Merge request
web frontend: centralize job listings in a single template
Jobs are listed in various landings such as status packages, Status alerts, status failing, History, and so on. The same Code was repeated in these pages to list the jobs, I worked on refactoring it and created a single template for job listing so it can be used anywhere it s needed.
I also wrote a test for the feature I added. Merge request
self service: request test form forgets values when validation fails
When one tries to request for a test and it fails with an error, originally the form does not remember the values that were typed in the package name, suite field et. c. This fix ensures the form remembers the values inputted even when it throws an error.
N/B: The form checks all architecture on the load of the page merge request
Improvement to status
Originally the Status pages were rendered as static HTML pages but I converted these pages to be generated dynamically, I wrote endpoints for each page.
Since most of the status pages have a list of jobs I modified it to use the template I created for job-listing.
Previously, the status pages had a mechanism to filter such as All, Latest 50 et.c which wasn t paginated. I removed this mechanism added a filter by architecture and suites to these pages and also add pagination.
Last but not the least, I wrote tests for these implementations carried out on the status page.
merge request: first task second task
Major take-aways
I learnt a lot during my internship but most importantly I learnt how to:
write Tests in Ruby and how writing tests is an important aspect of software development
maintain good coding practice, Paying attending to commit messages, Indentation et.c are good areas I developed in writing code.
make contributions in Ruby Programming Language.
Acknowledgement
I can not end this without saying thank you to my mentors Antonio Terceiro, Paul Gevers, and Pavit Kaur for their constant support and guidance throughout the entire duration of this Internship. It has been a pleasure Interacting and learning from everyone.
Review
Outreachy has helped me feel more confident about open-source, especially during the application phase. I had to reach out to the community I was interested in and ask questions on how to get started.
The informal chats week was awesome I was able to build my network and have interesting conversations with amazing individuals in open-source.
To round up, Always ask questions and do not be afraid of making a mistake, as one of the outreachy blog post topics says Everyone struggles!, but never give up!
doveconf to dump dovecot's
configuration to see if what it understands matches what I mean
sieve-test
parses sieve scripts: sieve-test file.sieve /dev/null is a quick and dirty
syntax check
Backup of all mails processed
One thing I did with procmail was to generate a monthly mailbox with all
incoming email, with something like this:
BACKUP="/srv/backupts/test- date +%Y-%m-d .mbox"
:0c
$BACKUP
I did not find an obvious way in sieve to create montly mailboxes, so I
redesigned that system using Postfix's
always_bcc
feature, piping everything to an archive user.
I'll then recreate the monthly archiving using a
chewmail script that I can simply run
via cron.
Configure dovecot
apt install dovecot-sieve dovecot-lmtpd
I added this to the local dovecot configuration:
service lmtp
unix_listener /var/spool/postfix/private/dovecot-lmtp
user = postfix
group = postfix
mode = 0666
protocol lmtp
mail_plugins = $mail_plugins sieve
plugin
sieve = file:~/.sieve;active=~/.dovecot.sieve
This makes Dovecot ready to receive mail from Postfix via a lmtp unix socket
created in Postfix's private chroot.
It also activates the sieve plugin, and uses ~/.sieve as a sieve script.
The script can be a file or a directory; if it is a directory,
~/.dovecot.sieve will be a symlink pointing to the .sieve file to run.
This is a feature I'm not yet using, but if one day I want to try enabling UIs
to edit sieve scripts,
that part is ready.
Delegate to procmail
To make sieve scripts that delegate to procmail, I enabled the
sieve_extprograms plugin:
Without auth_username_format = %Ln dovecot won't be able to understand
usernames sent by postfix in my specific setup.
Moving rules over to sieve
This is mostly straightforward, with the luxury of being able to do it a bit at
a time.
The last tricky bit was how to call spamc from sieve, as in some situations I
reduce system load by running the spamfilter only on a prefiltered selection of
incoming emails.
For this I enabled the filter directive in sieve:
Updates
Ansgar mentioned that it's possible to replicate the monthly mailbox using the
variables and
date
extensions, with a hacky trick from the extensions' RFC:
require"date"require"variables"ifcurrentdate:matches"month""*"set"month""$ 1 ";ifcurrentdate:matches"year""*"set"year""$ 1 ";fileinto:create"$ month -$ year ";
By far the biggest LVM Cache surprise is just how well it works.
Between 2010 and 2020, my single, biggest and most consistent headache managing
servers at May First has been disk i/o. We run a
number of physical hosts with encrypted disks, with each providing a dozen or
so sundry KVM guests. And they consume a lot of disk i/o.
This problem kept me awake at night and made me want to put my head on the
table and cry during the day as I monitored the output of vmstat 1 and
watched each disk i/o death spiral unfold.
We tried everything. Turned off fsck s, turned off RAID monthly checks.
Switched to less intensive backup systems. Added solid state drives and tried
to stragically distribute them to our database partitions and other read/write
heavy services. Added tmpfs file systems where it was possible.
But, the sad truth was: we simply did not have the resources to pay for the
infrastructure that could support the disk i/o our services demanded.
Then, we discovered LVM caching (cue Hallelujah). We starting provisioning SSD
partitions to back up our busiest spinning disk logical volumes and presto. Ten
years of agony gone like a poof of smoke!
I don t know which individuals are responsible for writing the LVM caching code
but if you see this: THANK YOU! Your contributions to the world are noticed,
appreciated and have had an enormous impact on at least one individual.
Some surprises
Filters
For the last two years, with the exception of one little heart
attack, LVM caches have gone very smoothly.
Then, last week we upgraded 13 physical servers straight through from stretch
to bullseye.
It went relatively smoothly for the first half of our servers (the old ones
hosting fewer resources). But, after rebooting our first server with lvm
caching going on, we noticed that the cached disk wasn t accessible.
No problem, we reasoned. We ll just uncache it. Except that didn t work either.
We tried every argument we could find on the Internet but lvm insisted that
the block device from the SSD volume group (that provides the caching device)
was not available. Running pvs showed an unknown device and vgs reported
similar errors. Now I started to panic a bit. There was a clean shutdown of the
server, so surely all the data had been flushed to the disk. But, how can we
get that data? We started a restore from backup process because we really
thought that data was gone for ever.
Then we had a really great theory: the caching logical volume comes from the
SSD volume group, which gets decrypted after the spinning disk volume group.
Maybe there s a timing issue? When the spinning disk volume group comes online,
the caching logical volume is not yet available.
So, we booted into busybox, and manually decrypted the SSD volume first,
followed by the spinning disk volume. Alas, no dice.
Now that we were fully desperate, we decided to restore the lvm configuration
file for the entire spinning disk volume group. This felt kinda risky since we
might be damaging all the currently working logical volumes, but it seemed like
the only option we had.
The main problem was that busybox didn t seem to have the lvm config tool we
needed to restore the configuration from our backup (I think it might be there
but it was late and we couldn t figure it out). And, our only readily available
live install media was a Debian stretch disk via
debirf.
Debian stretch is pretty old and we really would have preferred to have the
most modern tools available, but we decided to go with what we had.
And, that was a good thing, because as soon as we booted into stretch and
decrypted the disks, the lvm volume suddenly appeared, happy as ever. We
uncached it and booted into the host system and there it was.
We went to bed confused but relieved.
The next morning my co-worker figured it out: filtering.
During the stretch days we occassionally ran into an annoying problem: the
logical volumes from guests would suddenly pop up on the host. This was mostly
annoying but also it made possible some serious mistakes if you accidentally
took a volume from a guest and used it on the host.
The LVM folks seemed to have noticed this problem and introduced a new default
filter that tries to only show you the devices that you should be seeing.
Unfortunately for us, this new filter removed logical volumes from the list of
available physical volumes. That does make sense for most people. But, not for
us. It sounds a bit weird, but our setup looks like this:
One volume group derived from the spinning disks
One volume group derived from the SSD disks
Then we carve out logical volumes from each for each guest.
Once we discovered LVM caching, we carved out SSD logical volumes to be used as
caches for the spinning logical volumes.
In restrospect, if we could start over, we would probably do it differently.
In any event, once we discovered the problem, we used the handy configuration
options in lvm.conf to tweak the filters to include our cache disks and once
again, everything is back to working.
Saturated SSDs
The other surprise seems unrelated to the upgrade. We have a phsyical server
that has been suffering from disk i/o problems despite our use of LVM caching.
Our answer, of course, was to add more LVM caches to the spinning logical
volumes that seemed to be suffering.
But somehow this was making things even worse.
Then, we finally just removed the LVM caches from all the spinning disks and
presto, disk i/o problems seemed to go away. What? Isn t that the opposite of
what s supposed to happen?
We re still trying to figure this one out, but it seems that our SSDs are
saturated, in which case adding them as a caching volume really is going to
make things worse.
We re still not sure why they are saturated when none of the SSDs on our other
hosts are saturated, but a few theories include:
They are doing more writing and/or it s a different kind of writing. I m
still not sure I quite have the right tool to compare this host with other
hosts. And, this host is our only MySQL network database server, hosting
hundreds of GBs of database - all writing/reading direclty onto the SSDs.
They are broken or substanard SSDs (smartctl doesn t uncover any problems
but maybe it s a bad model?)
I ll update this post as we learn more but welcome any suggestions in the
comments.
Update: 2022-03-07
Two more possible causes:
Our use of the write back feature: LVM cache has a nice feature that caches
writes to smooth out writes to the underlying disk. Maybe our disks are
simply writing more then can be handled and not using write back is our
solution. This server supports a guest with an unusually large disk.
Maybe we haven t allocated a big enough LVM cache for the given volume so
the contents are constantly being ejected?
TL;DR: procmail is a security liability and has been abandoned
upstream for the last two decades. If you are still using it, you
should probably drop everything and at least remove its SUID
flag. There are plenty of alternatives to chose from, and conversion
is a one-time, acceptable trade-off.
Procmail is unmaintained
procmail is unmaintained. The "Final release", according to
Wikipedia, dates back to September 10, 2001 (3.22). That release
was shipped in Debian since then, all the way back from Debian 3.0
"woody", twenty years ago.
Debian also ships 25 uploads on top of this, with 3.22-21 shipping the
"3.23pre" release that has been rumored since at least the November
2001, according to debian/changelog at least:
procmail (3.22-1) unstable; urgency=low
* New upstream release, which uses the standard' format for Maildir
filenames and retries on name collision. It also contains some
bug fixes from the 3.23pre snapshot dated 2001-09-13.
* Removed sendmail' from the Recommends field, since we already
have exim' (the default Debian MTA) and mail-transport-agent'.
* Removed suidmanager support. Conflicts: suidmanager (<< 0.50).
* Added support for DEB_BUILD_OPTIONS in the source package.
* README.Maildir: Do not use locking on the example recipe,
since it's wrong to do so in this case.
-- Santiago Vila <sanvila@debian.org> Wed, 21 Nov 2001 09:40:20 +0100
All Debian suites from buster onwards ship the 3.22-26 release,
although the maintainer just pushed a 3.22-27 release to fix a seven
year old null pointer dereference, after this article was drafted.
Procmail is also shipped in all major distributions: Fedora
and its derivatives, Debian derivatives, Gentoo, Arch,
FreeBSD, OpenBSD. We all seem to be ignoring this problem.
The upstream website (http://procmail.org/) has been down since
about 2015, according to Debian bug #805864, with no change
since.
In effect, every distribution is currently maintaining its fork of
this dead program.
Note that, after filing a bug to keep Debian from shipping
procmail in a stable release again, I was told that the
Debian maintainer is apparently in contact with the upstream. And,
surprise! they still plan to release that fabled 3.23 release, which
has been now in "pre-release" for all those twenty years.
In fact, it turns out that 3.23 is considered released already, and
that the procmail author actually pushed a 3.24 release, codenamed
"Two decades of fixes". That amounts to 25 commits since 3.23pre
some of which address serious security issues, but none of which
address fundamental issues with the code base.
Procmail is insecure
By default, procmail is installed SUIDroot:mail in
Debian. There's no debconf or pre-seed setting that can change
this. There has been two bug reports against the Debian to make this
configurable (298058, 264011), but both were closed to say
that, basically, you should use dpkg-statoverride to change the
permissions on the binary.
So if anything, you should immediately run this command on any host
that you have procmail installed on:
Note that this might break email delivery. It might also not work at
all, thanks to usrmerge. Not sure. Yes, everything is on
fire. This is fine.
In my opinion, even assuming we keep procmail in Debian, that default
should be reversed. It should be up to people installing procmail to
assign it those dangerous permissions, after careful consideration of
the risk involved.
The last maintainer of procmail explicitly advised us (in that null
pointer dereference bug) and other projects (e.g. OpenBSD, in [2])
to stop shipping it, back in 2014. Quote:
Executive summary: delete the procmail port; the code is not safe
and should not be used as a basis for any further work.
I just read some of the code again this morning, after the original
author claimed that procmail was active again. It's still littered
with bizarre macros like:
... from regexp.c, line 66 (yes, that's a custom regex
engine). Or this one:
#define jj (aleps.au.sopc)
It uses insecure functions like strcpyextensively. malloc()
is thrown around gotos like it's 1984 all over again. (To be fair,
it has been feeling like 1984 a lot lately, but that's another matter
entirely.)
That null pointer deref bug? It's fixed upstream now, in this
commit merged a few hours ago, which I presume might be in response
to my request to remove procmail from Debian.
So while that's nice, this is the just tip of the iceberg. I speculate
that one could easily find an exploitable crash in procmail if only by
running it through a fuzzer. But I don't need to speculate: procmail
had, for years, serious security issues that could possibly lead to
root privilege escalation, remotely exploitable if procmail is (as
it's designed to do) exposed to the network.
Maybe I'm overreacting. Maybe the procmail author will go through the
code base and do a proper rewrite. But I don't think that's what is in
the cards right now. What I expect will happen next is that people
will start fuzzing procmail, throw an uncountable number of bug
reports at it which will get fixed in a trickle while never fixing the
underlying, serious design flaws behind procmail.
Procmail has better alternatives
The reason this is so frustrating is that there are plenty of modern
alternatives to procmail which do not suffer from those problems.
Alternatives to procmail(1) itself are typically part of mail
servers. For example, Dovecot has its own LDA which implements
the standard Sieve language (RFC 5228). (Interestingly, Sieve
was published as RFC 3028 in 2001, before procmail was formally
abandoned.)
Courier also has "maildrop" which has its own filtering mechanism,
and there is fdm (2007) which is a fetchmail and procmail
replacement. Update: there's also mailprocessing, which is not
an LDA, but processing an existing folder. It was, however,
specifically designed to replace complex Procmail rules.
But procmail, of course, doesn't just ship procmail; that would just
be too easy. It ships mailstat(1) which we could probably ignore
because it only parses procmail log files. But more importantly, it
also ships:
lockfile(1) - conditional semaphore-file creator
formail(1) - mail (re)formatter
lockfile(1) already has a somewhat acceptable replacement in the form of
flock(1), part of util-linux (which is Essential, so installed on
any normal Debian system). It might not be a direct drop-in
replacement, but it should be close enough.
formail(1) is similar: the courier maildrop package ships
reformail(1) which is, presumably, a rewrite of formail. It's
unclear if it's a drop-in replacement, but it should probably possible
to port uses of formail to it easily.
Update: the maildrop package ships a SUID root binary (two,
even). So if you want only reformail(1), you might want to disable
that with:
It would be perhaps better to have reformail(1) as a separate
package, see bug 1006903 for that discussion.
The real challenge is, of course, migrating those old .procmailrc
recipes to Sieve (basically). I added a few examples in the appendix
below. You might notice the Sieve examples are easier to read, which
is a nice added bonus.
Conclusion
There is really, absolutely, no reason to keep procmail in Debian, nor
should it be used anywhere at this point.
It's a great part of our computing history. May it be kept forever in
our museums and historical archives, but not in Debian, and certainly not
in actual release.
It's just a bomb waiting to go off. It is irresponsible for
distributions to keep shipping obsolete and insecure software like
this for unsuspecting users.
Note that I am grateful to the author, I really am: I used procmail
for decades and it served me well. But now, it's time to move, not
bring it back from the dead.
Appendix
Previous work
It's really weird to have to write this blog post. Back in 2016, I
rebuilt my mail setup at home and, to
my horror, discovered that procmail had been abandoned for 15 years at
that point, thanks to that LWN article from 2010. I would have
thought that I was the only weirdo still running procmail after all
those years and felt kind of embarrassed to only "now" switch to the
more modern (and, honestly, awesome) Sieve language.
But no. Since then, Debian shipped three major releases (stretch,
buster, and bullseye), all with the same vulnerable procmail
release.
Then, in early 2022, I found that, at work, we actually had procmail
installed everywhere, possibly because userdir-ldap was using
it for lockfile until 2019. I sent a patch to fix that and scrambled
to remove get rid of procmail everywhere. That took about a day.
But many other sites are now in that situation, possibly not imagining
they have this glaring security hole in their infrastructure.
Procmail to Sieve recipes
I'll collect a few Sieve equivalents to procmail recipes here. If you
have any additions, do contact me.
All Sieve examples below assume you drop the file in ~/.dovecot.sieve.
deliver mail to "plus" extension folder
Say you want to deliver user+foo@example.com to the folder
foo. You might write something like this in procmail:
MAILDIR=$HOME/Maildir/
DEFAULT=$MAILDIR
LOGFILE=$HOME/.procmail.log
VERBOSE=off
EXTENSION=$1 # Need to rename it - ?? does not like $1 nor 1
:0
* EXTENSION ?? [a-zA-Z0-9]+
.$EXTENSION/
That, in sieve language, would be:
require ["variables", "envelope", "fileinto", "subaddress"];
########################################################################
# wildcard +extension
# https://doc.dovecot.org/configuration_manual/sieve/examples/#plus-addressed-mail-filtering
if envelope :matches :detail "to" "*"
# Save name in $ name in all lowercase
set :lower "name" "$ 1 ";
fileinto "$ name ";
stop;
Subject into folder
This would file all mails with a Subject: line having FreshPorts
in it into the freshports folder, and mails from alternc.org
mailing lists into the alternc folder:
:0
## mailing list freshports
* ^Subject.*FreshPorts.*
.freshports/
:0
## mailing list alternc
* ^List-Post.*mailto:.*@alternc.org.*
.alternc/
Automated script
There is a procmail2sieve.pl script floating around, and
mentioned in the dovecot documentation. It didn't work very well
for me: I could use it for small things, but I mostly wrote the sieve
file from scratch.
Progressive migration
Enrico Zini has progressively migrated his procmail setup to Sieve
using a clever way: he hooked procmail inside sieve so that he could
deliver to the Dovecot LDA and progressively migrate rules one by
one, without having a "flag day".
See this explanatory blog post for the details, which also shows
how to configure Dovecot as an LMTP server with Postfix.
Other examples
The Dovecot sieve examples are numerous and also quite useful. At
the time of writing, they include virus scanning and spam filtering,
vacation auto-replies, includes, archival, and flags.
Harmful considered harmful
I am aware that the "considered harmful" title has a long and
controversial history, being considered harmful in itself (by some
people who are obviously not afraid of contradictions).
I have nevertheless deliberately chosen that title, partly to make
sure this article gets maximum visibility, but more specifically
because I do not have doubts at this moment that procmail is, clearly,
a bad idea at this moment in history.
Developing story
I must also add that, incredibly, this story has changed while writing
it. This article is derived from this bug I filed in Debian to,
quite frankly, kick procmail out of Debian. But filing the bug had the
interesting effect of pushing the upstream into action: as mentioned
above, they have apparently made a new release and merged a bunch of
patches in a new git repository.
This doesn't change much of the above, at this moment. If anything
significant comes out of this effort, I will try to update this
article to reflect the situation. I am actually happy to retract the
claims in this article if it turns out that procmail is a stellar
example of defensive programming and survives fuzzing attacks. But at
this moment, I'm pretty confident that will not happen, at least not
in scope of the next Debian release cycle.
After many months of hard work by the good people involved in
LinuxCNC, the
system was accepted Sunday
into Debian.
Once it was available from Debian, I was surprised to discover from
its
popularity-contest numbers that people have been reporting its use
since 2012. Its project site might
be a good place to check out, but sadly is not working when visiting
via Tor.
But what is LinuxCNC, you are probably wondering? Perhaps a
Wikipedia quote is in place?
"LinuxCNC is a software system for numerical control of
machines such as milling machines, lathes, plasma cutters, routers,
cutting machines, robots and hexapods. It can control up to 9 axes or
joints of a CNC machine using G-code (RS-274NGC) as input. It has
several GUIs suited to specific kinds of usage (touch screen,
interactive development)."
It can even control 3D printers. And even though the Wikipedia
page indicate that it can only work with hard real time kernel
features, it can also work with the user space soft real time features
provided by the Debian kernel.
The source code is
available from Github. The last few months I've been involved in the
translation setup for the program and documentation. Translators are
most welcome to
join the
effort using Weblate.
As usual, if you use Bitcoin and want to show your support of my
activities, please send Bitcoin donations to my address
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b.
After many months of hard work by the good people involved in
LinuxCNC, the
system was accepted Sunday
into Debian.
Once it was available from Debian, I was surprised to discover from
its
popularity-contest numbers that people have been reporting its use
since 2012. Its project site might
be a good place to check out, but sadly is not working when visiting
via Tor.
But what is LinuxCNC, you are probably wondering? Perhaps a
Wikipedia quote is in place?
"LinuxCNC is a software system for numerical control of
machines such as milling machines, lathes, plasma cutters, routers,
cutting machines, robots and hexapods. It can control up to 9 axes or
joints of a CNC machine using G-code (RS-274NGC) as input. It has
several GUIs suited to specific kinds of usage (touch screen,
interactive development)."
It can even control 3D printers. And even though the Wikipedia
page indicate that it can only work with hard real time kernel
features, it can also work with the user space soft real time features
provided by the Debian kernel.
The source code is
available from Github. The last few months I've been involved in the
translation setup for the program and documentation. Translators are
most welcome to
join the
effort using Weblate.
As usual, if you use Bitcoin and want to show your support of my
activities, please send Bitcoin donations to my address
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b.
In February I was assigned 16 hours of work by Freexian's Debian LTS
initiative and carried over 8 hours from January. I worked 16
hours, and will carry over the remaining time to March.
I spent most of my time triaging security issues for Linux, working
out which of them were fixed upstream and which actually applied to
the versions provided in Debian 9 "stretch". I also rebased the
Linux 4.9 (linux) package on the latest stable update, but did not
make an upload this month.
Testing Picolibc with the glibc tests
Picolibc has a bunch of built-in tests, but more testing is always
better, right? I decided to see how hard it would be to run some of
the tests provided in the GNU C Library (glibc).
Parallel meson build files
Similar to how Picolibc uses meson build files to avoid modifying the
newlib autotools infrastructure, I decided to take the glibc code and
write meson build rules that would compile the tests against Picolibc
header files and link against Picolibc libraries.
I decided to select a single target for this project so I could focus
on getting things building and not worry too much about making it
portable. I wanted to pick something that had hardware floating point
so that I would have rounding modes and exception support, so I picked
the ARM Cortex M7 with hard float ABI:
It should be fairly easy to extend this to other targets, but for now,
that's what I've got working. There's a cross-cortex-m7.txt file
containing all of the cross compilation details which is used when
running meson setup.
All of the Picolibc-specific files live in a new picolibc directory so
they are isolated from the main glibc code.
Pre-loading a pile of hacks
Adapt Picolibc to support the Glibc test code required a bunch of
random hacks, from providing _unlocked versions of the stdio macros
to stubbing out various unsupportable syscalls (like sleep and
chdir). Instead of modifying the Glibc code, I created a file called
hacks.h which is full of this stuff and used the gcc -include
parameter to read that into the compiler before starting compilation
on all of the files.
Supporting command line parameters
The glibc tests all support a range of command line parameters, some
of which turned out to be quite useful for this work. Picolibc had
limited semihosting support for accessing the command line, but that
required modifying applications to go fetch the command line using a
special semihosting function.
To make this easier, I added a new crt0 variant for picolibc called
(oddly) semihost. This extends the existing hosted variant by
adding a call to the semihosting library to fetch the current command
line and splitting that into words at each space. It doesn't handle
any quoting, but it's sufficient for the needs here.
Avoiding glibc headers
The glibc tests use some glibc-specific extensions to the standard
POSIX C library, so I needed to include those in the test
builds. Headers for those extensions are mixed in with the rest of the
POSIX standard headers, which conflict with the Picolibc versions. To
work around this, I stuck stub #include files in the picolibc directory
which directly include the appropriate headers for the glibc API
extensions. This includes things like argp.h and
array_length.h. For other headers which weren't actually needed for
picolibc, I created empty files.
Adding more POSIX to Picolibc
At this point, code was compiling but failing to find various standard
POSIX functions which aren't available in Picolibc. That included some
syscalls which could be emulated using semihosting, like
gettimeofday and getpagesize. It also included some generally
useful additions, like replacing ecvtbuf and fcvtbuf with ecvt_r
and fcvt_r. The _r variants provide a target buffer size instead
of assuming that it was large enough as the Picolibc buf variants
did.
Which tests are working?
So far, I've got some of the tests in malloc, math, misc and
stdio-common running.
There are a lot of tests in the malloc directory which cover glibc API
extensions or require POSIX syscalls not supported by semihosting. I
think I've added all of the tests which should be supported.
For the math tests, I'm testing the standard POSIX math APIs in both
float and double forms, except for the Bessel and Gamma
functions. Picolibc's versions of those are so bad that they violate
some pretty basic assumptions about error bounds built into the glibc
test code. Until Picolibc gets better versions of these functions,
we'll have to skip testing them this way.
In the misc directory, I've only added tests for ecvt, fcvt, gcvt,
dirname and hsearch. I don't think there are any other tests
there which should work.
Finally, for stdio-common, almost all of the tests expect a fully
functioning file system, which semihosting really can't support. As a
result, we're only able to run the printf, scanf and some of the
sprintf tests.
All in all, we're running 78 of the glibc test programs, which is a
small fraction of the total tests, but I think it's the bulk of the
tests which cover APIs that don't depend too much on the underlying
POSIX operating system.
Bugs found and fixed in Picolibc
This exercise has resulted in 17 fixes in Picolibc, which can be
classified as:
Math functions taking sNaN and not raising FE_INVALID and
returning qNaN. Almost any operation on an sNaN value is supposed
to signal an invalid operand and replace that with a qNaN so that
further processing doesn't raise another exception. This was
fairly easy to fix, just need to use return x + x; instead of
return x;.
Math functions failing to set errno. I'd recently restructured the
math library to get rid of the separate IEEE version of the
functions which didn't set errno and missed a couple of cases
that needed to use the errno-setting helper functions.
Corner cases in string/float conversion, including the need to
perform round-to-even for '%a' conversions in printf and
supporting negative decimal values for fcvt. This particular
exercise led to replacing the ecvtbuf and fcvtbuf APIs with
glibc's ecvt_r and fcvt_r versions as those pass explicit
buffer lengths, making overflow prevention far more reliable.
A bunch of malloc entry points were not handling failure
correctly; allocation values close to the maximum possible size
caused numerous numeric wrapping errors with the usual
consequences (allocations "succeed", but return a far smaller
buffer than requested). Also, realloc was failing to check the
return value from malloc before copying the old data, which really
isn't a good idea.
Tinystdio's POSIX support code was returning an error instead of
EOF at end of file.
Error bounds for the Picolibc math library aren't great; I had to
generate Picolibc-specific ulps files. Most functions are between
0 and 3 ulps, but for some reason, the float version of erfc
(ercf) has errors as large as 64 ulps. That needs investigation.
Tests added to Picolibc
With all of the fixes applied to Picolibc, I added some tests to
verify them without relying on running the glibc tests, that includes
sNaN vs qNaN tests for math functions, testing fopen and mktemp,
checking the printf %a rounding support and adding a ecvt/fcvt tests.
I also discovered that the github-based CI system was compiling but
not testing when using clang with a riscv target, so that got added
in.
Where's the source code?
The Picolibc changes are sitting on the
glibc-testing branch.
I'll merge them once the current CI pass finishes.
The hacked-up Glibc bits are in a glibc mirror at github in the
picolibc project on the
picolibc-testing branch.
It would be interesting to know what additional tests should be usable
in this environment. And, perhaps, finding a way to use this for
picolibc CI testing in the future.
Concluding thoughts
Overall, I'm pretty pleased with these results. The bugs in malloc
are fairly serious and could easily result in trouble, but the
remaining issues are mostly minor and shouldn't have a big impact on
applications using Picolibc.
I'll get the changes merged and start thinking about doing another
Picolibc release.
Here s my (twenty-ninth) monthly but brief update about the activities I ve done in the F/L/OSS world.
Debian
This was my 38th month of actively contributing to Debian.
I became a DM in late March 2019 and a DD on Christmas 19! \o/
I had been sick this month, so most of the time I spent away from system, recovering, et al,
and also went through the huge backlog that I had, which is starting to get smaller. :D
Anyway, I did the following stuff in Debian:
Uploads and bug fixes:
at (3.4.4-1) - Adding a DEP8 test for the package, fixing bug #985421.
Other $things:
Mentoring for newcomers.
Moderation of -project mailing list.
Ubuntu
This was my 13th month of actively contributing to Ubuntu.
Now that I joined Canonical to work on Ubuntu full-time, there s a bunch of things I do! \o/
I mostly worked on different things, I guess.
I was too lazy to maintain a list of things I worked on so there s
no concrete list atm. Maybe I ll get back to this section later or
will start to list stuff from the fall, as I was doing before. :D
Debian (E)LTS
Debian Long Term Support (LTS) is a project to extend the lifetime of all Debian stable releases to (at least) 5 years. Debian LTS is not handled by the Debian security team, but by a separate group of volunteers and companies interested in making it a success.
And Debian Extended LTS (ELTS) is its sister project, extending support to the Jessie release (+2 years after LTS support).
This was my twenty-ninth month as a Debian LTS and eighteenth month as a Debian ELTS paid contributor.
Whilst I was assigned 42.75 hours for LTS and 45.25 hours for ELTS, I could only work a little due to being sick and so
I spent 15.75 hours on LTS and 9.25 hours on ELTS and worked on the following things:
LTS CVE Fixes and Announcements:
Issued DLA 2909-1, fixing CVE-2021-45079, for strongswan.
For Debian 9 stretch, these problems have been fixed in version 5.5.1-4+deb9u6.
In 2008 I joined SAGE (the System Administrators Guild of Australia). It was a professional society for people doing sysadmin work (running computer servers). I quit when I found that the level of clue was lower than hoped and that members used the code of ethics as nothing but a way to score points in online debates. After quitting SAGE kept emailing me and wouldn t respect my request to be removed from all lists so I had to block their mail server.
SAGE has in recent times changed it s name to ITPA (Information Technology Professionals Association) and is still sending me email. I ve just sent yet another unsubscribe request.
How many years of sending unwanted email can be caused by incompetence and when should we assume it s malice? They have been doing this for over a decade now. Even if it s incompetence, that s still damning given that it s incompetence in the main topic of the organisation.
Here is the ITPA Code of Ethics [1], as you can see there is no reference to spam. The nearest seems to be I will continue to enlarge my understanding of the social and legal issues that arise in computing environments, and I will communicate that understanding to others when appropriate . So it s great that they aren t breaking their own code of ethics :-# but I d still like them to stop emailing me.
This is a bit of a sneak preview announcement since I'm waiting for the
ISC mirror to update before sending the official announcement to the
normal channels, but INN 2.6.5 has been released. (The release was
finalized a few days ago, and I'm a bit behind in posting it.)
This is a bug fix and minor feature release over INN 2.6.4, and the
upgrade should be painless. You can download the new release from
ftp.isc.org (once it updates) or
my personal INN pages. The latter also has
links to the full changelog and the other INN documentation.
As always, thanks to Julien LIE for preparing this release and doing most
of the maintenance work on INN!
Changes in this release:
A new step in INN development has been achieved with the migration of
the INN project to GitHub. We now make use of the features GitHub
provides: issue tracker, pull requests, continuous integration, a
user-friendly interface to browse the code, etc. Our Subversion
repository has therefore been migrated to Git, and our Trac tickets to
the GitHub issue tracker.
An up-to-date nocem.ctl file is provided with this release.
You should manually update your nocem.ctl file with the new
information recorded about NoCeM issuers, and make sure the right PGP
keys are present on your system.
Up-to-date control.ctl and moderators files are
provided with this release. You should manually update them (notably
for the fido7.* hierarchy).
Added a stricter validation of article numbers given in NNTP commands
so that numbers superior to 2^31 are correctly considered invalid.
Thanks to Richard Kettlewell for the patch.
Added a check in rc.news for the existence of the
pathrun directory. INN won't start until this directory is
writable. Previously, it bailed out quickly after starting, without
clear logs about why it failed.
Fixed parallel builds using make -j. Thanks to Richard
Kettlewell for the path.
nnrpd now properly gathers timer statistics when a
compression layer is active.
nnrpd now properly discards data received from a news client
after a timeout when a TLS layer is active. It previously tried to
read incoming data before closing the socket, leading to decoding
errors from an underlying compression or SASL layer.
innfeed and ovdb_stat now generate status reports in
valid HTML syntax.
Fixed a bug in the buffindexed overview that prevented it from working
on several systems, amongst them FreeBSD. Unsupported, and useless,
permission bits were given to semaphores.
Fixed the detection of library paths at configure time: multilib
directories (lib32 or lib64) are now also used if
they exist, even it the system does not use multilib. It will notably
fix the detection of the OpenSSL 3.0.0 library.
The tlscertfile parameter in inn.conf now permits
the use of a complete certificate chain, instead of necessarily having
to use tlscafile for additional certificates.
Added support for the new OpenSSL 3.0.0 API, which deprecated a few
functions.
The inn.conf default value for tlsprotocols no longer
contains TLS versions 1.0 and 1.1, which have been deprecated by RFC
8996.
A new inn.conf parameter has been added to tune the length of
the queue of pending connections to innd, nnrpd and
the ovdb overview storage method: the maxlisten
parameter now permits configuring their listen backlog, whose
previously hard-coded values were 128 for nnrpd and
25 for the others, which was not high enough for some uses.
The default value is now 128 for all of them, and configurable
in inn.conf. Thanks to Kevin Bowling for the patch.
The name of seven man pages for routines built in libinn(3) are now
prefixed with libinn_ so as not to consume namespace and
conflict with other packages (notably, the list(3) and uwildmat(3) man
pages are now named libinn_list(3) and libinn_uwildmat(3)).
Other minor bug fixes and documentation improvements, notably a
revised installation checklist and a section summarizing the most used
configuration at the beginning of a few complex man pages.
As of this morning, Rcpp stands at 2501 reverse-dependencies on CRAN. The graph on the left depicts the growth of Rcpp usage (as measured by Depends, Imports and LinkingTo, but excluding Suggests) over time.
Rcpp was first released in November 2008. It probably cleared 50 packages around three years later in December 2011, 100 packages in January 2013, 200 packages in April 2014, and 300 packages in November 2014. It passed 400 packages in June 2015 (when I tweeted about it), 500 packages in late October 2015, 600 packages in March 2016, 700 packages in July 2016, 800 packages in October 2016, 900 packages early January 2017, 1000 packages in April 2017, 1250 packages in November 2017, 1500 packages in November 2018, 1750 packages in August 2019, 2000 packages in July 2020, and 2250 package in March of last year. The chart extends to the very beginning via manually compiled data from CRANberries and checked with crandb. The next part uses manually saved entries. The core (and by far largest) part of the data set was generated semi-automatically via a short script appending updates to a small file-based backend. A (manually curated) list of packages using Rcpp is available too.
Also displayed in the graph is the relative proportion of CRAN packages using Rcpp. The four per-cent hurdle was cleared just before useR! 2014 where I showed a similar graph (as two distinct graphs) in my invited talk. We passed five percent in December of 2014, six percent July of 2015, seven percent just before Christmas 2015, eight percent in the summer of 2016, nine percent mid-December 2016, cracked ten percent in the summer of 2017, eleven percent in 2018 and passed 12.5 percent or one in every eight CRAN packages dependens on Rcpp along with the 2000 packages mark. Truly stunning. As before, there is more detail in the chart: how CRAN seems to be pushing back more and removing more aggressively (which my CRANberries tracks but not in as much detail as it could), how the growth of Rcpp seems to be slowing somewhat outright and even more so as a proportion of CRAN as one would expect a growth curve to.
The Rcpp team continues to aim for keeping Rcpp as performant and reliable as it has been (and see e.g.here for some more details). A really big shoutout and Thank You! to all users and contributors of Rcpp for help, suggestions, bug reports, documentation or, of course, code.
If you like this or other open-source work I do, you can now sponsor me at GitHub. For the first year, GitHub will match your contributions.
Welcome to the 36th post of the really randomly reverberating R, or R4 for short, write-ups. Today s post is about using Redis, and especially RcppRedis, for live or (near) real-time monitoring with R.
There is an saying that you can take the boy out of the valley, but you cannot the valley out of the boy so for those of us who spent a decade or two in finance and on trading floors, having some market price information available becomes second nature. And/or sometimes it is just good fun to program this.
A good while back Josh posted a gist on a simple-yet-robust while loop. It (very cleverly) uses his quantmod package to access the SP500 in real-time . (I use quotes here because at the end of retail broadband one is not at the same market action as someone co-located in a New Jersey data center. It is however not delayed: as an index, it is not immediately tradeable as a stock, etf, or derivative may be all of which are only disseminated as delayed price information, usually by ten minutes.) I quite enjoyed the gist and used it and started tinkering with it. For example, it collects data but only saves (i.e. persists ) it after market close. If for whatever reason one needs to restart recent history is gone. In any event, I used his code and generalized it a little and published this about a year ago as function intradayMarketMonitor() in my dang package. (See this blog post announcing it.) The chart of the left shows this in action, the chart is a snapshot from a couple of days ago when the vignettes (more on them below) were written.
As lovely as intradayMarketMonitor() is, it also limits itself to market hours. And sometimes you want to see, say, how the market opens on Sunday (futures usually restart at 17h Chicago time), or how news dissipates during the night, or where markets are pre-open, or . So I both wanted to complement this with futures, and also cache it locally so that, say, one machine might collect data and one (or several others) can visualize. For such tasks, Redis is unparalleled.
(Yet I also always felt Redis could do with another, simple, short and sweet introduction stressing the key features of i) being multi-lingual: write in one language, consume in another and ii) loose coupling: no linking as one talks to Redis via standard tcp/ip networking. So I wrote a new intro vignette that is now in RcppRedis. I hope this comes in handy. Comments welcome!)
Our RcppRedis package had long been used for such tasks, and it was easy to set it up. Standard use is to loop, fetch some data, push it to Redis, sleep, and start over. Clients do the same: fetch most recent data, plot or report it, sleep, start over. That works, but it has a dual delay as the client sleeping may miss the data update!
The standard answer to this is called publish/pubscribe, or pub/sub. Libraries such as 0mq or zeromq specialise in this. But it turns out Redis already has it. I had some initial difficulty adding it to RcppRedis so for a trial I tested the marvellous rredis package by Bryan and simply instantiated two Redis clients. Now the data getter simply publishes a new data point in a given channel, by convention named after the security it tracks. Clients register with the Redis server which does all the actual work of keeping track of who listens to what. The clients now simply listen (which is a blocking operation) and as soon as data comes in receive it.
This is quite mesmerizing when you just run two command-line clients (in a byobu session, say). As sone as the data is written (as shown on console log) it is consumed. No measruable overhead. Just lovely.
Bryan and I then talked a litte as he may or may not retire rredis. Having implemented the pub/sub logic for both sides once, he took a good hard look at RcppRedis and just like that added it there. With some really clever wrinkles for (optional) per-symbol callback as closure attached to the instance. Truly amazeballs And once we had it in there, generalizing from publishing or subscribing to just one symbol easily generalizes to having one listener collect and publish for multiple symbols, and having one or more clients subscribe and listen one, more or even all symbol. All with ease thanks tp Redis. The second chart, also from a few days ago, shows four symbols for four (front-contract) futures for Bitcoin, Crude Oil, SP500, and Gold.
As all this can get a little technical, I wrote a second vignette for RcppRedis on just this: market monitoring. Give this a read, if interested, feedback on this one is most welcome too! But all the code you need is included in the package just run a local Redis instance.
Before closing, one sour note. I uploaded all this in a new and much improved updated RcppRedis 0.2.0 to CRAN on March 13 ten days ago. Not only is it still not there , but CRAN in their most delightful way also refuses to answer any emails of mine. Just lovely. The package exhibited just one compiler warning: a C++ compiler objected to the (embedded) C library hiredis (included as a fallback) for using a C language construct. Yes. A C++ compiler complaining about C. It s a non-issue. Yet it s been ten days and we still have nothing. So irritating and demotivating. Anyway, you can get the package off its GitHub repo.
If you like this or other open-source work I do, you can sponsor me at GitHub.
Last week I received (finally) my Fairphone 4, supplied with a de-googled operating system, which I had ordered from the E Foundation s shop in December. (I m am very hard on hardware and my venerable Fairphone 2 is really on its last legs.)
I expect to have full control over the software on any computing device I own which is as complicated, capable, and therefore, hazardous, as a mobile phone. Unfortunately the Eos image (they prefer to spell it /e/ os , srsly!) doesn t come with a way to get root without taking fairly serious measures including unlocking the bootloader. Unlocking the bootloader wouldn t be desirable for me but I can t live without root. So.
I started with these helpful instructions: https://forum.xda-developers.com/t/fairphone-4-root.4376421/
I found the whole process a bit of a trial, and I thought I would write down what I did. But, it s not straightforward, at least for someone like me who only has a dim understanding of all this Android stuff. Unfortunately, due to the number of missteps and restarts, what I actually did is not really a sensible procedure. So here is a retcon of a process I think will work:
Unlock the bootloader
The E Foundation provide instructions for unlocking the bootloader on a stock FP4, here https://doc.e.foundation/devices/FP4/install and they seem applicable to the Murena phone supplied with Eos pre-installed, too.
NB tht unlocking the bootloader wipes the phone. So we do it first.
So:
Power on the phone, with no SIM installed
You get a welcome screen.
Skip all things on startup including wifi
Go to the very end of the settings, tap a gazillion times on the phone s version until you re a developer
In the developer settings, allow usb debugging
In the developer settings, allow oem bootloader unlocking
Connect a computer via a USB cable, say yes on phone to USB debugging
adb reboot bootloader
The phone will reboot into a texty kind of screen, the bootloader
fastboot flashing unlock
The phone will reboot, back to the welcome screen
Repeat steps 3-9 (maybe not all are necessary)
fastboot flashing unlock_critical
The phone will reboot, back to the welcome screen
Note that although you are running fastboot, you must run this command with the phone in bootloader mode, not fastboot (aka fastbootd ) mode. If you run fastboot flashing unlcok from fastboot you just get a don t know what you re talking about . I found conflicting instructions on what kind of Vulcan nerve pinches could be used to get into which boot modes, and had poor experiences with those. adb reboot bootloader always worked reliably for me.
Some docs say to run fastboot oem unlock; I used flashing. Maybe this depends on the Android tools version.
Initial privacy prep and OTA update
We want to update the supplied phone OS. The build mine shipped with is too buggy to run Magisk, the application we are going to use to root the phone. (With the pre-installed phone OS, Magisk crashes at the patch boot image step.) But I didn t want to let the phone talk to Google, even for the push notifications registration.
From the welcome screen, skip all things except location, date, time. Notably, do not set up wifi
In settings, microg section
turn off cloud messaging
turn off google safetynet
turn off google registration (NB you must do this after the other two, because their sliders become dysfunctional after you turn google registration off)
turn off both location modules
In settings, location section, turn off allowed location for browser and magic earth
Now go into settings and enable wifi, giving it your wifi details
Tell the phone to update its operating system. This is a big download.
Install Magisk, the root manager
(As a starting point I used these instructions https://www.xda-developers.com/how-to-install-magisk/ and a lot of random forum posts.)
You will need the official boot.img. Bizarrely there doesn t seem to be a way to obtain this from the phone. Instead, you must download it. You can find it by starting at https://doc.e.foundation/devices/FP4/install which links to https://images.ecloud.global/stable/FP4/. At the time of writing, the most recent version, whose version number seemed to correspond to the OS update I installed above, was IMG-e-0.21-r-20220123158735-stable-FP4.zip.
Download the giant zipfile to your computer
Unzip it to extract boot.img
Copy the file to your phone s storage . Eg, via adb: with the phone booted into the main operating system, using USB debugging, adb push boot.img /storage/self/primary/Download.
On the phone, open the browser, and enter https://f-droid.org. Click on the link to install f-droid. You will need to enable installing apps from the browser (follow the provided flow to the settings, change the setting, and then use Back, and you can do the install). If you wish, you can download the f-droid apk separately on a computer, and verify it with pgp.
Using f-droid, install Magisk. You will need to enable installing apps from f-droid. (I installed Magisk from f-droid because 1. I was going to trust f-droid anyway 2. it has a shorter URL than Magisk s.)
Open the Magisk app. Tell Magisk to install (Magisk, not the app). There will be only one option: patch boot file. Tell it to patch the boot.img file from before.
Transfer the magisk_patched-THING.img back to your computer (eg via adb pull).
adb reboot bootloader
fastboot boot magisk_patched-THING.img (again, NB, from bootloader mode, not from fastboot mode)
In Magisk you ll see it shows as installed. But it s not really; you ve just booted from an image with it. Ask to install Magisk with Direct install .
After you have done all this, I believe that each time you do an over-the-air OS update, you must, between installing the update and rebooting the phone, ask Magisk to Install to inactive slot (after OTA) . Presumably if you forget you must do the fastboot boot dance again.
After all this, I was able to use tsu in Termux. There s a strange behaviour with the root prompt you get apropos Termux s request for root; I found that it definitely worked if Termux wasn t the foreground app
You have to leave the bootloader unlocked. Howwever, as I understand it, the phone s encryption will still prevent an attacker from hoovering the data out of your phone. The bootloader lock is to prevent someone tricking you into entering the decryption passkey into a trojaned device.
Other things to change
Probably, after you re done with this, disable installing apps from the Browser. I will install Signal before doing that, since that s not in f-droid because of mutual distrust between the f-droid and Signal folks. The permission is called Install unknown apps .
Turn off instant apps aka open links in apps even if the app is not installed . OMG WTF BBQ.
Turn off wifi scanning even if wifi off . WTF.
I turned off storage manager auto delete, on the grounds that I didn t know what the phone might think of as having been backed up . I can manage my own space use, thanks very much.
There are probably other things to change. I have not yet transferred my Signal account from my old phone. It is possible that Signal will require me to re-enable the google push notifications, but I hope that having disabled them in microg it will be happy to use its own system, as it does on my old phone.