hisham hm

🔗 htop 2.0 released!

This week I finally released htop 2.0.0!

  • htop-2.0.0.tar.gz
  • MD5 06f76c7d644ce8ae611c9feb10439a30
  • SHA-256 d15ca2a0abd6d91d6d17fd685043929cfe7aa91199a9f4b3ebbb370a2c2424b5

What’s new in htop 2.0

Since version 2.0, htop is now cross-platform!
Check out the video and slides of my presentation at FOSDEM 2016
about how this came to be. This release includes code supporting Linux, FreeBSD, OpenBSD and Mac OS X.

There are also, of course, some new features:

  • If you’re using NCurses 6, htop will also support your mouse wheel for scrolling.
  • Moving meters and columns around in the setup screen is a lot more comfortable now.
  • You can now press “e” to see the set of environment variables for a process.
  • The “graph” mode for meters was revamped, inspired by James Hall’s vtop.

…And of course, lots of other tweaks and fixes!


The changelog with the main new changes follows below. Special thanks
to everyone who contributed for this release, through bug reports, bug
fixes, new features and financial support for the platform abstraction
layer project!

  • Platform abstraction layer
  • Initial FreeBSD support
  • Initial Mac OS X support
    (thanks to David Hunt)
  • Swap meter for Mac OSX
    (thanks to Ștefan Rusu)
  • OpenBSD port
    (thanks to Michael McConville)
  • FreeBSD support improvements
    (thanks to Martin Misuth)
  • Support for NCurses 6 ABI, including mouse wheel support
  • Much improved mouse responsiveness
  • Process environment variables screen
    (thanks to Michael Klein)
  • Higher-resolution UTF-8 based Graph mode
    (Thanks to James Hall from vtop for the idea!)
  • Show program path settings
    (thanks to Tobias Geerinckx-Rice)
  • BUGFIX: Fix crash when scrolling an empty filtered list.
  • Use dynamic units for text display, and several fixes
    (thanks to Christian Hesse)
  • BUGFIX: fix error caused by overflow in usertime calculation.
    (thanks to Patrick Marlier)
  • Catch all memory allocation errors
    (thanks to Michael McConville for the push)
  • Several tweaks and bugfixes
    (See the Git log for details and contributors!)

🔗 How to make a pull request on GitHub - a quick tutorial

So you made changes to a project — a bugfix or maybe a new feature — and you want to send it for inclusion in the official (“upstream”) sources. Perhaps you sent an email or opened an issue in the bugtracker, and the project maintainers asked you to send a Pull Request (PR) on GitHub. But how to do this? Here’s a quick how-to guide!

Step 0 - Have a GitHub account

Before anything, you need to have a GitHub account! If you don’t have one already, go to github.com and sign up. Just follow the instructions, it’s easy and free.

Step 1 - “Fork the repository”

“Forking a repository” on GitHub means creating your own Git repository, which is a copy of the original.

Let’s visit a repository and fork it. Start by visiting https://github.com/hishamhm/pull-request-tutorial

In the upper-right there’s a button named “Fork”. It also shows a number: how many times this repository was forked by other people).

Press it, and it will create your own copy of the pull-request-tutorial repository, at https://github.com/YOUR_USERNAME/pull-request-tutorial (the real URL will, of course, contain your own username).

Step 2 - Download your fork and create a branch

Now, it’s time for you to make your changes in the source code (your bugfix or new feature). Start by downloading your repository to your computer. Go to the terminal, make sure git is installed in your computer and type:

git clone https://github.com/YOUR_USERNAME/pull-request-tutorial.git

This will download the files and create a directory called pull-request-tutorial that is linked to your fork (i.e. the copy of the repository under your control).

To avoid trouble later, let’s create a new “branch” in our repository so that the work on our bugfix or feature is stored separately. Pick a meaningful name that represents the changes you plan to make in your code. In our example, I’ll call it “fix-typo”:

git checkout -B fix-typo

Step 3 - Make your changes in your fork

Now enter the directory of your local fork, and edit it at will, implementing your bugfix or feature.

If you create a new file, remember to add it with git add:

git add new_file.txt

Commit your changes, adding a description of what was added. If you’re not used to Git, the simplest way is to commit all modified files and add a description message of your changes in a single command like this:

git commit -a -m "Fix typo in README file"

(But there are lots of ways to choose which files (and even parts of files) do commit and edit the commit message. Look for the Git documentation for details.)

Once your changes are committed, “push” the changes: send them to your GitHub repository using git push

