Top Latest Append

pterjan's diary


2005-12-02

  Why you should always test return value

Today I lost the code I had been writing half the day, on an almost finished client code. Here is the guilty code, it was in a clone script written this summer (by someone I won't name here, he will recognize) during an internship.

if( -d "/tmp/wrap/" )
{
       system("/bin/umount /tmp/wrap/new 1>/dev/null 2>&1") if( -d "/tmp/wrap/new");
       system("/bin/umount /tmp/wrap/old 1>/dev/null 2>&1") if( -d "/tmp/wrap/old");
       system("rm -rf /tmp/wrap");
}

/tmp/wrap/old is used to mount the root partition of the original disk in order to update some stuff, /tmp/wrap/new being the copy.

Now, imagine umount want to tell me something like umount: /tmp/wrap/old: device is busy (want because it is muted). Yes, this code turns into rm -rf / and you lose all your work since last backup...

And now to have more fun, imagine that this same day, something in the deployement system is broken and you can't reinstall the machine. For even more fun, add that the project had to be finished today and you may understand how I currently feel.

If so, please help me find a large axe before the next time I meet the author.

(yes I should have saved the code more often but the USB key I bought last week died this morning...)

Today's TSUKKOMI(Total: 3) [Add a TSUKKOMI]

  lrz [I do not have an axe but a very good blame stick, that has been used several times with great satisfaction. I can len..]

  yoho [s/Yes, this code turns into rm -rf \//Yes, this code turns into rm -rf \/tmp\/wrap/ My 2ยข :)]

  yoho [Oops, ok, now I understand... /tmp/wrap/{new|old} is the mounted "/", so ignore my previous comment ;)]


2005-12-07

  megaraid monitoring

When you look for a way to monitor the hard drives inside your RAID, all the websites refer to old Dell utilities or patches for kernel 2.2 adding a monitor entry in /proc ...

After some time looking for information, I noticed that in current version /proc/megaraid/hba0/diskdrives-ch0 contains the state of my 4 drives !

Channel: 0 Id: 0 State: Online.
  Vendor: HP        Model: 18.2GB C 80-8C42  Rev:
  Type:   Direct-Access                      ANSI SCSI revision: 02
Channel: 0 Id: 1 State: Online.
  Vendor: HP        Model: 18.2GB C 80-8C42  Rev:
  Type:   Direct-Access                      ANSI SCSI revision: 02
Channel: 0 Id: 2 State: Online.
  Vendor: HP 18.2G  Model: ST318406LC        Rev: HP04
  Type:   Direct-Access                      ANSI SCSI revision: 02
Channel: 0 Id: 3 State: Online.
  Vendor: HP 18.2G  Model: ST318406LC        Rev: HP04
  Type:   Direct-Access                      ANSI SCSI revision: 02

So, here is the simple line I added in the crontab : */10 * * * * if diff /proc/megaraid/hba0/diskdrives-ch0 /var/lib/raid-state; then cp -f /proc/megaraid/hba0/diskdrives-ch0 /var/lib/raid-state; fi

Now if someday one disk changes state, I'll receive an email within 10 minutes listing the change :-) I think some people might be interested in adapting this to their system.

Today's TSUKKOMI(Total: 4) [Add a TSUKKOMI]

Before...

  pterjan [Yes would be nice. At home I use SMART tools to monitor my harddrives inside 3ware sata raid, but having something sta..]

  UnixGuy [This is nice, but I just wanted to let you know the Dell(repackaged LSI) utilities include megamon which is great if y..]

  pterjan [Forgot to mention : I tested the utilities but they did not find my adapter (HP NetRAID 8086 1960 103c 10cc).]


2005-12-08

  Found an explanation about rpm -qa speed issue

Few monthes ago I noticed rpm -qa was abnormaly slow but did not find why. Today, checking my referers, I went on Google and found an answer by Paul Nasrat on a Fedora ML.

[pterjan@plop tmp]$ time bash -c 'for i in $(seq 10); do ruby -rrpm -e '\''RPM::DB.new.each{|plop| puts "#{plop.name}-#{plop.version}"}'\'' >/dev/null; done'
2.77user 0.92system 0:04.56elapsed 81%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+83162minor)pagefaults 0swaps
[pterjan@plop tmp]$ time bash -c 'for i in $(seq 10); do rpm -qa --nosignature >/dev/null; done'
6.12user 0.63system 0:07.85elapsed 85%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+56691minor)pagefaults 0swaps
[pterjan@plop tmp]$ time bash -c 'for i in $(seq 10); do rpm -qa >/dev/null; done'
76.25user 0.67system 1:26.77elapsed 88%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+57005minor)pagefaults 0swaps

This option is even documented in the manpage :)

       --nosignature
              Don't verify package or header signatures when reading.

However, the part about defining %_hkp_keyserver does not help as it is already defined (and we also already have _hkp_keyserver_query %nil).

Update : --nosignature is in the man but as a verify or install option, it is not listed in the query section :) I'll have to open a bug for that. I also added the ruby version, it is still twice faster !

