Re: [Sugar-devel] "Another osbuild instance is running" error

2016-01-02 Thread Shraddha Barke


Thanks a lot James. I was able to build and run sugar successfully

Kind Regards,
Shraddha
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] "Another osbuild instance is running" error

2016-01-02 Thread James Cameron
On Sat, Jan 02, 2016 at 12:30:25PM +0530, Shraddha Barke wrote:
> 
> 
> On Sat, 2 Jan 2016, James Cameron wrote:
> 
> >On Sat, Jan 02, 2016 at 10:21:12AM +0530, Shraddha Barke wrote:
> >>
> >>
> >>On Sat, 2 Jan 2016, James Cameron wrote:
> >>
> >>>On Fri, Jan 01, 2016 at 08:38:34PM +0530, Shraddha Barke wrote:
> 
> 
> On Fri, 1 Jan 2016, James Cameron wrote:
> 
> >On Thu, Dec 31, 2015 at 11:26:26PM +0530, Shraddha Barke wrote:
> >>
> >>
> >>On Thu, 31 Dec 2015, James Cameron wrote:
> >>
> >>>On Thu, Dec 31, 2015 at 03:38:02AM +0530, Shraddha Barke wrote:
> >On Wed, Dec 30, 2015 at 04:30:17AM +0530, Shraddha Barke wrote:
> >>I am trying to build sugar on Ubuntu 15.04 laptop. After git clone
> >>and cd into sugar-build I get this error-Another osbuild instance is
> >>running on executing ./osbuild pull
> >>I searched the internet and found 2 such threads but the issue 
> >>wasn't
> >>resolved.
> >
> >There's more than two such threads on sugar-devel at .
> >
> >>Is this a bug that needs fixing?
> >
> >Yes, it's a bug in osbuild, please fix it.
> 
> >>Hello James,
> >>I made the following changes in check_lock()
> >>
> >>def check_lock():
> >>-try:
> >>-fcntl.lockf(get_lock_file(), fcntl.LOCK_EX | fcntl.LOCK_NB)
> >>-except IOError:
> >>-return False
> >>-
> >>-return True
> >>-
> >>
> >>+   pid = os.getpid()
> >>+   try:
> >>+fcntl.lockf(pid, fcntl.LOCK_EX | fcntl.LOCK_NB)
> >>+   except IOError:
> >>+   return False
> >>+   try:
> >>+   os.kill(pid(), 0)
> >>+   except OSError:
> >>+return False
> >>+return True
> >
> >Ah, that's not what I meant.
> >
> >But I was wrong to suggest a redesign using getpid and kill, because
> >my analysis of the code _today_ shows the underlying cause must be
> >something other than locking.
> >
> >Let me explain.
> >
> >check_lock does try fcntl.lock, and if an exception IOError occurs,
> >does return False.
> >
> >But inside the same try clause is a call to get_lock_file.  Therefore
> >any IOError inside get_lock_file will also cause check_lock to return
> >False.
> >
> >A possible error is that the file could not be opened for write,
> >e.g. because it is owned by someone else, or the protection mask
> >(chmod) is wrong, or the directory does not exist, or the directory is
> >protected.
> >
> >def check_lock():
> > lock_file = get_lock_file()
> > try:
> > fcntl.lockf(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)
> > except IOError:
> > return False
> >
> > return True
> >
> >As a result of this change, any problem opening and writing to the
> >file will be reported before the "another instance" error.
> >
> 
> Ah Got it! Thanks :)
> 
> Like you said it's a permission error. I've posted it below -
> 
> Traceback (most recent call last):
>  File "./osbuild", line 504, in 
>    if not main():
>  File "./osbuild", line 467, in main
>    if not check_lock():
>  File "./osbuild", line 406, in check_lock
>    lock_file = get_lock_file()
>  File "./osbuild", line 90, in get_lock_file
>    lock_file = open(get_lock_file_path(), "w")
> IOError: [Errno 13] Permission denied:
> '/home/shraddha/git/sugar-build/.lock-host'
> >>>
> >>>Okay, that will certainly stop osbuild from working.
> >>>
> 
> >>
> >>so that when there is no process running false is returned. However it 
> >>is
> >>not fixing the bug.
> >>And yeah when I try to delete the lock file, I get 'file or
> >>directory doesn't exist'
> >
> >That's not possible to explain given the data you sent.
> >
> >You said the print statement showed the file path as
> >
> >.../git/sugar-build/.lock-host
> >
> >Presumably ... is something like /home/username
> >
> >Does the .lock-host file still exist?
> >
> >Show me "stat .lock-host"?
> >
> >If the file exists, but you cannot delete it, then osbuild will fail
> >to open it for write.
> >
> 
> stat: cannot stat ‘.lock-host’: No such file or directory
> 
> This is what I get. It's confusing that although it's failing to write,
> stat says no such directory exists!
> >>>
> >>>Ye, that is strange.  On the one hand the file exists and cannot be
> >>>opened for write, yet now the file does not exist.
> >>>
> >>>Please check you are in the right directory when you use stat, or use
> >>>stat with the same full path to the file (as reported by osbuild);
> >>>
> >>>   stat /home/shraddha/git/sugar-build/.lock-host
> >>>
> >>>I'm trying not to presume any 

Re: [Sugar-devel] "Another osbuild instance is running" error

2016-01-01 Thread Shraddha Barke



On Sat, 2 Jan 2016, James Cameron wrote:


On Fri, Jan 01, 2016 at 08:38:34PM +0530, Shraddha Barke wrote:



On Fri, 1 Jan 2016, James Cameron wrote:


On Thu, Dec 31, 2015 at 11:26:26PM +0530, Shraddha Barke wrote:



