Archive for the 'miscellaneous' Category

svk shortcuts

Jörg, you can significantly reduce the number of commands to type by using some of the useful svk shortcuts.

First, you can create the mirror and check it out with a simple one liner:

svk cp svn+ssh://joerg@svn.debian.org/svn/debconf-data/ /chekout/directory

It will ask you the base URI to mirror (in case you'd actually want to mirror svn+ssh://joerg@svn.debian.org/svn/, for example), and then the depot path for the mirror and the local svk copy. The checkout will then be available in /checkout/directory.

Then, to get updates from svn:

svk up -sm

And you can also push your changes into svn with

svk push

2007-04-21 08:55:18+0900

miscellaneous, p.d.o | Comments Off on svk shortcuts

Recycled LISPers ?

Who else could do things such as solving Sudoku puzzles... in XSLT ?

2007-03-30 08:54:40+0900

miscellaneous, p.d.o | Comments Off on Recycled LISPers ?

Close-up

I just saw that on TV. The guy is amazing. He's this year's close-up world champion.

2007-03-17 23:57:55+0900

miscellaneous, p.d.o | Comments Off on Close-up

diffing

I always assumed the diff algorithm to be quite standard and used anywhere there is a diff function, well it seems it is not, and it also seems that human readability is very dependent on the tool you use:

Here is what diff -u, git diff and tla diff give:

@@ -42,10 +42,9 @@
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
+EXTRA_COMPONENTS = nsKillAll.js
 
-libs::
-       $(INSTALL) $(srcdir)/nsKillAll.js $(DIST)/bin/components
+include $(topsrcdir)/config/rules.mk
 
 clean::
        rm -f $(DIST)/bin/components/nsKillAll.js

This is the least human readable output. In comparison, svn diff, svk diff and bzr diff do output:

@@ -42,11 +42,10 @@
 
 include $(DEPTH)/config/autoconf.mk
 
+EXTRA_COMPONENTS = nsKillAll.js
+
 include $(topsrcdir)/config/rules.mk
 
-libs::
-       $(INSTALL) $(srcdir)/nsKillAll.js $(DIST)/bin/components
-
 clean::
        rm -f $(DIST)/bin/components/nsKillAll.js
 

Mercurial outputs:

@@ -42,10 +42,9 @@
 
 include $(DEPTH)/config/autoconf.mk
 
+EXTRA_COMPONENTS = nsKillAll.js
+
 include $(topsrcdir)/config/rules.mk
-
-libs::
-       $(INSTALL) $(srcdir)/nsKillAll.js $(DIST)/bin/components
 
 clean::
        rm -f $(DIST)/bin/components/nsKillAll.js

which is pretty similar.

I got too fed up with tla and baz to try more (and didn't even go up to committing a file in baz, so there's no diff result for it)

2007-03-16 21:55:44+0900

miscellaneous, p.d.o | 3 Comments »

Plus c’est gros, mieux ça passe

This french phrase is one of the favourites of our (not for much longer) president, Jacques Chirac.

It could be translated as 'The taller the tale, the more likely people will believe in it'.

It fits perfectly to Microsoft's latest F.U.D.

2007-02-21 21:17:05+0900

miscellaneous, p.d.o | Comments Off on Plus c’est gros, mieux ça passe

Security oddities

Sun recently fixed a pretty interesting in.telnetd vulnerability. 24 hours to deal with the bug. Kudos.
A week before that, Sun fixed a (okay, local) vulnerability ... discovered in 2002... hum.

2007-02-15 08:18:04+0900

miscellaneous, p.d.o | Comments Off on Security oddities

kqemu is free !

The QEMU Accelerator version 1.3.0pre10 is available in Open Source under the GNU General Public License. A detailed technical specification and API description is available.

That is great news. Now what I'd like to see is an unification of /dev/kvm and /dev/kqemu interfaces, so that the same frontend could be used for VT-supporting and VT-less architectures.

2007-02-06 09:37:55+0900

miscellaneous, p.d.o | Comments Off on kqemu is free !

Trademark vs Copyright

Today, Sun Microsystem announced that Java is going to be free, released under the GPL. That's amazing news, but I'd like to talk about another thing here.

Duke, the Java mascot, is also being freed, under BSD license. Sun Microsystems is proving here that a trademarked logo can be free as in speech.

The Mozilla Corporation could take a lesson, here.

2006-11-13 21:27:58+0900

miscellaneous, p.d.o | 8 Comments »

Two things I don’t like about “multimedia linux”

Kernel being dumb by being smart

Memory cache is a good thing to speed up a computer, but it's a PITA when it comes to stopping playing a DVD or a big video file.

The kernel usually keeps in memory cache data that has been read from the hard drive so that it can get it faster next time the same data is accessed. I don't know exactly on what grounds fragments are decided to be kept or not, but observation shows that playing a DVD or a Xvid file makes the cache grow more than significantly. Moreover, while playing the video, the other software from the desktop (nautilus, for example), is not used, thus, the kernel decides it can swap it to disk virtual memory.

Then, when you stop reading your video and want to come back to normal activity, your desktop is damn slow for some long seconds. That makes the experience a real pain.

Overuse of network bandwidth

I noticed that when I switched from a samba network share to an apache based DAV one: reading a video file from the DAV share with totem-gstreamer filled my apache logs very quickly. It seems gstreamer/gnomevfs seeks a lot in the file to play the video. Instead of making one HTTP request, it does several thousands, each time requesting again data it already received.

As a result of that, it usually takes up to 1 mega byte per second to play a video that has a bitrate of 1 mega bit per second, with a nice effect of network congestion when the bit rate grows for detailed sequences.

Do you find it normal that it takes 5 minutes to download a 45 minutes file at 2~3 MB/s, and 1MB/s for 45 minutes to play it directly from the network ?

Well, now, gstreamer 0.10 doesn't even support reading from HTTP/DAV, but the problem remains the same when reading via sftp with gnomevfs.

2006-08-19 08:40:26+0900

miscellaneous, p.d.o | 3 Comments »

Undeleting opened files on ext3

I'm a specialist when it comes to delete files I didn't intend to. 3 years ago, I did an rm -rf that cost me most of my ${HOME}, and I wrote some software (which i really should work on, BTW) which helped recover most of it (it's tricky to get files back from ext3 once they are removed from the filesystem, since ext3 clears the block pointers from the inodes then).

Today, I somehow managed to remove log files. Fortunately the log files were still in use by a process, so they were still in the filesystem. Unfortunately they were still in use by a process, filling and filling and filling... and in no way i wanted to lose all this data.

Let's consider, for the needs of the demonstration, the following case:
mh@namakemono:/mnt/test$ while true; do date; sleep 1; done > log

That fills a 'log' file every second with the current date.
mh@namakemono:/mnt/test$ tail -2 log
2006年 7月 4日 火曜日 20:48:02 CEST
2006年 7月 4日 火曜日 20:48:03 CEST

The file keeps growing and growing. Now, let's remove it.
mh@namakemono:/mnt/test$ rm log

The file is not in the directory any more, but remains in the filesystem. It is actually readable through /proc:
mh@namakemono:/mnt/test$ ls -l /proc/10724/fd
合計 5
lrwx------ 1 mh users 64 2006-07-04 20:52 0 -> /dev/pts/1
l-wx------ 1 mh users 64 2006-07-04 20:52 1 -> /mnt/test/log (deleted)
lrwx------ 1 mh users 64 2006-07-04 20:52 10 -> /dev/pts/1
lrwx------ 1 mh users 64 2006-07-04 20:45 2 -> /dev/pts/1
lrwx------ 1 mh users 64 2006-07-04 20:52 255 -> /dev/pts/1
mh@namakemono:/mnt/test$ tail -2 /proc/10724/fd/1
2006年 7月 4日 火曜日 20:52:45 CEST
2006年 7月 4日 火曜日 20:52:46 CEST

As you can see, it kept filling while deleted. The usual technique to recover such a file is to copy it from /proc. I happen to have done so some times before, it works pretty well for static files. But that doesn't in our case: we'll get a new copy of the file, frozen at some point in time. Here, we'd want to 're-link' the file.

Basically, that can be done with debugfs. The problem is that I didn't find a clean way to get the inode number from the /proc/10724/fd/1 file. But that can be worked around. You need root access (what a surprise), and hope your filesystem was mostly clean before removing the file.

namakemono:/mnt/test# e2fsck -n /dev/namakemono/tmp
e2fsck 1.39 (29-May-2006)
Warning! /dev/namakemono/tmp is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
/dev/namakemono/tmp contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Deleted inode 113570 has zero dtime. Fix? no
(...)

Don't worry, the -n option will make the filesystem opened read-only, so there's no risk for your data.
The interesting part of the output is obvious: the number of the deleted inode. You now only need to link the inode:
namakemono:/mnt/test# debugfs -w /dev/namakemono/tmp
debugfs 1.39 (29-May-2006)
debugfs: cd test
debugfs: ln <113570> log
debugfs: q

And see how it worked:
namakemono:/mnt/test# tail -2 log
2006年 7月 4日 火曜日 20:58:40 CEST
2006年 7月 4日 火曜日 20:58:41 CEST

You can tail again, it will show you the file is being appended to.

I guess you can do something along these lines to restore a file from ext2. I don't know for other filesystems.

If someone knows how to get the inode number without e2fsck, comments are opened :)

Update: Well, it didn't take long for me to actually find a better way:
namakemono:/mnt/test$ lsof -p 10724 -a -d 1
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
bash 10724 mh 1w REG 254,3 13552 113570 /mnt/test/toto (deleted)

Basically, when the file can be found in /proc/$pid/fd/$fd, run lsof -p $pid -a -d $fd.

2006-07-04 21:17:08+0900

ext3rminator, miscellaneous | 4 Comments »