Zim

Error starting zim in multi user environment

Bug #1208705 reported by Aniruddha
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Zim
Fix Released
Critical
Unassigned

Bug Description

I share a Zim notebook with two users on one pc with Fedora 19. When a user logs out and the other user logs in Zim can't start. Zim-deamon must be manually removed by root first.

$ zim
Traceback (most recent call last):
  File "/usr/bin/zim", line 74, in <module>
    zim.main(argv)
  File "/usr/lib/python2.7/site-packages/zim/__init__.py", line 294, in main
    zim.ipc.handle_argv()
  File "/usr/lib/python2.7/site-packages/zim/ipc.py", line 121, in handle_argv
    servermain()
  File "/usr/lib/python2.7/site-packages/zim/ipc.py", line 314, in servermain
    err_stream = open(os.path.join(dir, "zim-deamon.log"), "w")
IOError: [Errno 13] Permission denied: '/tmp/zim-deamon.log'
Traceback (most recent call last):
  File "/usr/bin/zim", line 74, in <module>
    zim.main(argv)
  File "/usr/lib/python2.7/site-packages/zim/__init__.py", line 443, in main
    start_server_if_not_running()
  File "/usr/lib/python2.7/site-packages/zim/ipc.py", line 277, in start_server_if_not_running
    raise AssertionError, 'Failed to start server (spawning)'
AssertionError: Failed to start server (spawning)

Revision history for this message
Aniruddha (mailing-list) wrote :

This also happens when the ' Shared Notebook" option is enabled.

Revision history for this message
Marek Nožka (marek-c) wrote :

I have same problem. "Shared Notebook" option is NOT enabled.
First user run Zim. Zim create /tmp/zim-deamon.log file.
Second user can't run Zim:
IOError: [Errno 13] Permission denied: '/tmp/zim-deamon.log'
Both instance of Zim requires access for same file.

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

The error is due to using the top-level tmp folder instead of a per-user tmp folder -- my bad.

To work around you can try setting the TMPDIR environment parameter to a user specific location.

Changed in zim:
status: New → Confirmed
importance: Undecided → Critical
Revision history for this message
Christian Boltz (cboltz) wrote :

Note that the fixed filename is not "just" annoying - it can probably be abused to damage user's files (hint: symlink attack).

Please always use a random filename (hint: use mktemp or python's tempfile module, which also create the tempfile in a secure way) for files in world-writeable directories like /tmp - or use a directory that is only writeable by the user (like somewhere in the homedir).

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Will commit fix in rev708 in branch pyzim-refactor

@christian: zim puts all its tmp files in $TMP/zim-$USER and ensures that that folder is created with mode 700. More paranoid users should modify $TMP to point to a secure location.

Changed in zim:
status: Confirmed → Fix Committed
Revision history for this message
NiklasW (post-y) wrote :

While waiting for rev708, how exactly do I fix this? I'm not a python programmer, just a user. Which file(s) do I open, and which line(s) do I edit, and how?

Greatly looking forward to resolving this, silly bug for an otherwise excellent software!

Revision history for this message
Anand Vaidya (anand-vaidya) wrote :

Hi NiklasW

for the time being, you can:

Open a terminal

mkdir /tmp/$USERNAME
export TMPDIR=/tmp/$USERNAME

zim

It should work now. (The upper 2 lines can be placed in login scripts too)

Revision history for this message
NiklasW (post-y) wrote :

Cheers Anand, it worked! :)
But must be used in same script or terminal that then runs zim, so it isn't "session-wide", but works for now.

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Fixed in release 0.61

Changed in zim:
status: Fix Committed → Fix Released
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.