On Thu, 31 Dec 2015, James Cameron wrote:


On Thu, Dec 31, 2015 at 03:38:02AM +0530, Shraddha Barke wrote:

On Wed, Dec 30, 2015 at 04:30:17AM +0530, Shraddha Barke wrote:

I am trying to build sugar on Ubuntu 15.04 laptop. After git clone
and cd into sugar-build I get this error-Another osbuild instance is
running on executing ./osbuild pull
I searched the internet and found 2 such threads but the issue wasn't
resolved.


There's more than two such threads on sugar-devel at .


Is this a bug that needs fixing?


Yes, it's a bug in osbuild, please fix it.



Hello James,
I made the following changes in check_lock()

def check_lock():
-try:
-fcntl.lockf(get_lock_file(), fcntl.LOCK_EX | fcntl.LOCK_NB)
-except IOError:
-return False
-
-return True
-

+   pid = os.getpid()
+   try:
+fcntl.lockf(pid, fcntl.LOCK_EX | fcntl.LOCK_NB)
+   except IOError:
+   return False
+   try:
+   os.kill(pid(), 0)
+   except OSError:
+return False
+return True


Ah, that's not what I meant.

But I was wrong to suggest a redesign using getpid and kill, because
my analysis of the code _today_ shows the underlying cause must be
something other than locking.

Let me explain.

check_lock does try fcntl.lock, and if an exception IOError occurs,
does return False.

But inside the same try clause is a call to get_lock_file.  Therefore
any IOError inside get_lock_file will also cause check_lock to return
False.

A possible error is that the file could not be opened for write,
e.g. because it is owned by someone else, or the protection mask
(chmod) is wrong, or the directory does not exist, or the directory is
protected.

def check_lock():
  lock_file = get_lock_file()
  try:
  fcntl.lockf(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)
  except IOError:
  return False

  return True

As a result of this change, any problem opening and writing to the
file will be reported before the "another instance" error.



Ah Got it! Thanks :)

Like you said it's a permission error. I've posted it below -

Traceback (most recent call last):
  File "./osbuild", line 504, in 
if not main():
  File "./osbuild", line 467, in main
if not check_lock():
  File "./osbuild", line 406, in check_lock
lock_file = get_lock_file()
  File "./osbuild", line 90, in get_lock_file
lock_file = open(get_lock_file_path(), "w")
IOError: [Errno 13] Permission denied:
'/home/shraddha/git/sugar-build/.lock-host'


Okay, that will certainly stop osbuild from working.





so that when there is no process running false is returned. However it is
not fixing the bug.
And yeah when I try to delete the lock file, I get 'file or
directory doesn't exist'


That's not possible to explain given the data you sent.

You said the print statement showed the file path as

.../git/sugar-build/.lock-host

Presumably ... is something like /home/username

Does the .lock-host file still exist?

Show me "stat .lock-host"?

If the file exists, but you cannot delete it, then osbuild will fail
to open it for write.



stat: cannot stat ‘.lock-host’: No such file or directory

This is what I get. It's confusing that although it's failing to write,
stat says no such directory exists!


Ye, that is strange.  On the one hand the file exists and cannot be
opened for write, yet now the file does not exist.

Please check you are in the right directory when you use stat, or use
stat with the same full path to the file (as reported by osbuild);

stat /home/shraddha/git/sugar-build/.lock-host

I'm trying not to presume any knowledge; if you only type "stat
.lock-host", then the stat program will look for the file .lock-host
in the current directory.  You can see what the current directory is
by typing "pwd".  You can change the current directory using the "cd"
command.



stat: cannot stat ‘/home/shraddha/git/sugar-build/.lock-host’: No such 
file or directory


I'm searching why this is happening. Meanwhile if anything strikes you
do let me know

Kind Regards,
Shraddha___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] "Another osbuild instance is running" error

2016-01-01 Thread Shraddha Barke



On Sat, 2 Jan 2016, James Cameron wrote:


On Sat, Jan 02, 2016 at 10:21:12AM +0530, Shraddha Barke wrote:



On Sat, 2 Jan 2016, James Cameron wrote:


On Fri, Jan 01, 2016 at 08:38:34PM +0530, Shraddha Barke wrote:



On Fri, 1 Jan 2016, James Cameron wrote:


On Thu, Dec 31, 2015 at 11:26:26PM +0530, Shraddha Barke wrote:



On Thu, 31 Dec 2015, James Cameron wrote:


On Thu, Dec 31, 2015 at 03:38:02AM +0530, Shraddha Barke wrote:

On Wed, Dec 30, 2015 at 04:30:17AM +0530, Shraddha Barke wrote:

I am trying to build sugar on Ubuntu 15.04 laptop. After git clone
and cd into sugar-build I get this error-Another osbuild instance is
running on executing ./osbuild pull
I searched the internet and found 2 such threads but the issue wasn't
resolved.


There's more than two such threads on sugar-devel at .


Is this a bug that needs fixing?


Yes, it's a bug in osbuild, please fix it.



Hello James,
I made the following changes in check_lock()

def check_lock():
-try:
-fcntl.lockf(get_lock_file(), fcntl.LOCK_EX | fcntl.LOCK_NB)
-except IOError:
-return False
-
-return True
-

+   pid = os.getpid()
+   try:
+fcntl.lockf(pid, fcntl.LOCK_EX | fcntl.LOCK_NB)
+   except IOError:
+   return False
+   try:
+   os.kill(pid(), 0)
+   except OSError:
+return False
+return True


Ah, that's not what I meant.

But I was wrong to suggest a redesign using getpid and kill, because
my analysis of the code _today_ shows the underlying cause must be
something other than locking.

Let me explain.

check_lock does try fcntl.lock, and if an exception IOError occurs,
does return False.

