Zim

Versioning with git failed

Bug #997142 reported by Gregor Beck on 2012-05-09
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Zim
Critical
Unassigned

Bug Description

Version Control of Zim notebooks fail. The plugin runs "git add ." within $HOME dir instead of ~/Notebooks/Notes where the notebook resides.
Manually initializing a git repository in the notebook dir dosn't have an effect.

It may be related to https://bugs.launchpad.net/zim/+bug/972912

$ zim -D
DEBUG: Loaded plugin automount (<AutomountPlugin object at 0x15eb5a0 (zim+plugins+PluginClass at 0x15b6600)>)
DEBUG: Gtk version is (2, 24, 4)
DEBUG: Pygtk version is (2, 22, 0)
DEBUG: Loading /home/gbeck/.config/zim/style.conf
DEBUG: Accelmap: /home/gbeck/.config/zim/accelmap
DEBUG: Opening notebook: file:///home/gbeck/Notebooks/Notes
DEBUG: Loading /home/gbeck/Notebooks/Notes/notebook.zim
DEBUG: Cache dir: /home/gbeck/Notebooks/Notes/.zim
DEBUG: Index database file: /home/gbeck/Notebooks/Notes/.zim/index.db
DEBUG: Loading /home/gbeck/Notebooks/Notes/.zim/state.conf
IDEBUG: Sending to daemon: ["ping",[],{}]

DEBUG: Daemon replied: "Ack"
DEBUG: Sending to daemon: ["vivicate",["zim.plugins.trayicon.DaemonTrayIcon","TrayIcon"],{}]

DEBUG: Child spawned 20427 (u'zim.plugins.trayicon.DaemonTrayIcon', u'TrayIcon')
DEBUG: No such signal: notebook-list-changed
DEBUG: Daemon replied: true
NFO: Accelerator changed for <Actions>/VersionControlPlugin/save_version
INFO: VCS detected: <zim.plugins.versioncontrol.VCSBackend object at 0x19e8b90>
DEBUG: Loaded plugin versioncontrol (<VersionControlPlugin object at 0x19ec190 (zim+plugins+PluginClass at 0x1a3f920)>)
INFO: Starting async index update
INFO: Open page: <FileStorePage: Home> (<HistoryPath: Home>)
DEBUG: Wrote /home/gbeck/.config/zim/preferences.conf
DEBUG: Action: set_pathbar_path
...

$ zim -D
INFO: This is zim 0.56
DEBUG: Python version is sys.version_info(major=2, minor=7, micro=1, releaselevel='final', serial=0)
DEBUG: Platform is posix
DEBUG: No bzr version-info found
DEBUG: Not running from a source dir
DEBUG: Set XDG_DATA_HOME to /home/gbeck/.local/share
DEBUG: Set XDG_DATA_DIRS to [<Dir: /usr/share>, <Dir: /usr/share>, <Dir: /usr/local/share>]
DEBUG: Set XDG_CONFIG_HOME to /home/gbeck/.config
DEBUG: Set XDG_CONFIG_DIRS to [<Dir: /etc/xdg>]
DEBUG: Set XDG_CACHE_HOME to /home/gbeck/.cache
DEBUG: Running command: gui
DEBUG: Loading /home/gbeck/Notebooks/Notes/notebook.zim
DEBUG: Loading /home/gbeck/Notebooks/PassWd/notebook.zim
DEBUG: Wrote /home/gbeck/.config/zim/notebooks.list
INFO: Opening default notebook
DEBUG: Sending to daemon: ["ping",[],{}]
...

markpitchless (markpitchless) wrote :
Download full text (11.4 KiB)

I think this effects all version control. I have a notebook that has been versioned under bzr for quite some time. After doing an system update (Ubuntu oneric) which pulled in 0.56 zim, the version control plugin is broken. It fails to detect the bzr repo and instead trys running git commands on my home directory. This happens to be under git control so it picks up that repository, which has no relation to the notebook! If I start to edit a page zim then tries to git add -A on $HOME. Which nearly locks the machine and I'm killing zim to stop it wrecking my home git repo.

Problem appears to be, as noted above, zim checking home rather than the notebook directory for a repo.

The note book is in ~/LabBook. Opening the versions diag under zim -D gives this:

 DEBUG: Action: show_versions
 INFO: Running: ['git', 'log', '--date=iso'] (cwd: /home/mda)
 DEBUG: Opening dialog "Versions - Zim"