git push

(The first time you push from a branch, Git will complain that your local branch in your computer is not connected to a branch in the GitHub server. Just do what the command tells you to do:

git push --set-upstream origin fix-typo

Next time you push again to this repository, just “git push” will do fine.)

Now, when you visit https://github.com/YOUR_USERNAME/pull-request-tutorial again, you should see your changes there.

Step 4 - Make the Pull Request

This is the simplest step! In your repository page, the next time you open the page after pushing to a new branch, there’s a big green button saying “Compare & pull request”. Press it!

This will open a page in which you’ll be able to further edit the description for your proposed changes. Write down a nice report explaining why these changes should be included in the official sources of your project, and then confirm.

The project authors will receive an email notification that you sent them a PR. Then it’s their turn to read it and comment. You will get notifications when they comment. If they suggest any changes to your bugfix or feature, go back to Step 3, edit it and push again: your Pull Request will be automatically updated. If they are happy with the changes and want to integrate your contributions to the project, the maintainers will click “Merge” and your code will become part of the original repository!

If you want to give it a try, feel free to use the repository I created for this tutorial: https://github.com/hishamhm/pull-request-tutorial

Fork it, edit it, commit and push your changes and send me a PR!

If you liked this tutorial, leave a star on its repo. :)

🔗 A story of violence and gender

[Even though the title foretells its content, I’ve been advised to add a trigger warning at the top of this post. It doesn’t hurt to be careful.]

It’s been a few days that I’ve been meaning to write this. I even discussed with a friend two days ago about when would be a good time. Emma Watson’s speech on gender equality yesterday (transcript and video) inspired me to go for it: “if not now, when?”.

I want to touch a delicate subject, which she brought up masterfully: how gender inequality works on men.

The story of any oppression is that of three roles: a mass of oppresed ones; a few who oppress them; and a mass who turns a blind eye, who are oppressors by proxy. This is the story of racism, of religious discrimination, and so on. Ms. Watson’s speech shines a light that the issue of gender equality is even more complex than that. Men are hurting women, and also hurting themselves in the process.

What made me want to write this was something that happened last week. I was with two friends, a guy and a girl, at a bar in a foreign country. (It was in Russia, but it could have been anywhere.) A disgusting scene happened. I didn’t see it firsthand, but the girl who was with us was looking straight at it, so I’ll reproduce her report:

At one point the guy who seemed to be the manager started to harass the waitress, just like that, in front of anyone. She froze. And so did I. She stood still in front of the counter while the man held her from behind rubbing his penis violently against her ass. I watched, petrified. I zoned out of my friends’ conversation. The pleasant look in the girl’s face was gone. After he let her go, I tried to approach her in another corner of the bar. The manager went to annoy two other women who were customers. One of them pulled her arm so he’d let her go. And they stayed in the bar! In the corner of the bar I asked the waitress [using Google Translator] if he was her boyfriend and if she was okay. She didn’t speak English, didn’t answer and just said “it’s okay, it’s okay.”

Of course it was not okay. My friend shared her concern with us. Dismayed as we were with it, our only reaction was to express our impotence with the situation. The reflex instinct of being part of “the mass who turns a blind eye”. We think ourselves better because we don’t do such things (and we probably are). Still, being “oppressors by proxy” is not a place we’re proud to be. Our sense of impotence, however, was very much real.

We said “What can we do?”. She said, “I don’t know, if he does it again I’ll make a scene in this place! A scandal!” Then I said “Women have that option.” I didn’t mean to sound rude, but that’s true. The way things work with men is that if we were to confront the (shirtless, tattooed, long-haired) guy, things would soon go violent. We told our friend: “What can we do? Get into a fist fight in a foreign country?” Her reaction was “Oh, men.”

This story highlights a less-discussed aspect in gender inequality. The prevailing rule of male violence serves not only to harm women, but also to stop other men from taking action. My male friend and I, we both knew we were under an unspoken law that if we were to do something, things would get violent.

(A flashback: The only time in my adult life that I got in a fist fight was years ago, also in Eastern Europe. I was walking down a street with a group of friends. Some guys across the street started yelling at the only woman in our group. She yelled back. They crossed the street and went for her. We stood in the way and it quickly got ugly. I think eventually someone shouted “police” and they ran away. One thing that strikes me from that story is that I’ve rarely retold it, and I’ve never seen any of my friends telling it. Men get ashamed of getting in a fight like that, even if it was for standing up for a woman. The other guys probably just made jokes about beating up some foreigners the next day.)

