syncthing/lib
Jakob Borg a2b8f2361e
lib/config: Add file inside folder marker directory (#9525)
### Purpose

Avoid the issue where the folder marker is deleted by overzealous
cleanup tools because it's just a useless, empty directory.

We create a small file containing a an admonishment to not delete the
directory, and some metadata that is just for human consumption at the
moment. (But it would parse as a valid yaml file if we wanted to read
this, at some point.)

This will only apply when _creating_ a folder marker, that is, existing
setups will not gain the file automatically. Obviously, when using a
custom folder marker none of this applies.

Also, slightly adjust the permission bits for the folder marker directory and file on Unixes, making sure the group & write bits are unset.

### Testing

I've created and deleted a few folders and it appears to behave as I
expect.

### Screenshots

```
jb@ok:~/somefolder % ls -la
total 0
drwxr-xr-x   3 jb  staff   96 May  1 08:52 ./
drwx------  12 jb  staff  384 May  1 08:52 ../
drwxr-xr-x   3 jb  staff   96 May  1 08:52 .stfolder/
jb@ok:~/somefolder % ls -l .stfolder
total 8
-rw-r--r--  1 jb  staff  122 May  1 08:52 syncthing-folder-39a4b0.txt
jb@ok:~/somefolder % cat .stfolder/syncthing-folder-39a4b0.txt
# This directory is a Syncthing folder marker.
# Do not delete.

folderID: xtdca-cudyf
created: 2024-05-01T08:52:49+02:00
```
2024-05-24 08:51:02 +02:00
..
api lib/api: Missing return after HTTP error 2024-03-21 08:57:43 -04:00
assets lib/assets: MIME types, time formats (#8351) 2022-05-22 22:10:18 +02:00
automaxprocs all: Use own automaxprocs package that doesn't log (ref #9436) (#9437) 2024-02-27 13:05:19 +01:00
beacon lib/beacon, lib/discover: Send IPv4 limited broadcast when address listing fails (fixes #1628) (#9087) 2023-09-12 14:28:17 +02:00
build lib/build: Allow semver build in version regex (fixes #9267) (#9316) 2024-01-02 20:43:22 +01:00
config lib/config: Add file inside folder marker directory (#9525) 2024-05-24 08:51:02 +02:00
connections lib/connections: Use proper errors.Is check (#9538) 2024-05-16 07:01:16 +00:00
db lib/db: Correct function name in comments (#9520) 2024-05-16 07:02:57 +00:00
dialer lib: Removal global connection registry (#8254) 2022-04-09 16:04:56 +02:00
discover lib/beacon, lib/discover: Send IPv4 limited broadcast when address listing fails (fixes #1628) (#9087) 2023-09-12 14:28:17 +02:00
events all: Add Prometheus-style metrics to expose some internal performance counters (fixes #5175) (#9003) 2023-08-04 19:57:30 +02:00
fs lib/fs: Watcher should react to xattr-only events on Darwin 2024-05-23 09:39:10 +02:00
geoip lib/geoip, cmd/relaypoolsrv, cmd/ursrv: Automatically manage GeoIP updates (#9342) 2024-05-18 20:31:49 +03:00
httpcache cmd/stupgrades: Cache should apply to HEAD as well as GET 2023-02-22 12:22:52 +01:00
ignore lib/ignore: Optimise ignoring directories for filesystem watcher (fixes #9339) (#9340) 2024-01-15 10:13:22 +00:00
locations all: Use some Go 1.21 features (#9409) 2024-02-10 21:02:42 +01:00
logger all: Use some Go 1.21 features (#9409) 2024-02-10 21:02:42 +01:00
model lib/config: Add file inside folder marker directory (#9525) 2024-05-24 08:51:02 +02:00
nat lib/nat: Don't crash on empty address list (fixes #9503) (#9504) 2024-04-11 13:23:29 +02:00
netutil all: Remove lib/util package (#9049) 2023-08-21 19:44:33 +02:00
osutil lib/osutil, lib/upnp: Check FlagRunning (fixes #8767) (#9047) 2023-08-21 14:49:28 +00:00
pmp lib/nat, lib/upnp: IPv6 UPnP support (#9010) 2023-12-11 07:36:18 +01:00
protocol lib/connections: Add syncthing_connections_active metric (fixes #9527) (#9528) 2024-05-04 22:31:37 +02:00
rand all: Remove unused method receivers (#8462) 2022-07-28 17:32:45 +02:00
rc all: Remove unused method receivers (#8462) 2022-07-28 17:32:45 +02:00
relay cmd/strelaysrv: Add optional auth token (fixes #3987) (#8561) 2022-10-01 20:41:02 +01:00
scanner lib/scanner: Fix ticker leak in scanner (fixes #9417) (#9451) 2024-03-05 19:04:26 +01:00
semaphore all: Remove lib/util package (#9049) 2023-08-21 19:44:33 +02:00
sha256 all: Use crypt/rand through its buffered version, but not in benchmarks (#7420) 2021-03-02 19:17:20 +01:00
signature all: Use crypt/rand through its buffered version, but not in benchmarks (#7420) 2021-03-02 19:17:20 +01:00
sliceutil all: Use some Go 1.21 features (#9409) 2024-02-10 21:02:42 +01:00
stats all: Truncate some timestamps (fixes #7457) (#7459) 2021-03-12 10:35:10 +01:00
stringutil all: Remove lib/util package (#9049) 2023-08-21 19:44:33 +02:00
structutil all: Remove lib/util package (#9049) 2023-08-21 19:44:33 +02:00
stun all: Remove lib/util package (#9049) 2023-08-21 19:44:33 +02:00
svcutil all: Remove lib/util package (#9049) 2023-08-21 19:44:33 +02:00
sync lib/model: Use a single lock (phase two: cleanup) (#9276) 2023-12-11 22:06:45 +01:00
syncthing lib/api: Improve folder summary event, verbose service (#9370) 2024-01-31 08:24:39 +01:00
testutil all: Remove lib/util package (#9049) 2023-08-21 19:44:33 +02:00
tlsutil lib/tlsutil: Use crypto.Signer interface (#8526) 2022-09-09 14:22:38 +02:00
upgrade lib/upgrade: Extract signing key to embedded file (fixes #9247) (#9296) 2023-12-18 19:47:57 +00:00
upnp lib/nat, lib/upnp: IPv6 UPnP support (#9010) 2023-12-11 07:36:18 +01:00
ur all: Remove lib/util package (#9049) 2023-08-21 19:44:33 +02:00
versioner all: Use some Go 1.21 features (#9409) 2024-02-10 21:02:42 +01:00
watchaggregator lib/config, lib/watchaggregator: Add config for max FS watcher delay (#9558) 2024-05-23 16:21:00 +02:00
weakhash all: Remove usage of deprecated io/ioutil (#7971) 2021-11-22 08:59:47 +01:00