I've installed rmate on a remote server although I'm able to create a new file on this server, when doing some modification on an existing file, they aren't saved after the saving and closing on the TextMate side.
The server is running Xubuntu 12.04, ruby 1.9.3 has been installed using rvm.
the remote file perms are : -rwxrw-r-- 1 yt yt 455 sept. 6 16:59 menu.zsh
what i did :
$ ssh dell-par Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-30-generic x86_64)
* Documentation: https://help.ubuntu.com/
Last login: Fri Sep 7 09:18:50 2012 from 2a01:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:2559 Linux D620 3.2.0-30-generic #48-Ubuntu SMP Fri Aug 24 16:52:48 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux 14:49:17 up 5:38, 2 users, load average: 0.11, 0.29, 0.56 yt@D620 /home/yt $ rmate bin/menu.zsh
yt@D620 /home/yt $ cat bin/menu.zsh #!/usr/bin/zsh
MENU_DIR=${HOME}/bin/scripts MENU_ITEMS=(`ls ${MENU_DIR}`)
while (( 1 > 0 )) { i=0 while (( i++ < ${#MENU_ITEMS} )) { echo "${i} -> ${MENU_ITEMS[i]:r}" } echo "${i}|q -> quit" echo -n "Entrez un nombre de 1 à ${i} (ou q pour quitter). : " read NUM if [[ ${NUM} -eq ${i} || ${NUM} == "q" ]]; then echo "bye!" exit 0 else echo "Vous avez choisi '${MENU_ITEMS[${NUM}]:r}'." ${MENU_DIR}/${MENU_ITEMS[${NUM}]} fi } exit $? yt@D620 /home/yt $
my local ~/.ssh/config file :
$ cat ~/.ssh/config Host dell-par User yt Hostname 2a01:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:a960 RemoteForward 52698 127.0.0.1:52698
Host dell-pal User yt Hostname 2a01:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:a960 RemoteForward 52698 127.0.0.1:52698
Host gericom User yt Hostname 2a01:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:a07b RemoteForward 52698 127.0.0.1:52698
also i wonder if it is usefull to put "RemoteForward 52698 127.0.0.1:52698" for each host.
best
On Sep 7, 2012, at 2:55 PM, Yvon Thoraval yvon.thoraval@gmail.com wrote:
I've installed rmate on a remote server although I'm able to create a new file on this server, when doing some modification on an existing file, they aren't saved after the saving and closing on the TextMate side.
The server is running Xubuntu 12.04, ruby 1.9.3 has been installed using rvm.
Try use ‘rmate -v’ then it should print potential exceptions to stderr.
When the file already exists it does:
File.chmod(File.stat(path).mode, temp.path) if File.exist? path
Perhaps that does not work on ruby 1.9.x.
2012/9/9 Allan Odgaard mailinglist@textmate.org
On Sep 7, 2012, at 2:55 PM, Yvon Thoraval yvon.thoraval@gmail.com wrote:
I've installed rmate on a remote server although I'm able to create a
new file on this server, when doing some modification on an existing file, they aren't saved after the saving and closing on the TextMate side.
The server is running Xubuntu 12.04, ruby 1.9.3 has been installed using
rvm.
Try use ‘rmate -v’ then it should print potential exceptions to stderr.
Here it is :
yt@D620 /home/yt $ rmate -v bin/menu.zsh yt@D620 /home/yt $ Connect: ‘220 imyt.local RMATE TextMate (Darwin 11.4.0)’ Saving bin/menu.zsh Save failed! File exists - (bin/menu.zsh, bin/menu.zsh~) Closed bin/menu.zsh Done
yt@D620 /home/yt $
When the file already exists it does:
File.chmod(File.stat(path).mode, temp.path) if File.exist? path
Perhaps that does not work on ruby 1.9.x.
My ruby version : ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
Also, i should mention i had a file "bin/menu.zsh~" BEFORE using rmate, then, removing it before a second rmate gave :
yt@D620 /home/yt $ cd bin yt@D620 /home/yt/bin $ rmate -v menu.zsh Connect: ‘220 imyt.local RMATE TextMate (Darwin 11.4.0)’ yt@D620 /home/yt/bin $ Saving menu.zsh Closed menu.zsh Done
yt@D620 /home/yt/bin $ cat menu.zsh
<the script as it was> # TOTO (the comment added for try-out)
Then, rmate is working except another file with the suffix "~" exists too.
On Sep 11, 2012, at 10:24 AM, Yvon Thoraval yvon.thoraval@gmail.com wrote:
Here it is : […] Save failed! File exists - (bin/menu.zsh, bin/menu.zsh~) […] Also, i should mention i had a file "bin/menu.zsh~" BEFORE using rmate, then, removing it before a second rmate gave : […] Then, rmate is working except another file with the suffix "~" exists too.
I’m a little unclear as to whether or not you solved your problem.
It might be that File::rename does not unlink destination first. Given that you are using rvm and the script is in ruby, I would assume you can test the relevant code on your version of ruby to see why it has a problem.
2012/9/12 Allan Odgaard mailinglist@textmate.org
On Sep 11, 2012, at 10:24 AM, Yvon Thoraval yvon.thoraval@gmail.com wrote:
Here it is : […] Save failed! File exists - (bin/menu.zsh, bin/menu.zsh~) […] Also, i should mention i had a file "bin/menu.zsh~" BEFORE using rmate,
then, removing it before a second rmate gave :
[…] Then, rmate is working except another file with the suffix "~" exists
too.
I’m a little unclear as to whether or not you solved your problem.
It might be that File::rename does not unlink destination first. Given that you are using rvm and the script is in ruby, I would assume you can test the relevant code on your version of ruby to see why it has a problem.
For me it is clear enough. I did some test1 :
1 - edit remotely a file "~/bin/menu.zsh" *not* having "~/bin/menu.zsh~" (~suffix) it is OK. 2 - i duplicate the file to "~/bin/menu.zsh~" by : $ cp ~/bin/menu.zsh ~/bin/menu.zsh~ and try using rmate : yt@D620 /home/yt $ rmate -v bin/menu.zsh Connect: ‘220 imyt.local RMATE TextMate (Darwin 11.4.0)’ yt@D620 /home/yt $ Saving bin/menu.zsh Save failed! File exists - (bin/menu.zsh, bin/menu.zsh~) Closed bin/menu.zsh Done
here it doesn't work...
I look at that point this morning, that is how to solve the "~ prob"...
2012/9/12 Allan Odgaard mailinglist@textmate.org
On Sep 11, 2012, at 10:24 AM, Yvon Thoraval yvon.thoraval@gmail.com wrote:
Here it is : […] Save failed! File exists - (bin/menu.zsh, bin/menu.zsh~) […] Also, i should mention i had a file "bin/menu.zsh~" BEFORE using rmate,
then, removing it before a second rmate gave :
[…] Then, rmate is working except another file with the suffix "~" exists
too.
I’m a little unclear as to whether or not you solved your problem.
It might be that File::rename does not unlink destination first. Given that you are using rvm and the script is in ruby, I would assume you can test the relevant code on your version of ruby to see why it has a problem.
OK, I've found a solution working even if I want to edit a file of given path where path~ does exist.
I've just changed the way the hard linked file is name, instead of "#{path}~" i name it npath with, as a starting point i let : npath="#{path}~"
and if npath allready exist i change it to : npath="#{npath}~" ^_________ notice the "n" here
then I changed the lines 97/104 to : npath="#{path}~" if File.exist? path while File.exist? npath npath="#{npath}~" end puts "Creating hard link from #{path} to #{npath}." if $settings.verbose File.link(path, npath) end
and here, suppose i do have both files "~/bin/menu.zsh" and "~/bin/menu.zsh~" where I want to remote edit "~/bin/menu.zsh", internally (of rmate-test) the npath would be in this case "~/bin/menu.zsh~~" (with two ~) which doesn't exist.
that makes the rmate-test working : yt@D620 /home/yt $ rmate-test -v bin/menu.zsh yt@D620 /home/yt $ Connect: ‘220 imyt.local RMATE TextMate (Darwin 11.4.0)’ Saving bin/menu.zsh Creating hard link from bin/menu.zsh to bin/menu.zsh~~. Closed bin/menu.zsh Done
yt@D620
see attached rmate-test, the modified rmate.
On Sep 12, 2012, at 8:47 AM, Yvon Thoraval yvon.thoraval@gmail.com wrote:
[…] OK, I've found a solution working even if I want to edit a file of given path where path~ does exist.
Ah, this makes sense. I committed a fix: https://github.com/textmate/rmate/commit/0bf8a92286880de61800961724b0ec5f0d5...
Just to be sure, rmate did properly cleanup the backup files for you, right? I.e. that you already had path~ was from some other app.
2012/9/19 Allan Odgaard mailinglist@textmate.org
On Sep 12, 2012, at 8:47 AM, Yvon Thoraval yvon.thoraval@gmail.com wrote:
[…] OK, I've found a solution working even if I want to edit a file of
given path where path~ does exist.
Ah, this makes sense. I committed a fix: https://github.com/textmate/rmate/commit/0bf8a92286880de61800961724b0ec5f0d5...
Just to be sure, rmate did properly cleanup the backup files for you, right? I.e. that you already had path~ was from some other app.
Yes, the already existing path~ was coming from another text editor and yes too it isn't wipe. The only cleanup file is the path~~ in that case