Issue Details
- Number
- 15608
- Title
- Feature request: bitcoin-wallet tool: don't modify files unless requested
- Description
- When only getting info for a wallet with the bitcoin-wallet tool, I was surprised to find it changing the file modification time (but happy that it didn't also seem to modify the file contents):
```bash
$ stat --format=%Y /tmp/test.dat ; sha256sum /tmp/test.dat
1552658778
8d932caabee0dc8d42c7ea362fb685325bd23f217557135282279f5b14233eec /tmp/test.dat
$ bitcoin/src/bitcoin-wallet -wallet=/tmp/test.dat info
Wallet info
[...]
$ stat --format=%Y /tmp/test.dat ; sha256sum /tmp/test.dat
1552658867
8d932caabee0dc8d42c7ea362fb685325bd23f217557135282279f5b14233eec /tmp/test.dat
```
Setting the file permissions to read-only also surprisingly causes the tool to fail:
```bash
$ chmod 400 /tmp/test.dat
$ bitcoin/src/bitcoin-wallet -wallet=/tmp/test.dat info
Error loading /tmp/test.dat. Is wallet being used by another process?
```
It also fails on a read-only filesystem even if the permission bits are set to writable:
```bash
$ chmod 600 /tmp/test.dat
$ sudo mount -t tmpfs -o size=10000000 tmpfs /mnt
$ sudo cp -a /tmp/test.dat /mnt
$ sudo mount -o remount,ro /mnt
$ bitcoin/src/bitcoin-wallet -wallet=/mnt/test.dat info
Error loading /mnt/test.dat. Is wallet being used by other process?
$ ls -lh /mnt/test.dat
-rw------- 1 user user 1.4M Mar 15 10:07 /mnt/test.dat
```
I'd expect the tool to open files read-only when it doesn't need to make any modifications in order to *ensure* it doesn't make any modifications. Additionally, I'd expect the tool to be able to examine backup files that have been safeguarded by making them read-only in some way.
See also [IRC discussion](http://www.erisian.com.au/bitcoin-core-dev/log-2019-03-15.html#l-356), including @laanwj mentioning a `DB_RDONLY` flag.
- URL
-
https://github.com/bitcoin/bitcoin/issue/15608
- Closed by
-
Back to List