I often edit files mounted via a samba share. However, it seems like whenever I save a file that has the Unix execute bit set, it always clears it (so a file in mode 0755 would become 0655). This happens whether I’m running Sublime on Windows or OS X. I don’t have this problem with any other editor, so I figure Sublime is doing something funky with the permissions. Are there any settings or workarounds? A bug? Something wrong in my setup?
Samba and permissions
FWIW Sublime Text doesn’t do anything special when saving files, it just uses the standard C calls (fopen, fwrite, fclose).
I seem to remember having this problem too with samba.
I remember the oplocks caused some issues, so I disabled them (though I don’t think that’s related to the execute bit clearing )
iirc the map archive setting was the one that was messing with the execute bits on save.
Here’s what I used to use anyway:
[slash]
path = /
writeable = yes
map archive = no
force user = nick
force create mode = 644
create mask = 644
oplocks = no
Ah, thanks for the tip! Setting “map archive = no” fixed the problem.
Out of curiosity, I did a little debugging with wireshark and visual studio. Looks like the underlying problem is that I had “map archive = yes” (the default) and “create mask = 0644” which is incompatible with map archive being on (it must have 0100 in the mask). Samba behaves oddly when you have this configuration. An fopen() with mode “rb+” does not muck with the archive bit, but “wb” or “wb+” clears it!
Simple solution to fix my samba config. Thanks!