Comments, Code and Qt. Some words about the wonderful world of software engineering

13Feb/120

‘sudo ./script.sh: command not found’ on Ubuntu

Posted by kypeli

I am pretty sure I could run my script last week, but I cannot anymore today.

kypeli@ubuntu:~$ sudo ./myscript.sh
[sudo] password for kypeli:
sudo: ./myscript: command not found

Obviously this was very strange to me because the script was in the current working directory, all permissions looked fine and I could run the script just fine without sudo, which indicated that the shebang was ok.

kypeli@ubuntu:~$ ls -la ./script.sh
-rwxr-xr-x 1 root root 568 2012-02-13 05:49 ./script.sh

kypeli@ubuntu:~$ ./script.sh
Usage: ./script.sh [foobar] Give 'foobar' to do Baz

So what has happened? Apparently Ubuntu changed something in some update (I am still to verify this) which prevents me from running scripts as sudoer from other than sudo compile time predefined paths. You can verify this by looking at the flags that were used to compile sudo and look for the --with-secure-path option. sudo will not run any script (or command for that matter) outside of these paths. Including .

kypeli@ubuntu:~$ cat /usr/share/doc/sudo/OPTIONS
...
--with-secure-path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin"

Give a reasonable default path for commands run as root via sudo.

Well - this was a bit annoying to me for two reasons. I am pretty sure this worked for me last week on my Ubuntu, but suddenly it doesn't work anymore. And secondly, I am not running any public server and I want to run my own scripts with root privileges (why I want to do that is a different topic :) ) if I so choose. I must stress that I can see the reasons for doing this and security is always a trade off between security and usability. I would not do this on any public server, but for Ubuntu to not allow me to run my own commands as root is a bit annoying.

Luckily I found this tip from Björn Wijers' blog: http://www.burobjorn.nl/blog/2012/01/04/fix-sudo-and-path-environment-variable-on-ubuntu/

Seems he had the same issue than I had and wants to run his own scripts as root. Thanks to his tip I can now run my own scripts with the sudo command again. This will enable the fix only for me, as I put the alias in my .bashrc file, so it's not even a terrible security risk. And that's fine.

I would also like to thank @anidel for pointing out initially this possibility.

Technorati Tags: , , , , , ,

23Jan/120

Sunday evening fun: Windows Phone 7 styled progress indicator in QML

Posted by kypeli

I started a new coding hobby project today. But instead of actually getting very far with the productive part of the project I got side tracked on something fun I wanted to try out (don't you just love when that happens :) That's not possible when coding at work...). I wanted to share this day's outcome with you.

Let me introduce this humble video show casing a Windows Phone 7 styled loading indicator in QML :)

You can get the source code for this small thing (GPL licensed) from here: https://gitorious.org/qtquicktests/qtquicktests/trees/master/wp7-loading.

Technorati Tags: , , ,

12Dec/115

Porting MeeGo Qt Components apps to Symbian

Posted by kypeli

Of course I don't have all the answers to what needs to be done for any given MeeGo Qt Component based application to have it running on Symbian, but I think I have three general actions that need to be done when porting an app from MeeGo to Symbian; have it run with the resources, make the code compile and tweak the UI.

Thanks to Symbian Annan both MeeGo and Symbian run Qt 4.7.4 with Qt Quick and Qt Components which is of course the reason why this kind of porting is even possible with a reasonable effort. As I wrote in my earlier blog post, even though both Symbian and MeeGo run Qt and Qt Components, it's not perfect. I think too much manual work still has to be done, but it's a reasonable effort and when you read through my hints, I think the tasks ahead become clearer.

Technorati Tags: , , , , ,

9Dec/112

I passed the Nokia Certified Qt Specialist test

Posted by kypeli

I just have to put it out here; I am now a Nokia Certified Qt Specialist which means I have the right to use the logo below. I have no idea where I would use it in the future, so let's have it at least here on my blog :)

It's nice to be able to join the club of Qt experts. Under NDA I cannot speak about the test itself, but I can tell you that it had some tricky questions as well :) But please instead poke me about any Qt question!

Technorati Tags: ,

6Dec/114

A MeeGo developer’s endeavors to the Symbian Qt world

Posted by kypeli

I've been working with Qt for a while already and we all know what a great cross-platform framework it is. When Nokia bought Trolltech in 2008 it was clear that Nokia wanted to make Symbian development easier. However, the QWidget based toolkit would not fly on Symbian, or any other mobile platform for that matter, so Nokia built some mobile UI frameworks on Qt (and oh boy Nokia is good at building frameworks for everything. Everyone should have at least one framework, if not two. I could write another blog post about that...). But while people in Europe were fighting over their frameworks, it was not until the guys and gals in Brisbane came up with QML when everything changed. Qt could finally be cross platform again and in an elegant way!

Symbian just isn't my cup of tea. But that doesn't prevent me from wanting to write something for Symbian if for nothing else other than being able to say I've done it. But just thinking of Symbian C++ or Avkon makes me feel sick. This has changed thanks to QML and especially Qt Components. Also Nokia has finally been able to put out a single SDK that I can just install, write Qt with, deploy the same code on any Qt-based Nokia mobile, publish in the Nokia Store and... Profit! Right? Well, my opportunity to find out came now thanks to my podcast application, Podcatcher for N9, that I've written for the Nokia N9 smartphone. It's has a MeeGo Harmattan Qt Components based UI with a Qt C++ middleware. These are my comments as a former MeeGo developer on the journey to the Qt world of Symbian.

Technorati Tags: , , , ,