Blog
Bring back deleted files with lsof
Today i accidentally deleted a PDF file, fortunately the pdf reader was still open and had a reference to the file so i could copy it back from
/proc/<pid-of-pdf-reader>/fd/<num-as-shown-by-lsof>
There is an article on linux.com which explains the procedure if your unfamiliar with it.
Marc
PCC another C Compiler
Ok today somebody pissed of Rob with the effect that he stopped maintaining his tcc fork which sucks.
It seems that he will try to get pcc, a thirty year old C compiler recently resurrected by the OpenBSD people, to compile Linux. I haven't used pcc yet but from reading it's project page it seems that it won't be as fast as tcc. After all pcc is a two-pass compiler which allows more optimizations but is slower, whereas tcc is a one-pass compiler.
We will see what works out, competition in the compiler field is definitely a good thing. In this context one should also take a look at clang, a C frontend for llvm.
Marc
Tiny Browsers for embedded Systems
Ok i am starting to look around for suitable applications for my embedded like desktop distribution. Ideally i would like a xhtml/css/javascript compilant browser which is still lightweight.
The well known text browser like lynx, w3m, elinks, links or links2 (known for it's graphic -g mode) are not really what i want.
So i checked the current status of dillo and noticed that the long awaited release of the FLTK2 port finally happened.
Another more advanced rendering engine is tkhtml3 and it's corresponding browser hv3 which even passes the ACID2 test.
It uses libsee for the javascript support. As the name suggests a rather big part of the browser is written in Tcl using the Tk ui-toolkit, the core rendering engine is however implemented in C. A statically compiled hv3 with all dependencies (Tcl,Tk,libsee) is about ~3.4M. I asked Dan Kennedy the maintainer whether it would be possible to port it to a different toolkit and get rid of Tcl, he thinks it should be doable, however according to him replacing the browser functionality which is written in Tcl is a rather big undertaking. As i currently both lack the required skills and time i won't even try it right now.
Marc
Package Management Systems for Space Constraint Environments
So i am actually playing with the idea of building a tiny embedded like distribution with my most used apps for daily desktop use.
My goal is to use as less space as possible and therefore i was looking for a suitable package management system. Dpkg and apt are too bloated for my sense, use separate meta data and on top of that apt is written in c++ which means it will require libstdc++ (it may be possible to compile it against uclibc++ don't know).
So i found ipkg which looks like a suitable replacement for both dpkg and apt, it is already in use by the OpenMoko and Free/OpenWRT folks.
Unfortunately documentation is a bit sparse and outdated. Also i think it could still be a bit smaller, ipkg-cl + libipkg compiled from cvs are together about 170K. Ipkg uses some parts of libbb and there may be some plans to integrate it into upstream busybox which would save some space i guess.
If time permits i will take a closer look at it, also there is a ipkg-utils package with various scripts to build and publish self created ipk's.
Marc
Programm Execution Tracing with GDB
Ok found another problem in tinycc, the __attribute__ handling code gets confused by parenthesis, sent a fix to tinycc-devel.
The next issue i faced is a bit more complex, there seams to be a bug with nested struct/union initialization.
While debugging this i looked for a way to get an exact trace of the lines which are executed. So i ended up writing this little shell script, which makes gdb looping over every program step by sending the appropriate command to its stdin.
#!/bin/sh
gdb --args $* <<EOF
break main
run
while 1
step
end
quit
EOF
Don't know how useful this will be because the amount of generated data is quite large. Anyway the GNU GDB Online Documentation is a good place to search for information about gdb commands (what a surprise ;).
Marc