But inside the same try clause is a call to get_lock_file.  Therefore
any IOError inside get_lock_file will also cause check_lock to return
False.

A possible error is that the file could not be opened for write,
e.g. because it is owned by someone else, or the protection mask
(chmod) is wrong, or the directory does not exist, or the directory is
protected.

def check_lock():
 lock_file = get_lock_file()
 try:
 fcntl.lockf(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)
 except IOError:
 return False

 return True

As a result of this change, any problem opening and writing to the
file will be reported before the "another instance" error.



Ah Got it! Thanks :)

Like you said it's a permission error. I've posted it below -

Traceback (most recent call last):
 File "./osbuild", line 504, in 
   if not main():
 File "./osbuild", line 467, in main
   if not check_lock():
 File "./osbuild", line 406, in check_lock
   lock_file = get_lock_file()
 File "./osbuild", line 90, in get_lock_file
   lock_file = open(get_lock_file_path(), "w")
IOError: [Errno 13] Permission denied:
'/home/shraddha/git/sugar-build/.lock-host'


Okay, that will certainly stop osbuild from working.





so that when there is no process running false is returned. However it is
not fixing the bug.
And yeah when I try to delete the lock file, I get 'file or
directory doesn't exist'


That's not possible to explain given the data you sent.

You said the print statement showed the file path as

.../git/sugar-build/.lock-host

Presumably ... is something like /home/username

Does the .lock-host file still exist?

Show me "stat .lock-host"?

If the file exists, but you cannot delete it, then osbuild will fail
to open it for write.



stat: cannot stat ‘.lock-host’: No such file or directory

This is what I get. It's confusing that although it's failing to write,
stat says no such directory exists!


Ye, that is strange.  On the one hand the file exists and cannot be
opened for write, yet now the file does not exist.

Please check you are in the right directory when you use stat, or use
stat with the same full path to the file (as reported by osbuild);

stat /home/shraddha/git/sugar-build/.lock-host

I'm trying not to presume any knowledge; if you only type "stat
.lock-host", then the stat program will look for the file .lock-host
in the current directory.  You can see what the current directory is
by typing "pwd".  You can change the current directory using the "cd"
command.



stat: cannot stat ‘/home/shraddha/git/sugar-build/.lock-host’: No
such file or directory

I'm searching why this is happening. Meanwhile if anything strikes you
do let me know


Since the open does fail, and yet the file does not exist, the problem
must be in creating the file.

The most likely cause is owner or protection mask of the directory;
the directory in which the file is to be created, so please check:

stat /home/shraddha/git/sugar-build

Example expected output;

 File: ‘/home/use/git/sugar-build’
 Size: x   Blocks: xx IO Block:    directory
Device: xxxh/d  Inode: Links: xxx
Access: (0755/drwxr-xr-x)  Uid: ( 1000/   user)   Gid: ( 1000/   user)
Access: 2016-01-02 17:15:56.881528661 +1100
Modify: 2016-01-02 17:14:19.290923184 +1100
Change: 

Re: [Sugar-devel] "Another osbuild instance is running" error

2016-01-01 Thread James Cameron
On Sat, Jan 02, 2016 at 10:21:12AM +0530, Shraddha Barke wrote:
> 
> 
> On Sat, 2 Jan 2016, James Cameron wrote:
> 
> >On Fri, Jan 01, 2016 at 08:38:34PM +0530, Shraddha Barke wrote:
> >>
> >>
> >>On Fri, 1 Jan 2016, James Cameron wrote:
> >>
> >>>On Thu, Dec 31, 2015 at 11:26:26PM +0530, Shraddha Barke wrote:
> 
> 
> On Thu, 31 Dec 2015, James Cameron wrote:
> 
> >On Thu, Dec 31, 2015 at 03:38:02AM +0530, Shraddha Barke wrote:
> >>>On Wed, Dec 30, 2015 at 04:30:17AM +0530, Shraddha Barke wrote:
> I am trying to build sugar on Ubuntu 15.04 laptop. After git clone
> and cd into sugar-build I get this error-Another osbuild instance is
> running on executing ./osbuild pull
> I searched the internet and found 2 such threads but the issue wasn't
> resolved.
> >>>
> >>>There's more than two such threads on sugar-devel at .
> >>>
> Is this a bug that needs fixing?
> >>>
> >>>Yes, it's a bug in osbuild, please fix it.
> >>
> Hello James,
> I made the following changes in check_lock()
> 
> def check_lock():
> -try:
> -fcntl.lockf(get_lock_file(), fcntl.LOCK_EX | fcntl.LOCK_NB)
> -except IOError:
> -return False
> -
> -return True
> -
> 
> +   pid = os.getpid()
> +   try:
> +fcntl.lockf(pid, fcntl.LOCK_EX | fcntl.LOCK_NB)
> +   except IOError:
> +   return False
> +   try:
> +   os.kill(pid(), 0)
> +   except OSError:
> +return False
> +return True
> >>>
> >>>Ah, that's not what I meant.
> >>>
> >>>But I was wrong to suggest a redesign using getpid and kill, because
> >>>my analysis of the code _today_ shows the underlying cause must be
> >>>something other than locking.
> >>>
> >>>Let me explain.
> >>>
> >>>check_lock does try fcntl.lock, and if an exception IOError occurs,
> >>>does return False.
> >>>
> >>>But inside the same try clause is a call to get_lock_file.  Therefore
> >>>any IOError inside get_lock_file will also cause check_lock to return
> >>>False.
> >>>
> >>>A possible error is that the file could not be opened for write,
> >>>e.g. because it is owned by someone else, or the protection mask
> >>>(chmod) is wrong, or the directory does not exist, or the directory is
> >>>protected.
> >>>
> >>>def check_lock():
> >>>  lock_file = get_lock_file()
> >>>  try:
> >>>  fcntl.lockf(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)
> >>>  except IOError:
> >>>  return False
> >>>
> >>>  return True
> >>>
> >>>As a result of this change, any problem opening and writing to the
> >>>file will be reported before the "another instance" error.
> >>>
> >>
> >>Ah Got it! Thanks :)
> >>
> >>Like you said it's a permission error. I've posted it below -
> >>
> >>Traceback (most recent call last):
> >>  File "./osbuild", line 504, in 
> >>if not main():
> >>  File "./osbuild", line 467, in main
> >>if not check_lock():
> >>  File "./osbuild", line 406, in check_lock
> >>lock_file = get_lock_file()
> >>  File "./osbuild", line 90, in get_lock_file
> >>lock_file = open(get_lock_file_path(), "w")
> >>IOError: [Errno 13] Permission denied:
> >>'/home/shraddha/git/sugar-build/.lock-host'
> >
> >Okay, that will certainly stop osbuild from working.
> >
> >>
> 
> so that when there is no process running false is returned. However it is
> not fixing the bug.
> And yeah when I try to delete the lock file, I get 'file or
> directory doesn't exist'
> >>>
> >>>That's not possible to explain given the data you sent.
> >>>
> >>>You said the print statement showed the file path as
> >>>
> >>>.../git/sugar-build/.lock-host
> >>>
> >>>Presumably ... is something like /home/username
> >>>
> >>>Does the .lock-host file still exist?
> >>>
> >>>Show me "stat .lock-host"?
> >>>
> >>>If the file exists, but you cannot delete it, then osbuild will fail
> >>>to open it for write.
> >>>
> >>
> >>stat: cannot stat ‘.lock-host’: No such file or directory
> >>
> >>This is what I get. It's confusing that although it's failing to write,
> >>stat says no such directory exists!
> >
> >Ye, that is strange.  On the one hand the file exists and cannot be
> >opened for write, yet now the file does not exist.
> >
> >Please check you are in the right directory when you use stat, or use
> >stat with the same full path to the file (as reported by osbuild);
> >
> > stat /home/shraddha/git/sugar-build/.lock-host
> >
> >I'm trying not to presume any knowledge; if you only type "stat
> >.lock-host", then the stat program will look for the file .lock-host
> >in the current directory.  You can see what the current directory is
> >by typing "pwd".  You can change the current directory using the "cd"
> >command.
> 
> 
> stat: cannot stat ‘/home/shraddha/git/sugar-build/.lock-host’: No
> such file or directory
> 
> I'm searching why this is happening. 

