1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 09:47:58 +00:00

posix: use fully-qualified hostname + node ID

The node ID is usually the 48 bit MAC of the primary network
interface.
This commit is contained in:
Marian Beermann 2017-01-12 00:54:17 +01:00
parent 889ee18c85
commit b9770c348f
2 changed files with 5 additions and 4 deletions

View file

@ -48,7 +48,7 @@
from .item import Item from .item import Item
from .key import key_creator, tam_required_file, tam_required, RepoKey, PassphraseKey from .key import key_creator, tam_required_file, tam_required, RepoKey, PassphraseKey
from .keymanager import KeyManager from .keymanager import KeyManager
from .platform import get_flags, umount from .platform import get_flags, umount, get_process_id
from .remote import RepositoryServer, RemoteRepository, cache_if_remote from .remote import RepositoryServer, RemoteRepository, cache_if_remote
from .repository import Repository from .repository import Repository
from .selftest import selftest from .selftest import selftest
@ -1194,6 +1194,7 @@ def do_debug_info(self, args):
# Additional debug information # Additional debug information
print('CRC implementation:', crc32.__name__) print('CRC implementation:', crc32.__name__)
print('Process ID:', get_process_id())
return EXIT_SUCCESS return EXIT_SUCCESS
@with_repository() @with_repository()

View file

@ -1,5 +1,6 @@
import errno import errno
import os import os
import uuid
import socket import socket
import subprocess import subprocess
@ -7,6 +8,7 @@ import subprocess
cdef extern from "wchar.h": cdef extern from "wchar.h":
cdef int wcswidth(const Py_UNICODE *str, size_t n) cdef int wcswidth(const Py_UNICODE *str, size_t n)
def swidth(s): def swidth(s):
str_len = len(s) str_len = len(s)
terminal_width = wcswidth(s, str_len) terminal_width = wcswidth(s, str_len)
@ -21,7 +23,7 @@ def swidth(s):
# the lock made by the parent, so it needs to use the same PID for that. # the lock made by the parent, so it needs to use the same PID for that.
_pid = os.getpid() _pid = os.getpid()
# XXX this sometimes requires live internet access for issuing a DNS query in the background. # XXX this sometimes requires live internet access for issuing a DNS query in the background.
_hostname = socket.gethostname() _hostname = '%s@%s' % (socket.getfqdn(), uuid.getnode())
def get_process_id(): def get_process_id():
@ -75,5 +77,3 @@ def local_pid_alive(pid):
# most POSIX platforms (but not Linux) # most POSIX platforms (but not Linux)
def umount(mountpoint): def umount(mountpoint):
return subprocess.call(['umount', mountpoint]) return subprocess.call(['umount', mountpoint])