logo Blog feeds

HookraceQuest for the Lost Home Server

Today I lost access to my home server. As I described in a previous post I depend heavily on the server to fetch my emails, as a file server, to synchronize files, for newsbeuter and irssi sessions and many other things. As no one was going to be in proximity of the server for the next few hours, my goal for today was to solve the problem remotely.

The symptom was that my SSH connection attempts failed. The server also didn’t respond to pings. As the server is sitting at home behind a regular DSL connection it uses a dynamic IP address that is shuffled every 24 hours. So my first hunch was that the daily reconnect might just have happened at a different time today and I gave the server some time to broadcast its new IP address to my domain registrar.

After about an hour I still couldn’t connect, so I started investigating. Maybe the API of the domain registrar changed (as happened before) or my script failed for another reason? I know that my home server does nightly backups of the other servers I run. So I connected to one of them and checked the journalctl log. To my surprise no connection from the server happened last night. My worst fear was that the server was hanging due to a hardware problem, as I ran into similar problems with this Intel Bay Trail CPU before. (The issue seems to be that Intel underdesigned the power delivery on those systems, which the graphics driver is trying to work around.)

But I wasn’t ready to give up yet, so I tried to think of any other activities the server would do that might leave a trace. I found out that my email hoster doesn’t provide easy access to the IP addresses that access the mailbox. I couldn’t think of any other traces at the time, but next time I might check if my IP address is visible on some IRC server.

As a last resort I remembered that my ISP usually gives me quite similar IP addresses, so I used whois on yesterday’s IP address to see how large the subnet is. I got back a subnet of only 2¹⁴ addresses, which seemed reasonable enough to scan. I hope the ISP is not too mad at me for such a small port scan, but to reduce the impact I also told nmap to only scan the specific SSH port that I use.

After about 5 minutes I had found a single server responding on my custom SSH port, which was indeed my home server. After logging in and checking out the system I noticed the (usual) problem of cronie being unable to spawn new processes after a glibc update. So I simply restarted cronie to fix the problem.

I still wish that Arch Linux will one day tell me which running executables to restart after a system upgrade, as SLES does, to prevent problems like this in the future. I think the general approach is just to check which process references deleted shared libraries. Something like this, similar to here:

ps axh -o pid | while read PID; do grep ".so" /proc/$PID/maps | grep "(deleted)" && echo "$PID" && sed -e "s/\x00/ /g" < /proc/$PID/cmdline && echo "\n"; done

Nim BlogVersion 1.0 released

Today is the day. The Nim Team is very proud and happy to announce the much-anticipated version 1.0 of the language.

Nim has always been focused on providing a compiled statically typed language focusing on efficiency, readability and flexibility.

Version 1.0 marks the beginning of a stable base which can be used in the coming years, knowing that the future versions of Nim won’t break the code you have written with the current version.

Nim has built a warm and welcoming community which is ready to help newcomers to the language.

If you are one of the new users, check out our learning resources and try Nim in our playground.

This release includes many changes, including bug fixes and some language additions. All changes are documented in the v1.0.0 changelog available here. Included as well is the latest release of Nimble, v0.11.0, the changelog for which is available here.

The stability guarantee

Version 1.0 is now a long-term supported stable release that will only receive bug fixes and new features in the future, as long as they don’t break backwards compatibility.

The 1.0.x branch will receive bug fixes for as long as there is demand for them. New features (which do not break backwards compatibility) will continue in steadily advancing 1.x branches.

Our goal is to make sure that code which compiled under Nim 1.0 continues to compile under any stable Nim 1.x version in the future.

What is included under the stability guarantee?

Backwards compatibility covers only the stable fragment of the language, as defined by the manual.

The compiler still implements experimental features which are documented in the “experimental manual”. These features are subject to changes which may be backwards incompatible; some of the features included under this umbrella are concepts, the do notation and a few others. There are also modules in the stdlib which are still considered unstable - these have been marked with an “Unstable API” in their docs.

You can use experimental features, even in production, but be aware that these are not as fleshed out as we would like them to be.

Exceptions to the rule

We of course have to concede that there are exceptions. In certain serious cases, for example if a security vulnerability is discovered in the standard library, we reserve the right to break code which uses it.

Installing Nim 1.0

New users

Check out if the package manager of your OS already ships version 1.0 or install it as described here.

Existing users

If you have installed a previous version of Nim using choosenim, getting Nim 1.0 is as easy as:

$ choosenim update stable

Contributors

Over the years, more than 500 people contributed to the Nim codebase, implementing new features, fixing bugs and issues, writing documentation, and so on. The Nim team would like to thank all of you who helped us build Nim to become what it is today.

