Created
January 21, 2014 13:38
-
-
Save stbuehler/8540197 to your computer and use it in GitHub Desktop.
Workaround sublime text 3 umask bug, always adding 0022 to the mask (deny write to group/others) with LD_PRELOAD hack.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
compile with: | |
gcc -shared -fPIC fix_umask.c -o fix_umask.so | |
edit /usr/bin/subl to include (fix the path to fix_umask.so if necessary): | |
#!/bin/sh | |
export LD_PRELOAD=/opt/sublime_text/fix_umask.so | |
exec /opt/sublime_text/sublime_text "$@" | |
*/ | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#define _GNU_SOURCE /* See feature_test_macros(7) */ | |
#include <unistd.h> | |
#include <sys/syscall.h> /* For SYS_xxx definitions */ | |
mode_t umask(mode_t mask) { | |
mask |= 0022; | |
return syscall(SYS_umask, mask); | |
} |
Yes it does, at least for me. Thank you very much!
@dvdvck check that you are starting sublime from the command line for the first time. It might be that the .desktop file execs the binary and bypasses the script.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
buddy, I am afraid this workaround is not working :( Still having unexpected permissions
linux mint 16 - sublime text build 3059