Today's TSUKKOMI(Total: 2) [Add a TSUKKOMI]

  rgs [Well, duh, glancing at the code... it looked like redefining %_vsflags_query could solve this, but no, because somehow..]

  RedFox [Whaouu, this is why I found apt-rpm really faster than rpm since many years!! with --nosignature, "rpm -qa > /dev/nul..]


2005-12-19

  Gaim 2.0.0 beta 1

Gaim 2.0.0 beta 1 was released yesterday and not everyone likes the choices that were taken. Appart from the discussion about voice and video support, I personnaly appreciate the big work done on the interface.

I have built rpm for cooker but as the authors advertise it as highly beta (If you decide to try it out, please back up everything in your .gaim directory) I won't upload them to cooker.

You can find the rpms for cooker i586 on my repository (urpmi.addmedia pterjan-cooker http://fasmz.org/~pterjan/rpm/cooker/ should work).

I plan to update them there until gaim 2.0.0 is considered stable enough to go into cooker. I may also rebuild them for cooker x86_64 and 2006.0 i586/x86_64 when I find time.

Update : x86_64 for Cooker is now available.

Today's TSUKKOMI(Total: 8) [Add a TSUKKOMI]

Before...

  vewqsuof ktlcgqxbn [rpfwi dbrm qwafhce dlkyqug mdenils wnki ixapy http://www.newfcbgj.ebiyr.com]

  ubiant ilkpmn [ktoxscfi oskxhvyju kzwvalx tsyezhwbn ehjydt unbrq scxaumk]

  syano kpxgoalyb [rpjy lpda ncugsobi hkwvi urxnbl ipfh uvwfpbexr http://www.jaqxcgfp.kmue.com]


2005-12-24

  Gaim 2.0.0 beta1 in Cooker

As a lot of people (103 IP to be precise) downloaded my packages and I got only one minor bug reported, I finally uploaded the packages to Cooker repository.

I also uploaded to my 2006.0 repository the backport for i586, enjoy.

  Xorg uses daCode !

Xorg website uses the daCode CMS I used to contribute to. That's quite strange as the project have been dead for about 3 years... They did dot remove the board and that shows the board timestamps are not compatible with the MySQL recent version they are using.

Anyway, seing the really old LinuxFR logo on Xorg website is enough for me to have fun :)

  Freebox TV on your PC

This post is dedicated to clients of Free ADSL, so only French people, but I'll go on in English for consistency :)

Since this morning people with Freebox version 3 or 4 and who receive TV on it, can now watch it on their computer(s). That's quite easy to use, there is a playlist with all the rtsp urls for available channels. You then need mplayer or VLC to access the channels (currently the rtsp server is not compatible with realplayer).

You can watch different channels on your different computers if your freebox is in router mode (and if you have enough bandwidth). As I don't use the Freebox as a router but use my own gateway/firewall, only the gateway could have the TV but it has no screen :) Using it on my laptop instead was quite easy : I just needed to redirect evrything comming from 212.27.38.253 to the laptop. A better solution would be ip_connatrack_rtsp/ip_nat_rtsp but I couldn't manage to build it...

Now that it works fine, I can close VLC as it looks like there is still nothing interesting on TV even if I now receive 102 channels (I had stopped watching TV for about 3 years).

Update : Someone wrote a patch to add an option to VLC so that you can chose the port and forward only it and the next one. I slightly modified it (default to old behaviour, not to a hardcoded port) and applied to cooker package. Backport for 2006.0 will be available in my 2006.0 repository within a few hours.

Today's TSUKKOMI(Total: 7) [Add a TSUKKOMI]

Before...

  diepvzfg glyj [wydnxvhe ayqd hpmj yopfvl msazoj vhnxkcotu zphs http://www.oyzuxt.asjctope.com]

  qdhau pmnv [uxwa nkcifrsav oeayn qorbvms icaoypfxm zispj lunps]

  pdmn zykvhrdf [qiycfle gotmv uatn oytgmi zwatgrmh bryd bcidyqx http://www.czim.pqdnfkryw.com]


2005-12-25

  Merry Christmas !

I played with Inkscape and here is the result : classical Christmas candles (PNG version). I planned giving it to Open Clip Art but it looks like there is a problem in their upload process : the upload was reported successful but image as 0 size now and it is not the only one...

If they don't want it, let's give it to you :)

Merry Christmas !


2005-12-30

  RTSP conntrack

Last night after experimenting during a few hours, I got ip_conntrack_rtsp to work on my 2.6.12 kernel ! Basically the fix was to factorize header parsing code as one version was working and the other not, and to add a call to htons so that the right port is expected. The modified file is there.

Now I'm waiting for a version of ip_nat_rtsp that would at least build :)


2004|06|07|08|09|11|
2005|01|02|05|06|07|08|09|10|11|12|
2006|01|02|03|06|08|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|12|
2011|02|04|06|
2012|01|05|11|
2013|01|02|04|06|
2014|02|
2015|06|
2017|05|07|12|