H4ck3rm1k3's Blog

exploration of free/libre open source software and things

Test random permutations of files and lines for gccgo golang go compiler bug reporting — March 31, 2015

Test random permutations of files and lines for gccgo golang go compiler bug reporting

If you are trying to debug a crash of the compiler you need to reduce your test case to something small.

Compiler writers cannot just take your huge project and find the crash.

For go (golang), at least the gccgo compiler,  you pass in a set of files and they are compiled in a package, so the number of files passed to the compiler matters.

I have two simple bash scripts to provoke a compiler crash by first selecting pairs of files to compile and testing them.

After you found the files, you can concatenate them together and select random lines until you can find the exact minimum lines to provoke a crash.

We are using the command shuf from GNU coreutils (https://www.gnu.org/software/coreutils/manual/html_node/shuf-invocation.html) to create random permutations, then use “head -$COUNT” to select COUNT lines from that permutation. This will pick random lines from an input. Then we look for the line “report” in the stderr to look for a sign of the crash, this will end the loop. The program stops when it finds a crash.

Here is the one to select files to compile

rm stop.txt
touch stop.txt
while [ $(wc -l stop.txt | cut -f1 -d ” “) -eq 0 ];
do echo test;
ls *.go | shuf | head -2 | tee test.txt | xargs ~/install/bin/gccgo > out.txt 2>err.txt;
echo $?;
grep report out.txt err.txt > stop.txt;
done

This takes a file with arg 1 and selects n lines with arg 2

rm stop.txt
touch stop.txt
while [ $(wc -l stop.txt | cut -f1 -d ” “) -eq 0 ];
do echo .;
echo “package main” > ~/test.go
cat $1 | shuf | head -$2 >> ~/test.go
~/install/bin/gccgo ~/test.go > out.txt 2>err.txt;
grep report out.txt err.txt > stop.txt;
done

cat ~/test.go # show the error

Feedback :

Hello World : Another host, another post! — March 29, 2015

Hello World : Another host, another post!

Originally posted on posterous.com

I have so many accounts, I like to think of myself as an accountant.

Someone asked me yesterday if I have one blog, but i don’t. I dont have one single blog or one single webpage.

For me, the idea of paying monthly rent for an internet space is very old fashioned, since now there are so many free places to put your data online. I have a large collection of them.

Of course you do pay in other ways for having this free hosting, and there is no such thing as free lunch. But After some negative experience with hosters here in Germany, where they dont even accept my email or phone calls to cancel the service, I decided not to pay for hosting any more.

There are free hosts for blogs and tweets, for videos and for programs.

Build Servers for Compiling

Right now I am working on a 24 processor build machine from the gcc, now this is a very expensive and fast machine.

gcc.gnu.org/wiki/CompileFarm

It is part of the gcc build farm, and I got my account because I am working on something that is of interest to them, but why not? If people are interested in my work and are willing to allow me to use thier computer, and we all benefit, it is good for us all.

These are the win win situations that you can all benefit from.

Also I have an account on the ibm build machine, you can get your own server there troublet.zseriespenguins.ihost.com/

There is also a hurd build server that I am using http://www.gnu.org/software/hurd/public_hurd_boxen.html

Hosting of Webservices:

Also, I am using tuxfamily for hosting, it is good for web services but a bit slow.

You can also host programs on sf.net, and I have an account there.

And additionaly, the wikipedia http://toolserver.org provides accounts, I am working on setting up some osm stuff there.

Hosting of Data:

There are more hosts for mapdata, warper.geothings.net of course http://osm.org and http://www.commonmap.org/ and http://geocommons.com/

The mother of all free storage has to be http://achive.org that allows you unlimited storage for all free as in freedom data.

http://Wikpedia.org, http://wikibooks.org , and the commons (http://commons.wikimedia.org/wiki/Main_Page) all provide wiki storage.

There are many more that I did not mention here.

Dont forget also gitorious.org/ for data and code hosting. I wont even start with a list of free video hosts.

Now, what is really needed is a way to use all these resources easily, we need tools to be able upload to many of these places and manage them. These tools should be command line and or web services, we should be able to move from the computers, to mobiles to servers as needed.

Thanks for your attention!

mike

rescued from: https://web.archive.org/web/20110130214014/http://h4ck3rm1k3.posterous.com/