Re: [Sugar-devel] "Another osbuild instance is running" error

2016-01-01 Thread James Cameron
On Fri, Jan 01, 2016 at 08:38:34PM +0530, Shraddha Barke wrote:
> 
> 
> On Fri, 1 Jan 2016, James Cameron wrote:
> 
> >On Thu, Dec 31, 2015 at 11:26:26PM +0530, Shraddha Barke wrote:
> >>
> >>
> >>On Thu, 31 Dec 2015, James Cameron wrote:
> >>
> >>>On Thu, Dec 31, 2015 at 03:38:02AM +0530, Shraddha Barke wrote:
> >On Wed, Dec 30, 2015 at 04:30:17AM +0530, Shraddha Barke wrote:
> >>I am trying to build sugar on Ubuntu 15.04 laptop. After git clone
> >>and cd into sugar-build I get this error-Another osbuild instance is
> >>running on executing ./osbuild pull
> >>I searched the internet and found 2 such threads but the issue wasn't
> >>resolved.
> >
> >There's more than two such threads on sugar-devel at .
> >
> >>Is this a bug that needs fixing?
> >
> >Yes, it's a bug in osbuild, please fix it.
> 
> >>Hello James,
> >>I made the following changes in check_lock()
> >>
> >>def check_lock():
> >>-try:
> >>-fcntl.lockf(get_lock_file(), fcntl.LOCK_EX | fcntl.LOCK_NB)
> >>-except IOError:
> >>-return False
> >>-
> >>-return True
> >>-
> >>
> >>+   pid = os.getpid()
> >>+   try:
> >>+fcntl.lockf(pid, fcntl.LOCK_EX | fcntl.LOCK_NB)
> >>+   except IOError:
> >>+   return False
> >>+   try:
> >>+   os.kill(pid(), 0)
> >>+   except OSError:
> >>+return False
> >>+return True
> >
> >Ah, that's not what I meant.
> >
> >But I was wrong to suggest a redesign using getpid and kill, because
> >my analysis of the code _today_ shows the underlying cause must be
> >something other than locking.
> >
> >Let me explain.
> >
> >check_lock does try fcntl.lock, and if an exception IOError occurs,
> >does return False.
> >
> >But inside the same try clause is a call to get_lock_file.  Therefore
> >any IOError inside get_lock_file will also cause check_lock to return
> >False.
> >
> >A possible error is that the file could not be opened for write,
> >e.g. because it is owned by someone else, or the protection mask
> >(chmod) is wrong, or the directory does not exist, or the directory is
> >protected.
> >
> >def check_lock():
> >   lock_file = get_lock_file()
> >   try:
> >   fcntl.lockf(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)
> >   except IOError:
> >   return False
> >
> >   return True
> >
> >As a result of this change, any problem opening and writing to the
> >file will be reported before the "another instance" error.
> >
> 
> Ah Got it! Thanks :)
> 
> Like you said it's a permission error. I've posted it below -
> 
> Traceback (most recent call last):
>   File "./osbuild", line 504, in 
> if not main():
>   File "./osbuild", line 467, in main
> if not check_lock():
>   File "./osbuild", line 406, in check_lock
> lock_file = get_lock_file()
>   File "./osbuild", line 90, in get_lock_file
> lock_file = open(get_lock_file_path(), "w")
> IOError: [Errno 13] Permission denied:
> '/home/shraddha/git/sugar-build/.lock-host'

Okay, that will certainly stop osbuild from working.

> 
> >>
> >>so that when there is no process running false is returned. However it is
> >>not fixing the bug.
> >>And yeah when I try to delete the lock file, I get 'file or
> >>directory doesn't exist'
> >
> >That's not possible to explain given the data you sent.
> >
> >You said the print statement showed the file path as
> >
> >.../git/sugar-build/.lock-host
> >
> >Presumably ... is something like /home/username
> >
> >Does the .lock-host file still exist?
> >
> >Show me "stat .lock-host"?
> >
> >If the file exists, but you cannot delete it, then osbuild will fail
> >to open it for write.
> >
> 
> stat: cannot stat ‘.lock-host’: No such file or directory
> 
> This is what I get. It's confusing that although it's failing to write,
> stat says no such directory exists!

Ye, that is strange.  On the one hand the file exists and cannot be
opened for write, yet now the file does not exist.

Please check you are in the right directory when you use stat, or use
stat with the same full path to the file (as reported by osbuild);

stat /home/shraddha/git/sugar-build/.lock-host

I'm trying not to presume any knowledge; if you only type "stat
.lock-host", then the stat program will look for the file .lock-host
in the current directory.  You can see what the current directory is
by typing "pwd".  You can change the current directory using the "cd"
command.

> Kind Regards,
> Shraddha
> 
> >>Sorry for the novice questions :(
> >
> >When you see me say something that doesn't match what you see, please
> >be sure to tell me about it!
> >
> >>
> >>Kind Regards,
> >>Shraddha
> >>
> >>>
> >>>--
> >>>James Cameron
> >>>http://quozl.netrek.org/
> >>>
> >
> >-- 
> >James Cameron
> >http://quozl.netrek.org/
> >


-- 
James Cameron
http://quozl.netrek.org/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org

Re: [Sugar-devel] "Another osbuild instance is running" error

2016-01-01 Thread Iain Brown Douglas
On Sat, 2016-01-02 at 10:21 +0530, Shraddha Barke wrote:
> 
> On Sat, 2 Jan 2016, James Cameron wrote:
> 
> > On Fri, Jan 01, 2016 at 08:38:34PM +0530, Shraddha Barke wrote:
> >>
> >>
> >> On Fri, 1 Jan 2016, James Cameron wrote:
> >>
> >>> On Thu, Dec 31, 2015 at 11:26:26PM +0530, Shraddha Barke wrote:
> 
> 
>  On Thu, 31 Dec 2015, James Cameron wrote:
> 
> > On Thu, Dec 31, 2015 at 03:38:02AM +0530, Shraddha Barke wrote:
> >>> On Wed, Dec 30, 2015 at 04:30:17AM +0530, Shraddha Barke wrote:
>  I am trying to build sugar on Ubuntu 15.04 laptop. After git clone
>  and cd into sugar-build I get this error-Another osbuild instance is
>  running on executing ./osbuild pull
>  I searched the internet and found 2 such threads but the issue wasn't
>  resolved.
> >>>
> >>> There's more than two such threads on sugar-devel at .
> >>>
>  Is this a bug that needs fixing?
> >>>
> >>> Yes, it's a bug in osbuild, please fix it.
> >>
>  Hello James,
>  I made the following changes in check_lock()
> 
>  def check_lock():
>  -try:
>  -fcntl.lockf(get_lock_file(), fcntl.LOCK_EX | fcntl.LOCK_NB)
>  -except IOError:
>  -return False
>  -
>  -return True
>  -
> 
>  +   pid = os.getpid()
>  +   try:
>  +fcntl.lockf(pid, fcntl.LOCK_EX | fcntl.LOCK_NB)
>  +   except IOError:
>  +   return False
>  +   try:
>  +   os.kill(pid(), 0)
>  +   except OSError:
>  +return False
>  +return True
> >>>
> >>> Ah, that's not what I meant.
> >>>
> >>> But I was wrong to suggest a redesign using getpid and kill, because
> >>> my analysis of the code _today_ shows the underlying cause must be
> >>> something other than locking.
> >>>
> >>> Let me explain.
> >>>
> >>> check_lock does try fcntl.lock, and if an exception IOError occurs,
> >>> does return False.
> >>>
> >>> But inside the same try clause is a call to get_lock_file.  Therefore
> >>> any IOError inside get_lock_file will also cause check_lock to return
> >>> False.
> >>>
> >>> A possible error is that the file could not be opened for write,
> >>> e.g. because it is owned by someone else, or the protection mask
> >>> (chmod) is wrong, or the directory does not exist, or the directory is
> >>> protected.
> >>>
> >>> def check_lock():
> >>>   lock_file = get_lock_file()
> >>>   try:
> >>>   fcntl.lockf(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)
> >>>   except IOError:
> >>>   return False
> >>>
> >>>   return True
> >>>
> >>> As a result of this change, any problem opening and writing to the
> >>> file will be reported before the "another instance" error.
> >>>
> >>
> >> Ah Got it! Thanks :)
> >>
> >> Like you said it's a permission error. I've posted it below -
> >>
> >> Traceback (most recent call last):
> >>   File "./osbuild", line 504, in 
> >> if not main():
> >>   File "./osbuild", line 467, in main
> >> if not check_lock():
> >>   File "./osbuild", line 406, in check_lock
> >> lock_file = get_lock_file()
> >>   File "./osbuild", line 90, in get_lock_file
> >> lock_file = open(get_lock_file_path(), "w")
> >> IOError: [Errno 13] Permission denied:
> >> '/home/shraddha/git/sugar-build/.lock-host'
> >
> > Okay, that will certainly stop osbuild from working.
> >
> >>
> 
>  so that when there is no process running false is returned. However it is
>  not fixing the bug.
>  And yeah when I try to delete the lock file, I get 'file or
>  directory doesn't exist'
> >>>
> >>> That's not possible to explain given the data you sent.
> >>>
> >>> You said the print statement showed the file path as
> >>>
> >>> .../git/sugar-build/.lock-host
> >>>
> >>> Presumably ... is something like /home/username
> >>>
> >>> Does the .lock-host file still exist?
> >>>
> >>> Show me "stat .lock-host"?
> >>>
> >>> If the file exists, but you cannot delete it, then osbuild will fail
> >>> to open it for write.
> >>>
> >>
> >> stat: cannot stat ‘.lock-host’: No such file or directory
> >>
> >> This is what I get. It's confusing that although it's failing to write,
> >> stat says no such directory exists!
> >
> > Ye, that is strange.  On the one hand the file exists and cannot be
> > opened for write, yet now the file does not exist.
> >
> > Please check you are in the right directory when you use stat, or use
> > stat with the same full path to the file (as reported by osbuild);
> >
> > stat /home/shraddha/git/sugar-build/.lock-host
> >
> > I'm trying not to presume any knowledge; if you only type "stat
> > .lock-host", then the stat program will look for the file .lock-host
> > in the current directory.  You can see what the current directory is
> > by typing "pwd".  You can change the current directory using the "cd"
> > command.
> 
> 
> stat: cannot stat 

