1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 17:57:59 +00:00

Merge pull request #3840 from ThomasWaldmann/env-cleanup-uname-master

sysinfo() related forward ports (master)
This commit is contained in:
TW 2018-05-18 21:58:19 +02:00 committed by GitHub
commit ea7c543471
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 4 deletions

View file

@ -197,6 +197,10 @@ General:
When set to a numeric value, this determines the maximum "time to live" for the files cache
entries (default: 20). The files cache is used to quickly determine whether a file is unchanged.
The FAQ explains this more detailed in: :ref:`always_chunking`
BORG_SHOW_SYSINFO
When set to no (default: yes), system information (like OS, Python version, ...) in
exceptions is not shown.
Please only use for good reasons as it makes issues harder to analyze.
TMPDIR
where temporary files are stored (might need a lot of temporary space for some operations)

View file

@ -61,11 +61,32 @@ def prune_split(archives, rule, n, kept_because=None):
def sysinfo():
info = []
info.append('Platform: %s' % (' '.join(platform.uname()), ))
show_sysinfo = os.environ.get('BORG_SHOW_SYSINFO', 'yes').lower()
if show_sysinfo == 'no':
return ''
python_implementation = platform.python_implementation()
python_version = platform.python_version()
# platform.uname() does a shell call internally to get processor info,
# creating #3732 issue, so rather use os.uname().
try:
uname = os.uname()
except AttributeError:
uname = None
if sys.platform.startswith('linux'):
info.append('Linux: %s %s %s' % platform.linux_distribution())
info.append('Borg: %s Python: %s %s' % (borg_version, platform.python_implementation(), platform.python_version()))
try:
linux_distribution = platform.linux_distribution()
except:
# platform.linux_distribution() is deprecated since py 3.5 and removed in 3.7.
linux_distribution = ('Unknown Linux', '', '')
else:
linux_distribution = None
info = []
if uname is not None:
info.append('Platform: %s' % (' '.join(uname), ))
if linux_distribution is not None:
info.append('Linux: %s %s %s' % linux_distribution)
info.append('Borg: %s Python: %s %s' % (borg_version, python_implementation, python_version))
info.append('PID: %d CWD: %s' % (os.getpid(), os.getcwd()))
info.append('sys.argv: %r' % sys.argv)
info.append('SSH_ORIGINAL_COMMAND: %r' % os.environ.get('SSH_ORIGINAL_COMMAND'))