Archive for category linux

Ifnet updates for NetworkManager 0.9

NetworkManager 0.9 has changed a lot of stuff. Before NM 0.9, there are user connections and system connections. Ifnet plug-in is made to only take charge of system connections. But after NM 0.9, all connections become system connections and ifnet tries to manage all of them. Then some bad things might happen. The problem is reported by David Narvaez and he helped a lot on it. Bug #392409 is also caused by the problem. This is fixed in networkmanager- if a user does not check “available to all users”, ifnet will not handle the connection any more and the default plug-in “keyfile” will do the job.

Another important change is that ifnet now supports openrc style. As bash arrays are not allowed by openrc, ifnet caused Bug #369711. After networkmanager-, ifnet can read both the old baselayout style (with bash arrays) and openrc style (without bash arrays), but it only writes to /etc/conf.d/net with openrc style.




Handling unit test with C++ visibility=hidden

Recently I started working on the libbash project. I will write several articles talking about it in future. Now I’d just like to write something about the problem we encountered during development.

Our project will be a shared library. The C++ visibility support could improve the overall performance. Put simply, it hides most of the ELF symbols which would have previously (and unnecessarily) been public. Well it’s good for the library, it’s not good for unit tests(namely gtest) because they need to know the symbols.

Of course we don’t want  the unit tests to be part of our library. So we need to find some way to let the unit test know the symbols and separate them into different automake targets. Our first solution is to use hidden visibility for the library and create an internal target with default visibility for the unit test. However, that requires compiling the source code twice. Finally Petteri Räty come with a solution (He is too busy to write a post :P):

libcppbash_la_SOURCES = blah
libcppbash_la_CXXFLAGS = $(AM_CXXFLAGS) -fvisibility=hidden -fvisibility-inlines-hidden

cppunittests_SOURCES = blah
cppunittests_LDADD = $(GTEST_LIBS)
cppunittests_LDFLAGS = -static

Here’s his explanation:
libtool by default builds both a shared and a static library for our project. This is why you see it building things twice (with PIC and without). Giving -static to libtool is just telling it to use the static version. Using the static version means everything ends up in the unit test binaries.

, , ,


Gentoo NetworkManager Plug-in now supports non-alnum SSID

For a long time, we can’t use non-alnum SSID for system connections when ifnet is enabled. For example, when you have an SSID named “foo bar”, ifnet plug-in will write this into /etc/conf.d/net:
config_foo bar=(…)
And this will break baselayout or openrc because space is not allowed in variable name.

But now you can specify any SSID you want, the plug-in will handle it transparently. Here’s how it works:
When an non-alnum SSID is specified, ifnet plug-in will transform it to the equivalent hex format. For example, you have the SSID “foo bar”, the following will be written to /etc/conf.dnet:
config_0x666F6F20626172=( “dhcp” )
Meanwhile, the name displayed in nm-applet will be transformed to printable characters.

Thanks to  William L. Thomson Jr’s help in Bug #356337.

PS: What is non-alnum? man isalnum



Recent Updates for Gentoo NetworkManager Plugin

It’s been a long time since I wrote something about Gentoo NetworkManager Plug-in. But I never stopped my work. Here are some updates for it.


  1. Shared connection could work now.
  2. Support ad-hoc network
  3. Allow to use “default gw *.*.*.*” to configure routes

Bug fix:

  • Bug #353549 Fix tests
  • Bug #352638 Fix bug in parsing dhclient.conf
  • Bug #350476 Fix several small bugs, improved log output, support shared connection.
  • Bug #339215  Allow to use “default gw *.*.*.*” to configure routes

One small issue for shared ad-hoc system connection is that it doesn’t start the connection automatically when networkmanager is started the first time after boot (Bug #350476). But I notice that there’s the same problem with the default keyfile plug-in. So I think it may be an upstream bug but I don’t get any response from upstream :(.

All the updates are contained in networkmanager-0.8.2-r6. Some modification has been merged to upstream.

Thanks for your attention.


, ,


Using vimpager as your PAGER program

Sorry for not posting anything these days. It’s been very busy recently. And every time when I have some experience to share, the damn GFW blocks me. Anyway, I’m really glad to see that there are people waiting for my post :). So I’ll try to update my blog more frequently.

Today I’m going to talk about our PAGER program. Maybe the most commonly used PAGER program is “less” or “more”. Every time you have too much information in your terminal and you will use “command | less” to make it readable(git, man and many other commands call the PAGER program). But the above two commands do not give us a beautiful output. There’s another PAGER program called “most”, which could give you a colorful output. However, it doesn’t use vim key bindings and involves several dependencies. So I choose not to use it.

Wait a minute, think about your vim. Isn’t it amazing if we can use vim for our PAGER program? It has syntax highlighting, different color themes and the most important of all — vim features including key bindings, searching and etc.

Here is the download link for vimpager. What can it do? Let me show you my git diff and git log:

git diff with vimpagergit log with vimpager

Colorful result with vim key bindings. And it’s also very fast.

Installation is quite easy. Thanks to Daniel Gryniewicz’s comment: Add “vim-pager” use flag and emerge vim.




I’m pulling fcitx back!

fcitx is an amazing Chinese input toy for X. But due to bugs and lack of maintainers, it’s masked now and will be removed from portage.

But today, I see that fcitx 4.0 is released. It fixed many bugs,  introduced new themes, improved performance and accuracy. Here’s what it looks like:

default theme

black theme






Isn’t it amazing?

I’ve added the ebuild to my overlay, and there’s a config editor “fcitx-config”. Please try it if you like it :).

layman -a qiaomuf
emerge fcitx fcitx-config