Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1#!/usr/bin/env python32# Copyright (c) 2022-present The Bitcoin Core developers3# Distributed under the MIT software license, see the accompanying4# file COPYING or http://www.opensource.org/licenses/mit-license.php.5"""Test file system permissions for POSIX platforms.6"""8import os9import stat11from test_framework.test_framework import BitcoinTestFramework12from test_framework.util import assert_equal15class PosixFsPermissionsTest(BitcoinTestFramework):16def set_test_params(self):17self.setup_clean_chain = True18self.num_nodes = 120def skip_test_if_missing_module(self):21self.skip_if_platform_not_posix()23def check_directory_permissions(self, dir):24mode = os.lstat(dir).st_mode25self.log.info(f"{stat.filemode(mode)} {dir}")26assert_equal(mode, (stat.S_IFDIR | stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR))28def check_file_permissions(self, file):29mode = os.lstat(file).st_mode30self.log.info(f"{stat.filemode(mode)} {file}")31assert_equal(mode, (stat.S_IFREG | stat.S_IRUSR | stat.S_IWUSR))33def run_test(self):34self.stop_node(0)35datadir = self.nodes[0].chain_path36self.check_directory_permissions(datadir)37walletsdir = self.nodes[0].wallets_path38self.check_directory_permissions(walletsdir)39debuglog = self.nodes[0].debug_log_path40self.check_file_permissions(debuglog)43if __name__ == '__main__':44PosixFsPermissionsTest(__file__).main()
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.