syncthing/lib/model
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
..
mocks lib/protocol: Refactor interface (#9375) 2024-01-31 08:18:27 +01:00
testdata
blockpullreorderer_test.go
blockpullreorderer.go
debug.go
deviceactivity_test.go
deviceactivity.go
devicedownloadstate_test.go
devicedownloadstate.go
doc.go
fakeconns_test.go lib/protocol: Refactor interface (#9375) 2024-01-31 08:18:27 +01:00
folder_recvenc.go
folder_recvonly_test.go lib/protocol: Refactor interface (#9375) 2024-01-31 08:18:27 +01:00
folder_recvonly.go
folder_sendonly.go
folder_sendrecv_test.go lib/protocol: Refactor interface (#9375) 2024-01-31 08:18:27 +01:00
folder_sendrecv_unix.go
folder_sendrecv_windows.go
folder_sendrecv.go lib/model: Ignore difference in extended attributes & ownership when deleting (fixes #9371) (#9430) 2024-03-02 14:55:18 +00:00
folder_summary.go lib/api: Improve folder summary event, verbose service (#9370) 2024-01-31 08:24:39 +01:00
folder_test.go
folder.go
folderstate.go all: Add Prometheus-style metrics to expose some internal performance counters (fixes #5175) (#9003) 2023-08-04 19:57:30 +02:00
indexhandler_test.go lib/model: Deflake new IndexHandlerTest (#9412) 2024-02-11 09:03:12 +01:00
indexhandler.go lib/model: Don't bump seq on error in index handler (#9459) 2024-03-11 07:30:21 +01:00
metrics.go
model_test.go lib/protocol: Refactor interface (#9375) 2024-01-31 08:18:27 +01:00
model.go lib/config: Add file inside folder marker directory (#9525) 2024-05-24 08:51:02 +02:00
progressemitter_test.go
progressemitter.go
queue_test.go all: Use some Go 1.21 features (#9409) 2024-02-10 21:02:42 +01:00
queue.go
requests_test.go lib/protocol: Refactor interface (#9375) 2024-01-31 08:18:27 +01:00
sentdownloadstate.go
service_map_test.go
service_map.go
sharedpullerstate_test.go
sharedpullerstate.go
testos_test.go
testutils_test.go lib/protocol: Refactor interface (#9375) 2024-01-31 08:18:27 +01:00
util.go
utils_test.go