Version info:

 mda@starbuck:~/LabBook$ zim --version
 zim 0.56
 ...

 mda@starbuck:~/LabBook$ git --version
 git version 1.7.5.4

 mda@starbuck:~/LabBook$ bzr --version
 Bazaar (bzr) 2.4.1
   Python interpreter: /usr/bin/python 2.7.2
   Python standard library: /usr/lib/python2.7
   Platform: Linux-3.0.0-22-generic-x86_64-with-Ubuntu-11.10-oneiric
   bzrlib: /usr/lib/python2.7/dist-packages/bzrlib
   Bazaar configuration: /home/mda/.bazaar
   Bazaar log file: /home/mda/.bzr.log
   ...

 mda@starbuck:~/LabBook$ lsb_release -a
 No LSB modules are available.
 Distributor ID: Ubuntu
 Description: Ubuntu 11.10
 Release: 11.10
 Codename: oneiric

 mda@starbuck:~/LabBook$ uname -a
 Linux starbuck 3.0.0-22-generic #36-Ubuntu SMP Tue Jun 12 17:37:42 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

Full log:

 mda@starbuck:~/LabBook$ DEBUG: Loading /home/mda/.config/zim/preferences.conf
 DEBUG: Gtk version is (2, 24, 6)
 DEBUG: Pygtk version is (2, 24, 0)
 WARNING: Could not find all icon sizes for the application icon
 DEBUG: Loading /home/mda/.config/zim/style.conf
 DEBUG: Accelmap: /home/mda/.config/zim/accelmap
 DEBUG: Opening notebook: file:///home/mda/LabBook
 DEBUG: Loading /home/mda/LabBook/notebook.zim
 DEBUG: Cache dir: /home/mda/LabBook/.zim
 DEBUG: Index database file: /home/mda/LabBook/.zim/index.db
 DEBUG: Loading /home/mda/LabBook/.zim/state.conf
 INFO: Accelerator changed for <Actions>/CalendarPlugin/go_page_today
 DEBUG: Loaded plugin calendar (<CalendarPlugin object at 0x1d66af0 (zim+plugins+PluginClass at 0x1c8aec0)>)
 DEBUG: Loaded plugin insertsymbol (<InsertSymbolPlugin object at 0x1d66cd0 (zim+plugins+PluginClass at 0x1c7bf20)>)
 INFO: Accelerator changed for <Actions>/PrintToBrowserPlugin/print_to_browser
 DEBUG: Loaded plugin printtobrowser (<PrintToBrowserPlugin object at 0x1d66dc0 (zim+plugins+PluginClass at 0x1c8ae20)>)
 INFO: Accelerator changed for <Actions>/SpellPlugin/toggle_spellcheck
 DEBUG: Loaded plugin spell (<SpellPlugin object at 0x1d72410 (zim+plugins+PluginClass at 0x1c8af20)>)
 DEBUG: Loaded plugin tags (<TagsPlugin object at 0x1d725a0 (zim+plugins+PluginClass at 0x1c8af00)>)
 DEBUG: Loaded plugin tasklist (<TaskListPlugin object at 0x1d72c80 (zim+plugins+tasklist+TaskListPlugin at 0x1c8d540)>)
 DEBUG: Sending to daemon: ["ping",[],...

markpitchless (markpitchless) wrote :

So I tried creating new test Notebook to see what would happen. As soon as I saved an edit zim tried to add my whole home to git:

 DEBUG: Saving page (async): <FileStorePage: Home>
 DEBUG: Wrote /home/mda/Notebooks/Test/Home.txt
 INFO: Running: ['git', 'add', '/home/mda/Notebooks/Test/Home.txt'] (cwd: /home/mda)
 INFO: Running: ['git', 'add', '-u'] (cwd: /home/mda)
 INFO: Running: ['git', 'add', '-A'] (cwd: /home/mda)

markpitchless (markpitchless) wrote :

Ok, not good. This git add -u then git add -A on home after a save is even happening when I disable the version control plugin. Which means zim is now un-usable for me :(

On Sat, Jun 30, 2012 at 5:18 PM, markpitchless
<email address hidden> wrote:
> Ok, not good. This git add -u then git add -A on home after a save is
> even happening when I disable the version control plugin. Which means
> zim is now un-usable for me :(

In that case you did not really disable the plugin. You can remove it
from the preferences file (~/.config/zim/preferences.conf -- look for
a list with plugins in the main section). After this it should not run
any git commands.

-- Jaap

Confirmed. A bug was introduced where the search for the version
control root goes top down instead of bottom up. So versioning on
parent folder (home in this case) is detected before versioning on the
notebook folder.

Will fix ASAP.

markpitchless (markpitchless) wrote :

Hi Jaap,

Your right, I had edited that file as you sugessted but suspect I still had zim running that didn't spot the change. Today (after a reboot) it works and I can use zim again :) So no version control, but can do that manually until the bug is fixed.

The top down search would definitley break on my machine as my home directory is under git version control.

Thanks,
mark.

Committed direct fix in rev 558.

Also considered that we may want to add only files in the notebook folder, even if it is one of the parent folders that is versioned. Will fix that in a subsequent revision.

Changed in zim:
status: New → Confirmed
importance: Undecided → Critical
status: Confirmed → Fix Committed
leoluk (leoluk) on 2012-10-22
Changed in zim:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers