Ask Your Question

copying the sage installation directory with rsync

asked 2014-07-28 03:51:55 -0600

Dirk Danckaert gravatar image

I'm experimenting with taking snapshots of a linux system (I'm using Antix for the purpose). Everything seems to work, except that SAGE is not copied over faithfully. A few hundred files and about 20 folders are missing, but SAGE being so gigantic, I can't pinpoint exactly which. I'm not 100% sure how the snapshot is made, but as far as I know, the system uses rsync to make a copy of the filesystem. Is there anybody knowledgeable in this matter who could clarify what could be the reason that SAGE is somehow more difficult to copy than other folders?

When I try to start SAGE from the reinstalled snapshot, it results in the following crash-report:


IPython post-mortem report

{'commit_hash': '3472a85',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': '/opt/sage-6.0/local/lib/python2.7/site-packages/IPython',
 'ipython_version': '0.13.2',
 'os_name': 'posix',
 'platform': 'Linux-3.7.10-antix.5-486-smp-i686-with-debian-7.2',
 'sys_executable': '/opt/sage-6.0/local/bin/python',
 'sys_platform': 'linux2',
 'sys_version': '2.7.5 (default, Dec 19 2013, 04:22:57) \n[GCC 4.7.3]'}



Crash traceback:

ImportError                    Python 2.7.5: /opt/sage-6.0/local/bin/python
                                                   Mon Jul 28 10:49:57 2014
A problem occured executing Python code.  Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.
/opt/sage-6.0/src/bin/sage-ipython in <module>()
      2 # -*- coding: utf-8 -*-
      3 """
      4 Sage IPython startup script.
      5 """
      6 from sage.misc.interpreter import SageTerminalApp
      8 # installs the extra readline commands before the IPython initialization begins.
      9 from sage.misc.readline_extra_commands import *
     11 # Make sure we're using the Sage profile if one isn't specified.
     12 import sys
     13 if '--profile' not in sys.argv:
     14     sys.argv.extend(['--profile', 'sage'])
     16 app = SageTerminalApp.instance()
---> 17 app.initialize()
        global app.initialize = <bound method SageTerminalApp.initialize of <sage.misc.interpreter.SageTerminalApp object at 0xb72c44ec>>
     18 app.start()

/opt/sage-6.0/local/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.pyc in initialize(self=<sage.misc.interpreter.SageTerminalApp object>, argv=None)

/opt/sage-6.0/local/lib/python2.7/site-packages/IPython/config/application.pyc in catch_config_error(method=<function initialize>, app=<sage.misc.interpreter.SageTerminalApp object>, *args=(None,), **kwargs={})
     70 #-----------------------------------------------------------------------------
     71 # Application class
     72 #-----------------------------------------------------------------------------
     74 @decorator
     75 def catch_config_error(method, app, *args, **kwargs):
     76     """Method decorator for catching invalid config (Trait/ArgumentErrors) during init.
     78     On a TraitError (generally caused by bad config), this will print the trait's
     79     message, and exit the app.
     81     For use on init methods, to prevent invoking excepthook on invalid input.
     82     """
     83     try:
---> 84         return method(app, *args, **kwargs)
        method = <function initialize at 0x89fae9c>
        app = <sage.misc.interpreter.SageTerminalApp object at 0xb72c44ec>
        args = (None,)
        kwargs = {}
     85     except (TraitError, ArgumentError) as e:
     86         app.print_description()
     87         app.print_help()
     88         app.print_examples()
     89         app.log.fatal("Bad config encountered during initialization:")
     90         app.log.fatal(str(e))
     91         app.log.debug("Config at the time: %s", app.config)
     92         app ...
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-07-28 07:26:34 -0600

Dirk Danckaert gravatar image

Once more I answer my own question. I'll try not to do so anymore in the future.

The problem has nothing whatsoever to do with SAGE itself. It's caused by a sloppy configuration file used for rsync. As a result there is a confusion between the root folder /media/ and a subfolder media/ deep within SAGE. It took some time for me to locate the folder .../media/... within SAGE, but then I saw that this folder was indeed copied, but left empty by rsync. From there on I quickly found the reason why.

I'm sure there's a simple command that could have told me where to find media/ in a second, but I'm far from a linux wizzard, and the SAGE folder has a quite overwhelming tree structure.

edit flag offensive delete link more

answered 2014-07-28 08:02:42 -0600

updated 2014-07-28 08:13:57 -0600

Note: there are many folders called media inside the Sage tree. To find them all, 'cd' to your Sage folder in a terminal, and type

find . -type d -name 'media'

Also, a good way to tell rsync which files to exclude is to use the --exclude-from option, and have a file where you indicate the include/exclude rules.

See the rsync man page and in particular the section 'INCLUDE/EXCLUDE PATTERN RULES'.

edit flag offensive delete link more


Thank you for the 'find' syntax. It was precisely in such an exclude file that the error was made.

Dirk Danckaert gravatar imageDirk Danckaert ( 2014-07-28 08:45:44 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-07-28 03:51:55 -0600

Seen: 231 times

Last updated: Jul 28 '14