Re: [Sugar-devel] "Another osbuild instance is running" error

2016-01-01 Thread Shraddha Barke



On Fri, 1 Jan 2016, James Cameron wrote:


On Thu, Dec 31, 2015 at 11:26:26PM +0530, Shraddha Barke wrote:



On Thu, 31 Dec 2015, James Cameron wrote:


On Thu, Dec 31, 2015 at 03:38:02AM +0530, Shraddha Barke wrote:

On Wed, Dec 30, 2015 at 04:30:17AM +0530, Shraddha Barke wrote:

I am trying to build sugar on Ubuntu 15.04 laptop. After git clone
and cd into sugar-build I get this error-Another osbuild instance is
running on executing ./osbuild pull
I searched the internet and found 2 such threads but the issue wasn't
resolved.


There's more than two such threads on sugar-devel at .


Is this a bug that needs fixing?


Yes, it's a bug in osbuild, please fix it.



Hello James,
I made the following changes in check_lock()

def check_lock():
-try:
-fcntl.lockf(get_lock_file(), fcntl.LOCK_EX | fcntl.LOCK_NB)
-except IOError:
-return False
-
-return True
-

+   pid = os.getpid()
+   try:
+fcntl.lockf(pid, fcntl.LOCK_EX | fcntl.LOCK_NB)
+   except IOError:
+   return False
+   try:
+   os.kill(pid(), 0)
+   except OSError:
+return False
+return True


Ah, that's not what I meant.

But I was wrong to suggest a redesign using getpid and kill, because
my analysis of the code _today_ shows the underlying cause must be
something other than locking.

Let me explain.

check_lock does try fcntl.lock, and if an exception IOError occurs,
does return False.

But inside the same try clause is a call to get_lock_file.  Therefore
any IOError inside get_lock_file will also cause check_lock to return
False.

A possible error is that the file could not be opened for write,
e.g. because it is owned by someone else, or the protection mask
(chmod) is wrong, or the directory does not exist, or the directory is
protected.

def check_lock():
   lock_file = get_lock_file()
   try:
   fcntl.lockf(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)
   except IOError:
   return False

   return True

As a result of this change, any problem opening and writing to the
file will be reported before the "another instance" error.



Ah Got it! Thanks :)

Like you said it's a permission error. I've posted it below -

Traceback (most recent call last):
  File "./osbuild", line 504, in 
if not main():
  File "./osbuild", line 467, in main
if not check_lock():
  File "./osbuild", line 406, in check_lock
lock_file = get_lock_file()
  File "./osbuild", line 90, in get_lock_file
lock_file = open(get_lock_file_path(), "w")
IOError: [Errno 13] Permission denied: 
'/home/shraddha/git/sugar-build/.lock-host'




so that when there is no process running false is returned. However it is
not fixing the bug.
And yeah when I try to delete the lock file, I get 'file or
directory doesn't exist'


That's not possible to explain given the data you sent.

You said the print statement showed the file path as

.../git/sugar-build/.lock-host

Presumably ... is something like /home/username

Does the .lock-host file still exist?

Show me "stat .lock-host"?

If the file exists, but you cannot delete it, then osbuild will fail
to open it for write.



stat: cannot stat ‘.lock-host’: No such file or directory

This is what I get. It's confusing that although it's failing to write,
stat says no such directory exists!

Kind Regards,
Shraddha


