aurora / rmate

Remote TextMate 2 implemented as shell script
GNU General Public License v3.0
886 stars 123 forks source link

head -c not option on all remote hosts ends up corrupting file #8

Closed cdenneen closed 9 years ago

cdenneen commented 11 years ago

head -c$value <&3 >>"$tmp" 2>/dev/null

ended up overwriting remote file with the following:

user@host:~$ more /etc/apache2/2.2/httpd.conf usage: head [-n #] [-#] [filename...]

aurora commented 11 years ago

So you are one of those with a head not supporting -c :-( ... which OS is it you tried it?

cdenneen commented 11 years ago

Solaris 11

aurora commented 11 years ago

I've just pushed a change to use "dd" again ... could you please try and see if it works for you?

cdenneen commented 11 years ago

It works with dd thanks. I thought these options didn't work that's why you went with head -c to begin with? How might I reproduce the original dd truncation issue?

Also it seems with -f option the hostname isn't passed to display for hostname:filename... appears to work if -f isn't used.

Oddity, and this seems to happen before and after the head/dd switch, is that certain files get truncated opening in buffer. Oddly enough I can open larger files fine but some smaller files are being truncated into buffer.

I'd open a ticket on this but I'm not sure exactly what to provide to debug the issue. Same file that truncates with rmate-bash opens fine with rmate-ruby

aurora commented 11 years ago

sorry for my late reply. the original dd bug was related to different dd options. you can find more details on it at the already closed issue: https://github.com/aurora/rmate/pull/7