textmate / rmate

Edit files from an ssh session in TextMate
http://blog.macromates.com/2011/mate-and-rmate/
514 stars 81 forks source link

Fails silently if backup file can't be created ([input_file]~) #53

Open jpenney opened 6 years ago

jpenney commented 6 years ago

If the user has permission to edit the file, but not to create new files in the same to the directory, saving fails silently (unless verbose is used).

$ ls -la 
total 0
drwxr-xr-x   3 root        wheel  102 Jan  3 09:22 .
drwxrwxrwt  19 root        wheel  646 Jan  3 09:22 ..
-rw-r--r--   1 sampleuser  wheel    0 Jan  3 09:22 test_file.txt

Open the file for editing:

$ rmate --host samplehost --wait test_file.txt

Make some changes, and save the file, close the tab, and the file is still empty:

$ cat test_file.txt

Repeat the above with --verbose:

$ rmate --host samplehost --wait --verbose test_file.txt 
Using TCP socket to connect: ‘samplehost:52698’
Connect: ‘220 samplehost RMATE TextMate (Darwin 15.6.0)’
Saving test_file.txt
Save failed! Permission denied - test_file.txt~
Closed test_file.txt
Done
squishbug commented 6 years ago

I've been experiencing a very similar problem. Thank you for your post with the --wait and --verbose options! My files were just disappearing, and I couldn't figure out why!

$ls -l
-rwxrwxr-x 1 bfletcher bfletcher     0 Aug 22 11:20 temp_file.py

Error with $rmate --view --wait temp_file.py:

touch: cannot touch ‘/tmp/rmate.11068.90017’: Permission denied
/usr/local/bin/rmate: line 362: /tmp/rmate.11068.90017: Permission denied
Saving temp_file.py
cat: /tmp/rmate.11068.90017: No such file or directory
rm: cannot remove ‘/tmp/rmate.11068.90017’: No such file or directory