Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if args is None:
args = sys.argv[1:]
options = parse_args(args)
setup_logging(options)
for name in options.path:
if os.path.ismount(name):
raise QuietError('%s is a mount point.' % name)
ctrlfile = assert_fs_owner(name)
fstat_p = os.stat(os.path.dirname(os.path.abspath(name)))
# Make sure that write cache is flushed
pyfuse3.syncfs(name)
cmd = ('(%d, %r)' % (fstat_p.st_ino,
path2bytes(os.path.basename(name)))).encode()
pyfuse3.setxattr(ctrlfile, 'rmtree', cmd)
raise QuietError('Target parent %r is not a directory' % parent)
if fstat_p.st_dev != fstat_s.st_dev:
raise QuietError('Source and target are not on the same file system.')
if os.path.ismount(options.source):
raise QuietError('%s is a mount point.' % options.source)
ctrlfile = assert_fs_owner(options.source)
try:
os.mkdir(options.target)
except PermissionError:
raise QuietError('No permission to create target directory')
# Make sure that write cache is flushed
pyfuse3.syncfs(options.target)
fstat_t = os.stat(options.target)
pyfuse3.setxattr(ctrlfile, 'copy',
('(%d, %d)' % (fstat_s.st_ino, fstat_t.st_ino)).encode())