Tuesday, July 17, 2007

SUDO, Pardon!

First, this will be short. Previous post was long enough to make you bored probably :)

Now, to the point. On my last post I said it was all sudo's fault for not creating Scheduler control file correctly, and I was wrong.

I wasn't even looking at that problem now, I was continuing with Timeline integration with rest of umitInventory and umitDB but for some unknown reason I just wanted to fix that strange bug.

From the previous post: "Running with sudo at console causes the Scheduler to not create a control file at user home dir, but it runs fine and everything that it needs to do is done, except that it can't be stopped by the controller since it didn't create the control file."

But what was happening was: I've done a function that checks if a process is running at all, on UNIX, it uses kill for that. So, it was working like this: send kill to the pid with signal 0, if it throws an OSError exception the process is not running... WRONG!

Throwing an OSError doesn't mean the process is not running, I needed to check errno also. An OSError with errno equals 3 ('ESRCH') means the process isn't running (errno 3 is 'No such process'), but since I ran the process with sudo it was returning errno equals 1 that means 'Operation not permitted' and then it was returning False and the control file would get deleted and I would think that the control file wasn't created at all.

Now this bug is fixed at least =)

And again, forgive me SUDO.

2 comments:

  1. i'm sorry,
    but please, can you tell me which builder you use for programming interface of UMIT frontend ?

    ReplyDelete
  2. Hello mrantond and sorry for the long delay.

    I haven't used any interface builder, I do everything either using VIm or Wing IDE.

    ReplyDelete