YaST/What Sucks

From openSUSE

Here are ideas where you can use your time making things rocks

Syntax errors in ycp components

Given a ycp file with a syntax error

# cat /tmp/foo.ycp
{

foo()

}

The compiler does the right job:

#ycpc -c /tmp/foo.ycp
compiling to '/tmp/foo.ybc'
parsing '/tmp/foo.ycp'
/tmp/foo.ycp:3  [Parser] Undeclared identifier 'foo'
/tmp/foo.ycp:5  [Parser] syntax error, unexpected '}', expecting ';'
Error

However if YaST is launched, a useless and incorrect error message is given, usually saying an error while creating the client module, with no details, or that such client is not found.

If such client is started, it behaves as expected:

yast2 ./foo.ycp 
Error while creating client module ./foo.ycp

and one can find errors in YaST logs according to good habits:

2008-06-16 12:14:23 <1> seven(22527) [liby2] genericfrontend.cc(main):561 Launched YaST2 component 'y2base' './foo.ycp' '-S' 'qt'
2008-06-16 12:14:23 <1> seven(22527) [ui-component] YUIComponentCreator.cc(createInternal):113 Creating UI component for ""
2008-06-16 12:14:23 <1> seven(22527) [ui-component] YUIComponentCreator.cc(createInternal):128 Returning existing UI component for "qt"
2008-06-16 12:14:23 <3> seven(22527) [Parser] test/foo.ycp:3 Undeclared identifier 'foo'
2008-06-16 12:14:23 <3> seven(22527) [Parser] test/foo.ycp:5 syntax error, unexpected '}', expecting ';'
2008-06-16 12:14:23 <1> seven(22527) [wfm] Y2CCWFM.cc(createInLevel):148 Parsing finished
2008-06-16 12:14:23 <3> seven(22527) [liby2] genericfrontend.cc(print_error):793 Error while creating client module ./foo.ycp

That's actually intentional because YaST modules are mostly started from control center without any terminal where to print such errors. Moreover common user is not interested in reading strange errors on stderr. That would mean: Linux is for Geeks only.

Generated Bindings for libstorage

The current bindings are very cumbersome to use in YCP. E.g. a C struct is not transformed into a YCP map. Instead every member of the C struct must be accessed by swig_xxx_set and swig_xxx_get. Also C enums are not transformed to YCP symbols.

Improved bindings should provide:

  • C++ enum -> YCP symbol
  • C++ struct -> YCP map
  • C++ struct inside C++ struct -> YCP map inside YCP map
  • simple C++ inheritance -> YCP map with members of all classes


Types of builtin merge

The builtin merge for lists has the return type list<any>. Thus even for two lists of identical types the return value is of type list<any>. So normally a cast is required:

list<integer> m = merge([1, 2], [3, 4]);                      // error
list<integer> m = (list<integer>) merge([1, 2], [3, 4]);      // ok

A workaround is to use flatten:

list<integer> m = flatten([ [1, 2], [3, 4] ]);                // ok