Sorry for the novice questions :(


When you see me say something that doesn't match what you see, please
be sure to tell me about it!



Kind Regards,
Shraddha



--
James Cameron
http://quozl.netrek.org/



--
James Cameron
http://quozl.netrek.org/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] "Another osbuild instance is running" error

2015-12-31 Thread James Cameron
On Thu, Dec 31, 2015 at 11:26:26PM +0530, Shraddha Barke wrote:
> 
> 
> On Thu, 31 Dec 2015, James Cameron wrote:
> 
> >On Thu, Dec 31, 2015 at 03:38:02AM +0530, Shraddha Barke wrote:
> >>>On Wed, Dec 30, 2015 at 04:30:17AM +0530, Shraddha Barke wrote:
> I am trying to build sugar on Ubuntu 15.04 laptop. After git clone
> and cd into sugar-build I get this error-Another osbuild instance is
> running on executing ./osbuild pull
> I searched the internet and found 2 such threads but the issue wasn't
> resolved.
> >>>
> >>>There's more than two such threads on sugar-devel at .
> >>>
> Is this a bug that needs fixing?
> >>>
> >>>Yes, it's a bug in osbuild, please fix it.
> >>
> Hello James,
> I made the following changes in check_lock()
> 
> def check_lock():
> -try:
> -fcntl.lockf(get_lock_file(), fcntl.LOCK_EX | fcntl.LOCK_NB)
> -except IOError:
> -return False
> -
> -return True
> -
> 
> +   pid = os.getpid()
> +   try:
> +fcntl.lockf(pid, fcntl.LOCK_EX | fcntl.LOCK_NB)
> +   except IOError:
> +   return False
> +   try:
> +   os.kill(pid(), 0)
> +   except OSError:
> +return False
> +return True

Ah, that's not what I meant.

But I was wrong to suggest a redesign using getpid and kill, because
my analysis of the code _today_ shows the underlying cause must be
something other than locking.

Let me explain.

check_lock does try fcntl.lock, and if an exception IOError occurs,
does return False.

But inside the same try clause is a call to get_lock_file.  Therefore
any IOError inside get_lock_file will also cause check_lock to return
False.

A possible error is that the file could not be opened for write,
e.g. because it is owned by someone else, or the protection mask
(chmod) is wrong, or the directory does not exist, or the directory is
protected.

def check_lock():
lock_file = get_lock_file()
try:
fcntl.lockf(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)
except IOError:
return False

return True

As a result of this change, any problem opening and writing to the
file will be reported before the "another instance" error.

> 
> so that when there is no process running false is returned. However it is
> not fixing the bug.
> And yeah when I try to delete the lock file, I get 'file or
> directory doesn't exist'

That's not possible to explain given the data you sent.

You said the print statement showed the file path as

.../git/sugar-build/.lock-host

Presumably ... is something like /home/username

Does the .lock-host file still exist?

Show me "stat .lock-host"?

If the file exists, but you cannot delete it, then osbuild will fail
to open it for write.

> Sorry for the novice questions :(

When you see me say something that doesn't match what you see, please
be sure to tell me about it!

> 
> Kind Regards,
> Shraddha
> 
> >
> >-- 
> >James Cameron
> >http://quozl.netrek.org/
> >

-- 
James Cameron
http://quozl.netrek.org/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] "Another osbuild instance is running" error

2015-12-31 Thread Shraddha Barke



On Thu, 31 Dec 2015, James Cameron wrote:


On Thu, Dec 31, 2015 at 03:38:02AM +0530, Shraddha Barke wrote:

On Wed, Dec 30, 2015 at 04:30:17AM +0530, Shraddha Barke wrote:

I am trying to build sugar on Ubuntu 15.04 laptop. After git clone
and cd into sugar-build I get this error-Another osbuild instance is
running on executing ./osbuild pull
I searched the internet and found 2 such threads but the issue wasn't
resolved.


There's more than two such threads on sugar-devel at .


Is this a bug that needs fixing?


Yes, it's a bug in osbuild, please fix it.



Hello James,
I made the following changes in check_lock()

def check_lock():
-try:
-fcntl.lockf(get_lock_file(), fcntl.LOCK_EX | fcntl.LOCK_NB)
-except IOError:
-return False
-
-return True
-

+   pid = os.getpid()
+   try:
+fcntl.lockf(pid, fcntl.LOCK_EX | fcntl.LOCK_NB)
+   except IOError:
+   return False
+   try:
+   os.kill(pid(), 0)
+   except OSError:
+return False
+return True

so that when there is no process running false is returned. However it is
not fixing the bug.
And yeah when I try to delete the lock file, I get 'file or directory 
doesn't exist'


Sorry for the novice questions :(

Kind Regards,
Shraddha



--
James Cameron
http://quozl.netrek.org/


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] "Another osbuild instance is running" error

2015-12-30 Thread Sam P.
Hi Shraddha,

I think that the easiest plan of action is just to delete the lock file.

If the issue persists, you can delete the lock file again as a workaround
and file a bug or make a patch.

Thanks,
Sam

On Thu, Dec 31, 2015 at 9:08 AM, Shraddha Barke 
wrote:

> Shraddha
>
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] "Another osbuild instance is running" error

2015-12-30 Thread James Cameron
On Thu, Dec 31, 2015 at 03:38:02AM +0530, Shraddha Barke wrote:
> >On Wed, Dec 30, 2015 at 04:30:17AM +0530, Shraddha Barke wrote:
> >>I am trying to build sugar on Ubuntu 15.04 laptop. After git clone
> >>and cd into sugar-build I get this error-Another osbuild instance is
> >>running on executing ./osbuild pull
> >>I searched the internet and found 2 such threads but the issue wasn't
> >>resolved.
> >
> >There's more than two such threads on sugar-devel at .
> >
> >>Is this a bug that needs fixing?
> >
> >Yes, it's a bug in osbuild, please fix it.
> 
> Yes I will else I won't be able to get started at all.

It is a bug that needs fixing.  But it does not block you getting
started.  There is a way to avoid the bug.

> >You'll find the get_lock_file_path() returns a file path Add a print
> >to find out what the file path is.
> >
> I added a print statement and the file path is
> .../git/sugar-build/.lock-host

That tells you that to avoid the bug you may delete that file
using your shell.

However, don't delete the lock file if there is an osbuild process on
the system.

If you have recently rebooted the system, and you have not asked for
osbuild to be scheduled automatically somehow, there won't be an
osbuild process.

Look at the date it was created or modified.  It should correlate to
when you ran osbuild before the bug appeared.

> >You'll find the get_lock_file() returns a file.
> >
> >You'll see that clean() removes the file.  clean() may not be executed
> >if the builder is forced to stop.
> >
> >Therefore the file may remain even though there is no instance
> >running.
> >
> >The error is a lie.
> 
> The OSError is incorrect?

When the error says "Another osbuild instance is running", yet you
know there is not, for example because you just rebooted the system,
the error text is untrue.

A more correct error is "Another osbuild instance is either running or
is not running but has left behind a lock file and I'm too lazy to
differentiate between the two possibilities."  ;-)

> >To fix the bug, you should store the pid in the file, from
> >os.getpid(), and check that the pid exists on the system using
> >os.kill(pid, 0)
> >
> >If the pid does not exist on the system, it is safe to os.unlink() the
> >file and continue to acquire the lock.
> >
> Should I make changes in clean() by adding a check for os.kill or in
> check_lock() ?

When the bug occurs, check_lock() is executed, but clean() is not.

-- 
James Cameron
http://quozl.netrek.org/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] "Another osbuild instance is running" error

2015-12-30 Thread James Cameron
That's exactly the problem, nobody takes care to fix the bug.

On Thu, Dec 31, 2015 at 09:16:29AM +1100, Sam P. wrote:
> Hi Shraddha,
> 
> I think that the easiest plan of action is just to delete the lock file.
> 
> If the issue persists, you can delete the lock file again as a workaround and
> file a bug or make a patch.
> 
> Thanks,
> Sam
> 
> On Thu, Dec 31, 2015 at 9:08 AM, Shraddha Barke <[1]shraddha.6...@gmail.com>
> wrote:
> 
> Shraddha
> 
> References:
> 
> [1] mailto:shraddha.6...@gmail.com

-- 
James Cameron
http://quozl.netrek.org/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] "Another osbuild instance is running" error

2015-12-30 Thread Shraddha Barke





On Wed, Dec 30, 2015 at 04:30:17AM +0530, Shraddha Barke wrote:

I am trying to build sugar on Ubuntu 15.04 laptop. After git clone
and cd into sugar-build I get this error-Another osbuild instance is
running on executing ./osbuild pull
I searched the internet and found 2 such threads but the issue wasn't
resolved.


There's more than two such threads on sugar-devel at .


Is this a bug that needs fixing?


Yes, it's a bug in osbuild, please fix it.


Yes I will else I won't be able to get started at all.


You'll find the get_lock_file_path() returns a file path Add a print
to find out what the file path is.

I added a print statement and the file path is 
.../git/sugar-build/.lock-host



You'll find the get_lock_file() returns a file.

You'll see that clean() removes the file.  clean() may not be executed
if the builder is forced to stop.

Therefore the file may remain even though there is no instance
running.

The error is a lie.


The OSError is incorrect?


To fix the bug, you should store the pid in the file, from
os.getpid(), and check that the pid exists on the system using
os.kill(pid, 0)

If the pid does not exist on the system, it is safe to os.unlink() the
file and continue to acquire the lock.

Should I make changes in clean() by adding a check for os.kill or in 
check_lock() ?




--
Kind Regards,
Shraddha

--
James Cameron


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] "Another osbuild instance is running" error