We would also want to thank all people who have created Nimble packages, extending what is possible to do with Nim. The number of Nimble packages has been steadily growing, and in August 2019 we broke the 1000 package milestone! We are optimistic that with this release we will see even bigger growth of new and exciting packages.

If you would like to help Nim grow consider donating via Open Collective or other services.

Nim BlogVersion 0.20.2 released

The Nim team is happy to announce version 0.20.2, which is our second release candidate for version 1.0.

To read more about version 0.20 and our plans for version 1.0 and beyond, check the previous release notes. This is mostly a bugfix release of version 0.20.0 (1.0 RC1).

The only new feature is that toOpenArray, our slicing operator, is now available for the JavaScript backend.

Although this release comes only one month after a previous release, it has over 200 new commits, fixing over 70 reported issues and bringing lots of improvements which should make Nim even more stable.

Style checks

Since version 0.20.0 we improved our style checker to the point that Nim now bootstraps with --styleCheck:error flag, meaning that the compiler and the standard library are now style checked and they won’t compile if different styles (e.g. fooBar and foo_bar) are used.

If you would like to only style check your own nimble package, but not its dependencies, you can use --styleCheck:hint, making your package consistent while still retaining perfect interoperability with all other Nim code in the wild.

Nimpretty

One of the areas which we focused on for this release is our nimpretty tool – it is a Nim source code beautifier, to format code according to the official style guide (NEP-1). More than 30 commits were made aiming to improve nimpretty experience and to make it more robust for real-world scenarios. Nimpretty version 0.2 ships with Nim, and we invite you to give it a try.

New runtime

The new runtime is progressing nicely but it is off the critical path for version 1.0 as it’s an opt-in feature. The next significant milestone is to make the new runtime work with async. Only after this is accomplished we can push for more adoption of it.

Installing 0.20.2

If you have installed a previous version of Nim using choosenim, getting Nim 0.20.2 is as easy as:

$ choosenim update stable

If you don’t have it already, you can get choosenim by following these instructions or you can install Nim by following the instructions on our install page.