Back to last week’s story, we all felt the waitress really just meant “please don’t get into this”. Still, I wanted to think of something to do. If were we in our home country, we’d know how to report the manager in a safe way. We didn’t know if he owned the place, if anything we did would just get her fired, or worse. All these things crossed my mind.

We evidently didn’t want to stay in that place and give them any more money, so we spoke of leaving. We were waiting for a local friend, and I could just message him saying we had to leave. Then I told my friend “No, let’s wait for my friend and then we’ll explain him what happened and ask him to talk to her in Russian.” She replied, “Good idea.”

As soon as he arrived I told him the story, and that we wanted him to talk to the waitress about what happened before leaving. He seemed surprised; both with what happened and with our seriousness about it. We called her to our table. My Russian friend talked to her, and she told him that he was her boss, not a boyfriend, that he was “like that” but that it was “okay”. Before leaving the waitress went to my friend and repeated to her “it’s okay, it’s okay”, but her sad look said otherwise.

Even if she did think that enduring that guy was “just part of the job”, I hope that our concern reminded her that no, it’s not okay. And if she already felt it’s not okay (as I think she did), now she knows she’s not alone in thinking that, and that she’s not invisible. I’m very proud of my friend for reaching out for her, and shaking us up to do the same. The next day I had a long conversation about it in the airplane with my male friend who was there. These things matter.

We can’t fight gender inequality only by having women to stand up to men. Men have to stand up against inequality as well. And by “standing up” I don’t mean picking up fights. That is only reinforcing the gender stereotype. It’s a matter of redefining gender roles. I feel that society is slowly making progress (though clearly not at the same pace everywhere), but it’s a struggle into which both women and men need to take part. We men have to learn how.

🔗 That constant background noise in the head

I just came to an interesting realization. In this World Cup, since I’m watching so many games in Globo TV, Brazil’s main network, a side effect is that it’s been a long time that I didn’t watch so many commercial breaks, and so many times the same ads. Each ad individually doesn’t bother me that much. Many of them are even fun. But realizing this constant repetition — with its jingles and slogans echoing in my head — is very uncomfortable.

That got me thinking now of people who watch, for example, telenovelas (or series on network TV), or the same nightly news, every day, six days a week… watching the same commercials. It’s only now that I got unused to watch commercials, that I realize the dimension of this constant background noise in the mind that they are.

Whenever I see someone browsing the internet in a computer without an ad-blocker installed, I have this same shock. I’m reminded of what the internet actually looks like. People are apparently “anesthesized” to watch sites full of ads. When I point this out to them and I recommend an ad-blocker, they say they “don’t really notice” or that it “doesn’t bother” them. But I personally doubt it has no effect (or else a company like Google would be multibillionare based on ads, as it is).

This all makes me, at the same time, a bit happy for myself, as I realize that I found a way to live free from some of these sources of mental noise, but sad for remembering that this noise is so widespread.

🔗 Migrating my projects from SourceForge+Subversion to Github+Git

It’s been a while that I’ve been using Git comfortably — even though I still get stumped now and then, the workflow is much better than Subversion. I do finer grained commits with ease and I’m no longer afraid of making branches. Still, some projects of mine are still hosted in svn servers, mostly due to inertia and because they’re mostly single-person projects with the occasional patch and bug report but not much collaboration. For a more “social” project such as LuaRocks, git and Github have proven to be very useful tools.

Farewell to SourceForge

This, however, was the push I needed to move my projects away from SourceForge. From gimp.org:

In the past few months, we have received some complaints about the site where the GIMP installers for the Microsoft Windows platforms are hosted.

SourceForge, once a useful and trustworthy place to develop and host FLOSS applications, has faced a problem with the ads they allow on their sites - the green “Download here” buttons that appear on many, many adds leading to all kinds of unwanted utilities have been spotted there as well.

The tipping point was the introduction of their own SourceForge Installer software, which bundles third-party offers with Free Software packages. We do not want to support this kind of behavior, and have thus decided to abandon SourceForge.

From now on, Jernej Simončič, who provides the installer packages, uploads them to our FTP directly, and from there they will be distributed automatically to our mirrors. Please check Downloads page for updated information. http://gimp-win.sourceforge.net will remain active for the time being and direct users to the new download locations.

This saddens me a lot. I’ve been a SourceForge user for over 13 years. Having my first project there with a “.sourceforge.net” URL was a moment of pride; I felt I was becoming a free software developer “for real”, seeing my code there along with all those other projects I relied on daily, such as GIMP.

