{
 "number": 36373,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/36373",
 "title": "init: log resolved datadir path",
 "author": "LarryRuane",
 "author_association": "CONTRIBUTOR",
 "created_at": "2026-09-28T17:42:12Z",
 "updated_at": "2026-10-08T14:13:35Z",
 "description_hash": "9177169fb18881ca",
 "age_days": 34,
 "draft": false,
 "labels": [],
 "milestone": null,
 "base": "master",
 "head_sha": "21e37651cc065fe07f02f29d3d610f2e87498bce",
 "head_ref": "2026-09-datadir-realpath",
 "head_repo": "LarryRuane/bitcoin",
 "head_history": [
  {
   "t": "2026-10-07T16:07:04Z",
   "sha": "21e37651cc065fe07f02f29d3d610f2e87498bce"
  }
 ],
 "additions": 6,
 "deletions": 1,
 "changed_files": 1,
 "commit_count": 1,
 "size_bucket": "S",
 "mergeable_state": "clean",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {},
   "conflicts": []
  }
 },
 "acks_parsed": {},
 "acks_tally": {
  "ack": 0,
  "stale_ack": 0,
  "concept_ack": 0,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "l0rinc"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "clean",
  "last_author_activity": "2026-10-08T14:13:35Z",
  "last_reviewer_activity": "2026-10-08T01:19:10Z",
  "last_reviewer": "l0rinc",
  "author_silent_days": 24,
  "waiting_on_author_days": 0,
  "days_since_update": 24
 },
 "refs": {
  "mentioned": [],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [
  "src/init/common.cpp"
 ],
 "body": "Because the data directory may be a symlink, also log the path it resolves to, so `debug.log` files show the actual location for that run.\n\nThis patch would mostly help developers. I've been testing a potential performance PR across different data directories (for example, SSD versus HDD). After each run, I save the `debug.log` file. It would be nice if the `debug.log` file showed which data directory was used for that run.\n\nThere are two ways to change which data directory to use: `-datadir=` on the command line, or by making the default path a symlink. If a _script_ starts `bitcoind` (e.g., on an RPi with a whole infrastructure, like Umbrel or myNode), changing the startup command arguments may be inconvenient or not even possible. It's easy to change the default directory to be a symlink. But in that case, `debug.log` doesn't show where the actual data directory is located. This patch adds one line to the logging startup output showing the resolved data directory path (after following symlinks).\n\nI don't think a separate test is needed. I haven't tested on all platforms, but this patch uses primitives already used elsewhere, so it should work everywhere.\n\nHere's an example of the additional line this patch logs during startup, just after the `Using data directory` line (omitting the timestamp prefix). I'll show both here for context (only the second line is added):\n```\nUsing data directory /home/larry/.bitcoin\nResolved data directory /sd/.bitcoin\n```\nThe patch could print this line only if the resolved path differs from the `Using data directory` path, but we may as well print it every time, because it's only one extra line, and this way any scripts that look for the resolved path are simpler (they can depend on it always being there).",
 "commits": [
  {
   "sha": "21e37651cc065fe07f02f29d3d610f2e87498bce",
   "date": "2026-10-07T16:06:59Z",
   "message": "init: log resolved data directory path\n\nLog a separate line with the data directory after resolving symlinks,\nso saved debug.log files show where the data actually was for that run.\nThe existing \"Using data directory\" line is left unchanged so scripts\nthat parse it aren't affected. The new line is always printed, even when\nthe path doesn't change, so scripts can rely on it being there."
  }
 ],
 "timeline": [
  {
   "t": "2026-10-07T16:07:04Z",
   "kind": "force_push",
   "who": "LarryRuane",
   "commit": "21e37651cc065fe07f02f29d3d610f2e87498bce",
   "id": "push:21e37651cc065fe07f02f29d3d610f2e87498bce"
  },
  {
   "t": "2026-10-08T01:19:10Z",
   "kind": "review_comment",
   "who": "l0rinc",
   "assoc": "MEMBER",
   "path": "src/init/common.cpp",
   "commit": "21e37651cc065fe07f02f29d3d610f2e87498bce",
   "in_reply_to": null,
   "text": "The commit message says the resolved path is \"always printed\", but the PR title says \"when it differs\".\n\nIs this part of a broader effort to improve symlink support? If so, I wouldn't want to see two separate log lines for the exact same folder in 99% of cases.",
   "id": "rc:4213659555",
   "url": "https://github.com/bitcoin/bitcoin/pull/36373#discussion_r4213659555",
   "hash": "6ad0eca63f7f0f97",
   "edited": null
  },
  {
   "t": "2026-10-08T14:13:35Z",
   "kind": "review_comment",
   "who": "LarryRuane",
   "assoc": "CONTRIBUTOR",
   "path": "src/init/common.cpp",
   "commit": "21e37651cc065fe07f02f29d3d610f2e87498bce",
   "in_reply_to": 4213659555,
   "text": "Thanks for taking a look. The first version of this PR printed the resolved path at the end of the same line that exists today:\n```diff\n- Using data directory /home/larry/.bitcoin\n+ Using data directory /home/larry/.bitcoin (/sd/.bitcoin)\n```\nAnd it added that path only if it was different from the \"Using\" path. But after more thought, it seems better to log a new line (\"Resolved\") and leave the existing log line unchanged (in case scripts exist somewhere that expect the current format). I also thought it would be better to always log this new Resolved line so future scripts can look for it without needing logic to fall back to \"Using\" if \"Resolved\" doesn't exist. So I force-pushed those changes. But I forgot to update the title; fixed now.\n\nSounds like you would like the Resolved line to only print if it's different; I can make that change, I don't feel strongly either way.\n\nNo, I'm not thinking this is part of a broader effort to improve symlink support. AFAIK symlinks are already fully supported. It's just a self-contained PR that would have helped me personally, since I saved a bunch of `debug.log` files and later wasn't sure whether each corresponded to an SSD or an HDD data directory run (because I had changed a symlink). Plus, it seems generally useful to know where the actual data directory is.\n\nI can make the logging of that Resolved line conditional so it doesn't print the same path as the Using line, maybe I'll wait for a few more opinions.",
   "id": "rc:4220032086",
   "url": "https://github.com/bitcoin/bitcoin/pull/36373#discussion_r4220032086",
   "hash": "66217560497f51a3",
   "edited": null
  }
 ],
 "labels_log": [],
 "state_log": [
  {
   "t": "2026-10-08T13:55:10Z",
   "kind": "renamed",
   "who": "LarryRuane",
   "from": "init: log resolved datadir path when it differs",
   "to": "init: log resolved datadir path"
  }
 ],
 "text_chars": 3927,
 "text_tokens_estimate": 981,
 "changed_paths": [
  "src/init/common.cpp"
 ],
 "files": [
  {
   "path": "src/init/common.cpp",
   "add": 6,
   "del": 1
  }
 ],
 "test_lines": 0,
 "git": {
  "head": "21e37651cc065fe07f02f29d3d610f2e87498bce",
  "head_matches_backup": true,
  "base": "05bc2f53ce0cb239c17dbdd6b261bd2db7d2a940",
  "patch_id": "e8fea69d92826334",
  "commits": [
   {
    "sha": "21e37651cc",
    "subject": "init: log resolved data directory path",
    "files": 1,
    "add": 6,
    "del": 1
   }
  ],
  "patch_truncated": false
 },
 "patch_id": "e8fea69d92826334",
 "input_hash": "66f31668fa977809",
 "extracted_at": "2026-11-02T01:09:49+00:00"
}