Linux distributions include a C standard library, which allows programs written in C to use the standard library features (like printf() and <limits.h>), talk to the kernel without directly using syscalls, and so on. Glibc is the most common implementation used on Linux, though there are others such as musl (used in Alpine), llvm-libc (by the LLVM project), dietlibc and uclibc (for embedded systems). Windows and BSDs have their own implementations of a C standard library, of couse. ...
Collecting dumps; under the hood
Or how dotnet-dump collect works on Linux If you are trying to diagnose the behaviour of a mis-behaving application in production, one option is to use the dotnet-dump tool to get a memory dump of the application so you can study it offline. With a dump, you can get stack traces, look at all the threads and even dig through the entire heap offline. But how does dotnet-dump actually work? This post will try and summarize what I found as I tried digging through what dotnet dump collect does under the hood. ...
Using .NET with OpenSSL in CentOS Stream 9
Or, how to deal with error:0E07607: configuration file routines…. TLDR: # Only for .NET 5 or .NET Core 3.1 sudo dnf install -y compat-openssl11 export OPENSSL_CONF=/etc/pki/openssl11.cnf dotnet whatever Introduction How do you get .NET applications - whether the SDK/runtime itself or a self-contained application - working on RHEL 9? Generally, this should be a walk in the park. .NET is a cross platform runtime. It explicitly supports RHEL. There shouldn’t be any surprises here. ...
Why is hash(-1) == hash(-2) in Python?
While browsing Reddit the other day waiting for my code to compile, I ran across this question on r/Python: is hash(-1) == hash(-2) an easter egg? Wait, is that really true? $ python Python 3.9.6 (default, Jun 29 2021, 00:00:00) [GCC 11.1.1 20210531 (Red Hat 11.1.1-3)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> hash(-1) -2 >>> hash(-2) -2 >>> hash(-1) == hash(-2) True Yes, it is. How surprising! Let’s check some other common hash values: >>> hash(1) 1 >>> hash(0) 0 >>> hash(3) 3 >>> hash(-4) -4 All small numbers seem to hash to themselves, except -1… ...
Build .NET and avoid prebuilts: Bootstrapping .NET in Fedora
Why Bootstrap? Compiling code is supposed to be straightforward: you run a compiler over the code and the compiler gives you back an executable program. But what do you do if there’s no compiler? That’s the dilemma .NET runs into in Fedora. Every release of .NET (Core) needs a recent version of a .NET (Core) SDK that can be used to build it. But that’s exactly what’s missing and what we are trying to build. ...
.NET Core Symbols on Fedora
Have you ever tried to debug a .NET application and seen errors saying debug information or debug symbols are not available? What are debug symbols? Where are they used? When would you need them? How do you get them? This post will try to resolve confusion by calling out things you absolutely need to know about them. What are debug symbols? Source code contains a lot of information that’s not strictly part of it’s functionality. It contains human readable names, including names of types, classes, methods and local variables. It contains lines of code in an order that (hopefully!) makes it possible to understand what is happening in order. ...
What is this GLIBCXX error?
If you use enterprise or stable Linux distributions, sooner or later you will see an error like this: app: /lib64/libc.so.6: version `GLIBC_3.1.45' not found (required by ./app) Or like this: app: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./app) The application (or library) itself will vary. The path to the libc or libstdc++ might vary too. But the error will always mention that a GLIBCXX or GLIBC version was not found. ...
Variables and Environment Variables In Bash
Most programming languages make heavy use of ordinary variables. They also (generally) support using environment variables. Shells like bash - also heavily used for writing shell scripts - have a slightly different audience in mind than normal programming languages. They make heavy use of environment variables. So much so that it can sometimes become blurry whether something is a normal variable or an environment variable. In this post, I will dig into variables and environment variables in shell, particularly bash, to help you understand how to distinguish the two and when to use them. ...
The magic of file
Ever wonder how file(1)1 works? After reading this post, you should understand all about file and its underpinnings. file Using the file tool is quite simple. It’s just file file-name-1. You can call it with multiple arguments too. Here’s a few examples of running it on my system. $ file document.pdf document.pdf: PDF document, version 1.4 $ file image.jpg image.jpg: JPEG image data, Exif standard: [TIFF image data, big-endian, direntries=7 ...orientation=upper-left, datetime=2019:10:30 21:44:30, width=1740], baseline, precision 8, 2017x961, components 3 $ file video.mp4 video.mp4: ISO Media, MP4 v2 [ISO 14496-14] $ file notes.org notes.org: UTF-8 Unicode text, with very long lines $ file /dev/video0 /dev/video0: character special (81/0) You can already see a few things: ...
What is nuget restore doing?
Ever wonder what nuget or dotnet restore is doing? What feeds it using? Or what nuget.config it is using to find feeds? Turns out you can find out what nuget-related information dotnet restore by looking at the logs. Generally, dotnet restore is succinct. Restoring a HelloWorld project gives us little information about what’s going on: $ dotnet new console --no-restore The template "Console Application" was created successfully. $ dotnet restore Restore completed in 72.1 ms for /home/omajid/cliche/dotnet/HelloWorld/HelloWorld.csproj. If we add a nuget.config file, we still see little information. Not even enough to know if it’s even being used: ...