htop, in particular, has lived a beautiful life in SourceForge:

It blows my mind to think that these are direct downloads of the source code only. I assume the vast majority of users install htop running the distro package manager (apt-get, yum, etc.) but I have absolutely no way to estimate how many times this program has been installed. And that’s not only okay, it’s beautiful: it’s the nature of free software, the actual freedom, at work. There is no tight grip on users from a central authority, the code is roaming free in what is essentially a network of solidarity. I’ve certainly benefited from this network much more than I’ve contributed to it, but I’m happy to give a small part.

Another achievement I’m very proud of: a perfect 5-star rating score for htop. Surely not that many reviews when compared to really big projects, but it’s noteworthy to me at least, and I’m thankful to everyone who rated.

So, thanks for everything SourceForge, but it looks like it’s time to move on.

Say hello to Github, htop

I’ve already got a bunch of projects in Github so this change should not be traumatic.

I’m converting the repositories to Github and moving the website to my own domain. I’ve started with dit, which is a low-profile project, and everything went smoothly. So it’s time to do the same with htop.

The process is straightforward:

  1. Here are the Instructions for importing from Subversion from Github
  2. They recommend using svn2git. It took me a few tries to get the conversion perfect. I recommend taking a look at the generated repository with gitk and creating a file called ~/.svn2git/authors containing aliases matching your svn usernames with Github equivalents.

    My authors file looks like this:

    loderunner = Hisham Muhammad <hisham@gobolinux.org>
    hisham = Hisham Muhammad <hisham@gobolinux.org>

    And the command-line for svn2git:

    svn2git svn://svn.code.sf.net/p/htop/code/
  3. The next step was to create a new Github repository. I did that through their web interface.
  4. And then, to push the code from the locally generated git repo to Github:
    git remote add origin https://github.com/hishamhm/htop.git
    git push -u origin master
  5. Next, I wanted to download the htop website from SourceForge. I usually edited things straight through their shell account, but this got me to an SFTP session in which I could fetch the files:
    sftp loderunner,htop@frs.sf.net

    (By the way, I actually use yafc, which I highly recommend, instead of sftp. Also, as I looked for its URL to post on this paragraph, I just learned that the original yafc 1.1.1 from 2001, which I still use and was hosted in SourceForge and sat there for years without updates, has been taken by a new group of developers who resurrected the project and develop it in Github.)

    The site for htop is really simple so moving it to a new location was a relatively quick process; just needed to grep all references to sf.net and svn, and get my own direct Paypal donation button (to replicate the one I had in SourceForge I used this and this).

  6. Getting the archive of releases was a bit trickier. It’s also in frs.sf.net, but you need to know the correct directory. It doesn’t show up when you log in and ls. You have to cd to it:
    yafc ftp://loderunner@frs.sf.net
    # then, in the sftp session:
    cd /home/frs/project/htop
    get -p -r htop

    Now I have an archive of all releases, with their (mostly accurate) historical timestamps!

  7. The final steps are shutting down the sf.net services, such as the bug tracker and the code repository. This can be done easily through their admin interface. I’ve never had any plans to migrate the bug tracker history; this simplifies things (and I don’t even know if it’s possible). I’m not shutting everything down immediately, though: until I make a proper new release and distro maintainers catch up with the new URLs, I’ll keep the download links active there.

    The original website, however, is now gone and replaced with the following:

    <meta http-equiv="refresh" content="0; url=http://hisham.hm/htop">

    (I did try an .htaccess file, but the sf.net servers kept redirecting to a default page even when I tried to do it via html… thanks to Lynx I realized it was redirecting with a 403 Forbidden error, so I removed the .htaccess file and things worked as expected.)

  8. Still TODO: migrate the htop-general mailing list.

One criticism I’ve had of Github in the past was that it did not promote a culture of making proper releases like SourceForge always did, but that has improved in recent years. Github now has a “releases” feature which, while not perfect, does the job in many cases. I’m not sure if I’ll use it, since I prefer to make the tarballs for htop using the make dist feature from GNU Autotools. I hope to cause as little disruption as possible to the distro maintainers and I want to keep my packages looking the same.

The big test for the new setup will be the next release, which I hope to make in time for htop’s tenth anniversary(!), in the coming months. It is quite fitting that htop presents its new home in such a special occasion!


🐦 Twitter🐘 MastodonRSS - posts in English, posts em Português, todos / all

Latest posts


Admin area