Changes affecting backwards compatibility

  • All strutils.rfind procs now take start and last like strutils.find with the same data slice/index meaning. This is backwards compatible for calls not changing the rfind start parameter from its default. (#11487)

    In the unlikely case that you were using rfind X, start=N, or rfind X, N, then you need to change that to rfind X, last=N or rfind X, 0, N. (This should minimize gotchas porting code from other languages like Python or C++.)

  • On Windows stderr/stdout/stdin are not opened as binary files anymore. Use the switch -d:nimBinaryStdFiles for a transition period.

Breaking changes in the standard library

  • Mac OS X / BSD: TSa_Family is now the uint8 type, so type conversions like x.sin_family = uint16 toInt(nativesockets.AF_INET) need to be changed into x.sin_family = TSa_Family toInt(nativesockets.AF_INET).

Library additions

  • toOpenArray is now available for the JS target.

Library changes

  • Fix async IO operations stalling even after socket is closed. (#11232)

  • More informative error message for streams.openFileStream. (#11438)

Compiler changes

  • Better error message for IndexError for empty containers. (#11476)

  • Fix regression in semfold for old right shift. (#11477)

  • Fix for passing tuples as static params to macros. (#11423)

Bugfixes

  • Fixed “nimpretty goes crazy with this snippet” (#10295)
  • Fixed “nimpretty doesn’t trim all whitespace on the right side of an export marker” (#10177)
  • Fixed “nimpretty gives invalid indentation to array elements” (#9505)
  • Fixed “nimpretty doesn’t indent correctly if preceding line ends with ;, { etc” (#10159)
  • Fixed “Nimpretty wrong indentation for doc comments” (#10156)
  • Fixed “HttpClient Documentation needs Proxy example” (#11281)
  • Fixed “nimpretty aligns comment annoyingly” (#9399)
  • Fixed “ENDB missing from Docs and TheIndex, remove ENDB from –fullhelp” (#11431)
  • Fixed “Nimrod on Documentation generator” (#11460)
  • Fixed “nimpretty (de)indents code where it shouldn’t” (#11468)
  • Fixed “nimpretty adds spaces where it shouldn’t” (#11470)
  • Fixed “nimpretty formats enums differently based on commas” (#11467)
  • Fixed “strutils.rfind start parameter is unecessarily unusual” (#11430)
  • Fixed “TinyC is not documented” (#11495)
  • Fixed “c2nim missing from 0.20.0” (#11434)
  • Fixed “nimsuggest doesn’t work unless compiled with -d:danger” (#11482)
  • Fixed “random.initRand crashes in Nim 0.20.0 JS backend” (#11450)
  • Fixed “0.20.0 fails to bootstrap when passing “–verbosity:2” (or 3) to koch” (#11436)
  • Fixed “Destructors lifting doesn’t work with inheritance” (#11517)
  • Fixed “std/sums missing from TheIndex” (#11543)
  • Fixed “sequtils module: link is broken” (#11546)
  • Fixed “Case Statement Macros do not work in functions above exported functions.” (#11556)
  • Fixed “newruntime: internal error when initializing a proc variable” (#11533)
  • Fixed “newruntime: error when modifying a sequence” (#11524)
  • Fixed “fmod and other math module functions are missing in js mode” (#4630)
  • Fixed “Object variants and new runtime” (#11563)
  • Fixed “newruntime exceptions” (#11577)
  • Fixed “nimpretty is not aware that the next line is a part of the same context” (#11469)
  • Fixed “Distinct procs fail to compile” (#11600)
  • Fixed “[SharedTables] Error: undeclared identifier: ‘defaultInitialSize’” (#11588)
  • Fixed “newSeqOfCap is not working in newruntime” (#11098)
  • Fixed “nimpretty destroys source with a source code filter” (#11532)
  • Fixed “Unexpected behaviour when constructing with result” (#11525)
  • Fixed “Regression in 0.20.0: Nested proc using outer scope variable fails to compile” (#11523)
  • Fixed “os:standalone Error: redefinition of ‘nimToCStringConv’ “ (#11445)
  • Fixed “No ambiguity error on field overloaded by field=” (#11514)
  • Fixed “object variants and new runtime part 2” (#11611)
  • Fixed “seq Error: unhandled exception: value out of range: 32772 “ (#11606)
  • Fixed “Compiled binary includes full path to internal nim files” (#11572)
  • Fixed “Newruntime: top-level string variable is empty after an array assignment” (#11614)
  • Fixed “Newruntime: raise ObjContructor() doesn’t compile” (#11628)
  • Fixed “Owned ref can be copied and causes double-free” (#11617)
  • Fixed “When compiling to JS (in -d:release) output contains toolchain path on dev’s machine” (#11545)
  • Fixed “wrong unicode string output” (#11618)
  • Fixed “unittest “generic instantiation too nested” error” (#11515)
  • Fixed “Last read of a var parameter generates sink instead of assignment” (#11633)
  • Fixed “const table with proc type does not compile anymore” (#11479)
  • Fixed “Can’t use offsetOf on object that ends with an UncheckedArray” (#11320)
  • Fixed “Newruntime/regression: Bad codegen for inline methods” (#11636)
  • Fixed “String or sequences inside a loop are not cleared in each iteration” (#11510)
  • Fixed “Nim -v doesn’t acknowledge new danger flag” (#11484)
  • Fixed “SIGSEGV while compiling when trying to instantiate a case type, that uses an enum with non-zero start” (#11585)
  • Fixed “Compile-time usage of parts of strutils fails when using -d:useNimRtl” (#8405)
  • Fixed “regression(0.20): finally block executed twice in VM” (#11610)
  • Fixed “exportc symbol not exported, leading to link error” (#11651)
  • Fixed “Render bug: opearator priority can be wrong for second argument” (#11662)
  • Fixed “Nim & C disagree on type size” (#6860)
  • Fixed “Spawn passes refs across threads” (#7057)
  • Fixed “BUG: “varargs[string, $]” calls $ n^2 times instead of n times (n=len(varargs))” (#8316)
  • Fixed “Problem with the same name for module and exported type” (#3333)
  • Fixed “–gc:go does not work anymore” (#11447)
  • Fixed “Error: inconsistent typing for reintroduced symbol” (#11494)
  • Fixed “Auto generated destructors for tuples/objects fail with “non-trivial” error…” (#11671)
  • Fixed “Regression: parameter default value + typedesc parameter causes compiler crash” (#11660)
  • Fixed “newruntime: undetected dangling ref” (#11350)
  • Fixed “Newruntime: setLen() not working on sequences of owned refs” (#11530)
  • Fixed “Incorrect overflow/underflow error in case statements” (#11551)
  • Fixed “cgen preprocessor directive placed after struct declaration” (#11691)
  • Fixed “continue in an except Exception as e block crashes the compiler.” (#11683)
  • Fixed “nimsuggest, nim check segfault when using bindSym and doAssert” (#10901)
  • Fixed “Nimpretty issue, multiline string of x length only causes output grow every time.” (#11700)
  • Fixed “Array indexed by distinct int doesnt work with iterators” (#11715)

Footnotes