tag:blogger.com,1999:blog-2688921970587945122024-02-20T09:39:52.466+03:00Thousands of HATE...Seven deadly sins<br>
Seven ways to win<br>
Seven holy paths to hell<br>
And your trip begins...raornhttp://www.blogger.com/profile/15819002999407397097noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-268892197058794512.post-90309068300629035892011-01-21T12:34:00.000+03:002011-01-21T12:34:29.877+03:00ALT Linux<a href="http://blog.wrar.name/2011/01/altovoe-2/">From wRAR with HATE...</a>raornhttp://www.blogger.com/profile/15819002999407397097noreply@blogger.com0tag:blogger.com,1999:blog-268892197058794512.post-3354057068422450262010-12-06T19:48:00.000+03:002010-12-06T19:48:19.408+03:00Ruby vs. PythonOnce upon a time, there lived a girl named Red Ruby Hood with Hash h={:foo => "foo_val", :bar => "bar_val"}. Her mother gave her "quux" variable with value "quux_val" and told to print all this shit to he gand-grandmother, who lived far beyond the forest. Long story short, girl uses String.%:<br />
<br />
<pre>$ irb
irb(main):001:0> h={:foo => "foo_val", :bar => "bar_val"}
=> {:foo=>"foo_val", :bar=>"bar_val"}
irb(main):002:0> puts "Teh %{foo}, teh %{bar} and teh %{quux}" % h.merge({:quux => "quux_val"})
Teh foo_val, teh bar_val and teh quux_val
=> nil
irb(main):003:0> h
=> {:foo=>"foo_val", :bar=>"bar_val"}
irb(main):004:0>
</pre><br />
But in the forest girl met Evil Gray Python...<br />
<br />
<pre>$ python
Python 2.6.6 (r266:84292, Oct 1 2010, 13:15:00)
[GCC 4.4.4 20100726 (ALT Linux 4.4.4-alt3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> h={"foo": "foo_val", "bar": "bar_val"}
>>> print "Teh %(foo)s, teh %(bar)s and teh %(quux)s" % h.update({"quux": "quux_val"})
Traceback (most recent call last):
File "<stdin>", line 1, in <module></module></stdin>
TypeError: format requires a mapping
</pre><br />
Hate!..<br />
<br />
<pre>>>> tmp = h.copy().update({"quux": "quux_val"})
>>> tmp
</pre><br />
Hate!!.<br />
<br />
<pre>>>> tmp = h.copy()
>>> tmp.update({"quux": "quux_val"})
>>> tmp
{'quux': 'quux_val', 'foo': 'foo_val', 'bar': 'bar_val'}
>>> print "Teh %(foo)s, teh %(bar)s and teh %(quux)s" % h
Teh foo_val, teh bar_val and teh quux_val
</pre><br />
Hate!!!<br />
<br />
So, the Python ate girl, her mother, her grand-grandmother and all lumbermen...raornhttp://www.blogger.com/profile/15819002999407397097noreply@blogger.com2tag:blogger.com,1999:blog-268892197058794512.post-29820615434229038262010-03-31T00:59:00.001+04:002010-03-31T01:12:21.611+04:00facepalm.jpgWhile browsing <a href="http://www.dockapps.org/">dockapps.org</a> site I've found <a href="http://www.dockapps.org/file.php/id/357">interesting applet</a>. It is very similar to my <a href="http://www.dockapps.org/file.php/id/275">WMVolMan</a>, but have more functionality, like customizable commands and <a href="http://code.google.com/p/cryptsetup/">LUKS</a> partition mounting. And it uses modern <a href="http://www.freedesktop.org/wiki/Software/udisks">UDisks</a> instead of obsolete <a href="http://www.freedesktop.org/wiki/Software/hal">HAL</a>. Since I was planning to migrate to UDisks, I took a closer look at this applet...<br />
<br />
First look at configure.ac scared the shit out of me me:<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">PKG_CHECK_MODULES(dbus,dbus-glib-1)</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">PKG_CHECK_MODULES(libnotify,libnotify)</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">PKG_CHECK_MODULES(gnome_keyring,gnome-keyring-1)</span><br />
<div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">...</span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">AM_PATH_GTK_2_0(2.18.0,,[AC_MSG_ERROR(cannot find libgtk)])</span></div></div><div><br />
</div><div>I know, dbus-glib is necessary to access UDIsks service via DBus and easily integrates into glib mainloop, but for fuck's sake, tell me what the hell GTK+2 is doing here? I don't even asking about libnotify (which depends on org.freedesktop.Notifications DBus service, which in turn provided by GNOME Notification Deamon) and GNOME Keyring library (which depends on daemon of the same name).</div><div><br />
</div><div>Next, I looked into dockapp window code. I shouldn't have done it, really. The whole dockapp code was written using <b>ONLY</b> GDK and GTK. With signals, callbacks, widgets, blackjack and hookers.</div><div><br />
</div><div>And finally, take a look at this:</div><div><br />
</div><div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ ls -logh wmudmount </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">-rwxr-xr-x 1 267K Mar 30 23:06 wmudmount</span></div></div><div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ ls -logh wmudmount</span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">-rwxr-xr-x 1 102K Mar 30 23:06 wmudmount</span></div></div><div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ ldd wmudmount | wc -l</span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">47</span></div></div><div><br />
</div><div>I know that ldd shows both, direct and indirect dependencies, but that's the point. And I was using -Wl,--as-needed.</div><div><br />
</div><div>Comparing to my wmwolman:</div><div><br />
</div><div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ ls -logh =wmvolman </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">-rwxr-xr-x 1 32K Jan 4 2008 /usr/bin/wmvolman</span></div></div><div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ ldd =wmvolman | wc -l</span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">19</span></div></div><div><br />
</div><div>One may say that WMVolMan have tree times less functionality, but hey! Why would someone use WindowMaker inside GNOME (and it <b>WILL</b> be "inside GNOME" just after libnotify and libgnome-keyring starts all GNOME services like gconf and gvfs) with dockapps enabled? Just stay with gvfs and Nautilus.</div><div><br />
</div><div><div>• . . . . . .. . . . . . . . . . . ,.-‘”. . . . . . . . . .``~., </div><div>. . . . . . . .. . . . . .,.-”. . . . . . . . . . . . . . . . . .“-., </div><div>. . . . .. . . . . . ..,/. . . . . . . . . . . . . . . . . . . . . . . ”:, </div><div>. . . . . . . .. .,?. . . . . . . . . . . . . . . . . . . . . . . . . . .\, </div><div>. . . . . . . . . /. . . . . . . . . . . . . . . . . . . . . . . . . . . . ,} </div><div>. . . . . . . . ./. . . . . . . . . . . . . . . . . . . . . . . . . . ,:`^`.} </div><div>. . . . . . . ./. . . . . . . . . . . . . . . . . . . . . . . . . ,:”. . . ./ </div><div>. . . . . . .?. . . __. . . . . . . . . . . . . . . . . . . . :`. . . ./ </div><div>. . . . . . . /__.(. . .“~-,_. . . . . . . . . . . . . . ,:`. . . .. ./ </div><div>. . . . . . /(_. . ”~,_. . . ..“~,_. . . . . . . . . .,:`. . . . _/ </div><div>. . . .. .{.._$;_. . .”=,_. . . .“-,_. . . ,.-~-,}, .~”; /. .. .} </div><div>. . .. . .((. . .*~_. . . .”=-._. . .“;,,./`. . /” . . . ./. .. ../ </div><div>. . . .. . .\`~,. . ..“~.,. . . . . . . . . ..`. . .}. . . . . . ../ </div><div>. . . . . .(. ..`=-,,. . . .`. . . . . . . . . . . ..(. . . ;_,,-” </div><div>. . . . . ../.`~,. . ..`-.. . . . . . . . . . . . . . ..\. . /\ </div><div>. . . . . . \`~.*-,. . . . . . . . . . . . . . . . . ..|,./.....\,__ </div><div>,,_. . . . . }.>-._\. . . . . . . . . . . . . . . . . .|. . . . . . ..`=~-, </div><div>. .. `=~-,_\_. . . `\,. . . . . . . . . . . . . . . . .\ </div><div>. . . . . . . . . .`=~-,,.\,. . . . . . . . . . . . . . . .\ </div><div>. . . . . . . . . . . . . . . . `:,, . . . . . . . . . . . . . `\. . . . . . ..__ </div><div>. . . . . . . . . . . . . . . . . . .`=-,. . . . . . . . . .,%`>--</div></div>raornhttp://www.blogger.com/profile/15819002999407397097noreply@blogger.com0tag:blogger.com,1999:blog-268892197058794512.post-35351235200046594552010-03-14T04:02:00.000+03:002010-03-14T04:02:23.429+03:00GNU is Not UsableIf you want to make something completely unusable - give it to GNU crowd. These guys seem to have ability to turn anything they touch into shiny and whistling piece of bad-smelling shit. No need to go far - take a look at <a href="http://plasmasturm.org/log/126/">GNU</a> <a href="http://www.advogato.org/person/trs80/diary/21.html">info</a>. And the progress never stops, every new release of their info browser is getting worse and worse, they are making impossible things possible.<br />
<br />
Recently I was playing with <a href="http://windowmaker.info/">WindowMaker</a> project, trying to clean it's autocrapped buildsystem. Inside WindowMaker there are WINGs library and WPrefs application that both contains gettext-driven translations, having three textdomains in total.<br />
<br />
Here comes the question for one million points: how all these textdomains can be handled with one configure script? And by "handled" I mean "single autoreconf invocation should update Makefile.in.in and shit for all po subdirs". Answer is: you can't, shut up and suffer.<br />
<br />
GNU is so GNU...raornhttp://www.blogger.com/profile/15819002999407397097noreply@blogger.com0tag:blogger.com,1999:blog-268892197058794512.post-37702107479227871812010-02-18T18:44:00.000+03:002010-02-18T18:44:03.715+03:00Code WTFWhile playing with one opensource project we've found this masterpiece of Hindy C. I will not even comment it.<br />
<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">int pid, status, ret;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">int filedes[2];</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">rc = pipe(filedes);</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">pid = fork();</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">if (pid == 0) {</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ret=0;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> close(filedes[0]);</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> rc = functionThatMatters(/* some args */);</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> if (!rc) {<br />
ret = 0;<br />
} else {<br />
ret = 1;<br />
}<br />
<div><br />
</div></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> close(filedes[1]); </span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> exit(ret);</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">} else {</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> close(filedes[1]);</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> close(filedes[0]);</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> rc = timewait(pid, &status, /* timeout values */);</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> rc = WEXITSTATUS(status);</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">if (!rc) {</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> (*outStatus)[i] = 1;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> /* LOG WARNING THAT WE HAVE FAILED */</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">} else {</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> (*outStatus)[i] = 0;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<div><br />
</div><div>This reminds me forgotten stories about Miklos...</div>raornhttp://www.blogger.com/profile/15819002999407397097noreply@blogger.com0tag:blogger.com,1999:blog-268892197058794512.post-90928917964553269202009-12-29T15:16:00.002+03:002009-12-29T15:44:52.103+03:00-D_PLZ_UNFORTIFY_MAH_SOURCE_KTHXBYEMore than five years ago Jakub Jelinek <a href="http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html">implemented object size checking</a> in GCC. This feature (combined with GLIBC runtime checks) helps to detect many buffer overflows, both compile-time and run-time. Of course, this brings some limitations to code.<br />
<br />
Since then many distibutions (ALT Linux, Gentoo, OpenSUSE, Owl/*/Linux) turned this feature on by default. But there were those who resisted...<br />
<br />
In February, 2007 patch from OpenSUSE <a href="http://marc.info/?l=vim-dev&m=117224990614285&w=2">was offered to Vim developers</a>. Almost immediately it was rejected with resolution "<i><a href="http://marc.info/?l=vim-dev&m=117227630001996&w=2">The problem is in the compiler, so fix the compiler</a></i>".<br />
<br />
Now to the funny part.<br />
<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"><a href="http://ftp.vim.org/pub/vim/patches/7.2/7.2.044">Patch 7.2.044</a></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Problem: Crash because of STRCPY() being over protective of the destination</span><br />
<span style="white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><span style="font-family: 'Courier New', Courier, monospace;"> size. (Dominique Pelle)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Solution: Add -D_FORTIFY_SOURCE=1 to CFLAGS. Use an intermediate variable</span><br />
<span style="white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><span style="font-family: 'Courier New', Courier, monospace;"> for the pointer to avoid a warning.</span><br />
<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"><a href="http://ftp.vim.org/pub/vim/patches/7.2/7.2.251">Patch 7.2.251</a> (after 7.2.044)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Problem: Compiler adds invalid memory bounds check.</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Solution: Remove _FORTIFY_SOURCE=2 from CFLAGS. (Dominique Pelle)</span><br />
<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"><a href="http://ftp.vim.org/pub/vim/patches/7.2/7.2.316">Patch 7.2.316</a></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Problem: May get multiple _FORTIFY_SOURCE arguments. (Tony Mechelynck)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Solution: First remove all these arguments and then add the one we want.</span><br />
<span style="white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><span style="font-family: 'Courier New', Courier, monospace;"> (Dominique Pelle)</span><br />
<br />
I have a great citation for that case - this "<i><a href="http://groups.google.com/group/vim_dev/msg/7c40c43c8deba6e2">won't solve the problem, only create the illusion that it works</a></i>".<br />
<br />
Heavy New Year, everyone, and double-check code that you intend to use in your usual life.raornhttp://www.blogger.com/profile/15819002999407397097noreply@blogger.com1tag:blogger.com,1999:blog-268892197058794512.post-11068165501833614982009-12-28T18:08:00.001+03:002009-12-28T19:34:19.529+03:00How's your stable?Ruby is a nice language, but its community makes me sick.<br />
<br />
On December 7, 2009, <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-4124">CVE-2009-4124</a> was fixed by SVN revision <a href="http://redmine.ruby-lang.org/repositories/revision/ruby-191?rev=26038">26038</a>. However, this fix was a bit buggy: <a href="http://redmine.ruby-lang.org/issues/show/2463">#2463</a>. This issue was fixed in trunk by SVN revision <a href="http://redmine.ruby-lang.org/repositories/revision/ruby-19?rev=26052">26052</a> on December 9, 2009.<br />
<br />
Now the funny thing. <a href="http://www.ruby-lang.org/en/downloads/">http://www.ruby-lang.org/en/downloads/</a> says "<i>The current stable version is 1.9.1</i>" and "<i>Ruby 1.9.1-p376 (md5: ebb20550a11e7f1a2fbd6fdec2a3e0a3) Stable Version (recommended)</i>".<br />
<br />
For those who still don't get it: neither 1.9.1-p376 nor ruby_1_9_1 branch at all contains fix for <a href="http://redmine.ruby-lang.org/issues/show/2463">#2463</a>. I tried to add <a href="http://redmine.ruby-lang.org/issues/show/2532">another issue</a>, which was immediately closed as "<i>duplicate of #2463</i>".<br />
<br />
19 days have passed so far and current recommended stable version still contains bug that nobody cares about. By the way, this bug affects Rails.<br />
<br />
Have a nice day.raornhttp://www.blogger.com/profile/15819002999407397097noreply@blogger.com0tag:blogger.com,1999:blog-268892197058794512.post-74439301327377216042009-12-15T00:39:00.002+03:002009-12-15T02:27:20.831+03:00Unit tests? We don't need no stinkin' unit tests!While packaging ruby-coderay for ALT Linux I ran into problem that tests just fail. Well, this is not really a problem, because we have Ruby 1.9.1 and there may be some obsolete language constructions or encoding issues. In fact, there was two issues that happen only on Ruby 1.9.x - Marshall::dump adds encoding information and output differs from expected. Other seven errors were really funny.<div><br /></div><div>Seven tests fail in CSS section of HTML output. Browsing through revision history brought me to [<a href="http://redmine.rubychan.de/projects/coderay/repository/revisions/332/diff/trunk/lib/coderay/styles/cycnus.rb">r332</a>] and [<a href="http://redmine.rubychan.de/projects/coderay/repository/revisions/329/diff/trunk/lib/coderay/styles/cycnus.rb">r329</a>], both commited by Upstream Developer around 22 Apr 2009. Patch was <a href="http://git.altlinux.org/people/raorn/packages/?p=ruby-coderay.git;a=commit;h=109be030">obvious</a> and commited in my repo on 29 Jul 2009.</div><div><br /></div><div>After several months I've decided to update ruby-coderay package. There was another amazing [<a href="http://redmine.rubychan.de/projects/coderay/repository/revisions/372/diff/trunk/lib/coderay/styles/cycnus.rb">r372</a>] commited on 18 Oct 2009. And fixed with another <a href="http://git.altlinux.org/people/raorn/packages/?p=ruby-coderay.git;a=commit;h=bae01a63">obvious patch</a> on 09 Nov 2009.</div><div><br /></div><div>Since Aplil 2009 only one test was fixed by [<a href="http://redmine.rubychan.de/projects/coderay/repository/revisions/361">r361</a>] on 10 Oct 2009.</div><div><br /></div><div>Bottom line: test suite for CodeRay project has been broken for almost eight months and nobody gives a fuck. Gosh, I <b>LOVE</b> Free Software!</div>raornhttp://www.blogger.com/profile/15819002999407397097noreply@blogger.com0tag:blogger.com,1999:blog-268892197058794512.post-21977071351941831942009-12-14T23:21:00.004+03:002009-12-15T03:29:45.406+03:00I told ya!More than three years ago I've <a href="http://marc.info/?l=vim-dev&m=115695834604484&w=2">reported an issue</a> about filetype detection in Vim.<br />
<div><br />
</div><div>Vim tries to detect filetype by file name and contents. If there were no match in builtin rules and file contains #-comment in first several lines, it's filetype is set to "<i>conf</i>". But then it sources additional user-provided filetype detection scripts.<br />
</div><div><br />
</div><div>There is :setfiletype command, that sets "<i>the 'filetype' option to {filetype}, but only if not done yet in a sequence of (nested) autocommands</i>", which can not be used for files, those filetype already set to "<i>conf</i>" by this fallback code.<br />
</div><div><br />
</div><div>I suggested to move loading of user-provided filetype detection scripts above this fallback code and immediately received replies that I "<i><a href="http://marc.info/?l=vim-dev&m=115696738231372&w=2">should never create, delete or modify any file in the $VIMRUNTIME directory tree</a></i>" and "<i><a href="http://marc.info/?l=vim-dev&m=115696847805768&w=2">current method is correct</a></i>".<br />
</div><div><br />
</div><div>Finally, <a href="http://groups.google.com/group/vim_dev/browse_thread/thread/2e8b6a637debd0f">new patch appears</a>. After <b>THREE FUCKING YEARS</b>!<br />
</div><div><br />
</div><div>I hate them...<br />
</div>raornhttp://www.blogger.com/profile/15819002999407397097noreply@blogger.com0tag:blogger.com,1999:blog-268892197058794512.post-62153202465423098492009-12-14T23:04:00.002+03:002009-12-14T23:10:08.983+03:00HATE, HATE, HATE!I really need a place to dump all hate that accumulates inside me from time to time. Readers are allowed to dump all their hate in comments section.raornhttp://www.blogger.com/profile/15819002999407397097noreply@blogger.com0