user.cfg permission denied

Bug #586459 reported by Scott
4
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Nathive
In Progress
Wishlist
Unassigned

Bug Description

Using version 0.906, nathive crashes when closing the application because of permission denied in writing the file user.cfg. It doesn't seem appropriate to be writing a user config file to /usr/share/nathive/cfg/, as 1) that directory does not have write permissions for non-root users, and 2) different users would share the same user config. The file should instead be located in the user's home dir, such as ~/.config/nathive/.

Revision history for this message
Marcos Diaz (marcos-diaz) wrote :

Teorically when you are using the installed version the user.cfg is stored in ~/.nathive

So, can you tell me some extra details about your installation process? (deb/rpm/standalone/tarball)

Thanks.

Revision history for this message
Scott (stonecrest-deactivatedaccount-deactivatedaccount) wrote :

I apologize if there is an error on my end. I am the one creating a package for nathive on Archlinux. With 0.902, I issue 'make' and 'make install' with one exception, which is that I need to modify BASE in the makefile. But it all works fine, there is no crash on close. With 0.906, it's identical to what I did for 0.902 except that I also have to modify the /usr/bin/nathive script to point to the correct location (since it's now also dependent on BASE in the makefile). And now I get:

(?) saving cfg: /usr/share/nathive/cfg/user.cfg
Traceback (most recent call last):
  File "/usr/share/nathive/nathive/gui/main.py", line 50, in <lambda>
    self.window.connect('destroy', lambda x: self.quit())
  File "/usr/share/nathive/nathive/gui/main.py", line 118, in quit
    main.config.save()
  File "/usr/share/nathive/nathive/lib/config.py", line 123, in save
    fileobj = open(path, 'w').write(data)
IOError: [Errno 13] Permission denied: '/usr/share/nathive/cfg/user.cfg'

I will attach my working Archlinux PKGBUILD for 0.906. You can view the current PKGBUILD for 0.902 at http://aur.archlinux.org/packages/nathive/nathive/PKGBUILD.

Revision history for this message
Scott (stonecrest-deactivatedaccount-deactivatedaccount) wrote :
Revision history for this message
Marcos Diaz (marcos-diaz) wrote :

I see, the issue is just the code believes you are using the standalone version, but I'm really don't know why.

Since 0.904 when the 'make' rule is called the makefile BASE is stored in the META file to be used by nathive.py, so, why this work enviroment does not fit with your requirements? what are you trying to do exactly?

Teorically if nathive.py is in the path pointed by META, nathive must assume your are using the installed version and try to save the cfg into the user space. Is this system failing? or maybe you need something different?

Can you upload here the edited makefile and the META file after compiling?

Thanks again.

Revision history for this message
Scott (stonecrest-deactivatedaccount-deactivatedaccount) wrote :

My apologies in advance if you find this hard to follow, but I will try to explain the process...

The fundamental issue seems to be that I'm not trying to install nathive on my machine, but create an Archlinux package for others to install. To do this, I essentially need to install nathive to a ../nathive/pkg/ directory. The package manager then creates a tarball of what ends up in this /pkg directory, and these exact files eventually make it to another user's machine. So, for example, the ../nathive/pkg/usr/bin/nathive file that I create ultimately becomes the /usr/bin/nathive file on the machine of someone that installs nathive.

In order to accomplish this, I have to replace the hardcoded BASE path in the nathive makefile with a path that points to ../nathive/pkg/. That installs nathive to the location needed by the package manager. However, this causes the ../nathive/pkg/usr/bin/nathive to be pointing to the nathive python file in ../nathive/pkg/. This means that ultimately when the user installs the program, they get a file /usr/bin/nathive that points to the nathive python file in ../nathive/pkg/ as well, which doesn't exist. So after I install nathive to ../nathive/pkg/, I modify the ../nathive/pkg/usr/bin/nathive file to point to the appropriate location. This means that the user who installs nathive has a /usr/bin/nathive file pointing to the appropriate location as well.

It sounds like the META file is the missing piece here. I can edit this as well, but as you are hopefully seeing, there is getting to be a lot of manual work on my end to make this all work correctly.

I am at work right now, but will attach the requested files when I get home.

Revision history for this message
Marcos Diaz (marcos-diaz) wrote :

Ok, I understand the issue, you does not need to modify nathive.py, just META file, after make the 'fake install' in /pkg or whatever edit the META appdir entry to point it to the final path. This should be enough.

I wish this fits your requirements, if not, i think I could set some new rule in the makefile to handle this kind of operations.

Revision history for this message
Scott (stonecrest-deactivatedaccount-deactivatedaccount) wrote :

Thanks, this should be sufficient. I'll try it out tonight and will let you know. It'd be nice if nathive could work with an install directory that differs from the final target directory, but I'm happy if I can get things to work by modifying a few files appropriately.

Revision history for this message
Scott (stonecrest-deactivatedaccount-deactivatedaccount) wrote :

Modifying the META file worked just fine, thanks for the help.

Changed in nathive:
importance: Undecided → Wishlist
status: New → In Progress
Revision history for this message
Marcos Diaz (marcos-diaz) wrote :

I changed the status to wishlist, I will try to implement some makefile variable to point the final installation in a different place.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.