2015-12-29 Thread Walter Bender
Sounds like you have somehow launched another build process on the
background. Anything show up with you do a ps -aux?

-walter

On Tue, Dec 29, 2015 at 6:00 PM, Shraddha Barke 
wrote:

>
> Hello all,
>
> I am trying to build sugar on Ubuntu 15.04 laptop. After git clone
> and cd into sugar-build I get this error-Another osbuild instance is
> running on executing ./osbuild pull
> I searched the internet and found 2 such threads but the issue wasn't
> resolved. Is this a bug that needs fixing?
> Any suggestions are welcome!
>
> Kind Regards,
> Shraddha
> ___
> Sugar-devel mailing list
> Sugar-devel@lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>



-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] "Another osbuild instance is running" error

2015-12-29 Thread Shraddha Barke



On Tue, 29 Dec 2015, Walter Bender wrote:


Sounds like you have somehow launched another build process on the background. 
Anything show up with you do a ps -aux?
-walter

Yes actually a bunch of stuff shows up but it doesn't mention osbuild 
anywhere.Is there a way to kill the build process?


Kind Regards,
Shraddha




--
Walter Bender
Sugar Labs
http://www.sugarlabs.org



___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] "Another osbuild instance is running" error

2015-12-29 Thread James Cameron
On Wed, Dec 30, 2015 at 04:30:17AM +0530, Shraddha Barke wrote:
> I am trying to build sugar on Ubuntu 15.04 laptop. After git clone
> and cd into sugar-build I get this error-Another osbuild instance is
> running on executing ./osbuild pull
> I searched the internet and found 2 such threads but the issue wasn't
> resolved. 

There's more than two such threads on sugar-devel@.

> Is this a bug that needs fixing?

Yes, it's a bug in osbuild, please fix it.

You'll find the get_lock_file_path() returns a file path Add a print
to find out what the file path is.

You'll find the get_lock_file() returns a file.

You'll see that clean() removes the file.  clean() may not be executed
if the builder is forced to stop.

Therefore the file may remain even though there is no instance
running.

The error is a lie.

To fix the bug, you should store the pid in the file, from
os.getpid(), and check that the pid exists on the system using
os.kill(pid, 0)

If the pid does not exist on the system, it is safe to os.unlink() the
file and continue to acquire the lock.

-- 
James Cameron
http://quozl.netrek.org/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel