Edit : cannot save on sshfs mounted file system

View: New views
7 Messages — Rating Filter:   Alert me  

Edit : cannot save on sshfs mounted file system

by Samuel Dionne-Riel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I can't say if this has been addressed before, but I can't save onto an
sshfs filesystem with Edit. What happens is that it creates a temporary
files, then has some troubles renaming it... thus it gives me this
traceback:

Traceback (most recent call last):
  File "/home/samuel/.cache/0install.net/implementations/
sha1=329e6c0191f65ef2996b49837d04c4cfe6934758/Edit/AppRun", line 32, in
<module>
    rox.mainloop()
  File "/home/samuel/.cache/0install.net/implementations/
sha1new=9c116df3689d60df58925a7c634064ac2394f696/ROX-Lib2/python/rox/
__init__.py", line 262, in mainloop
    g.main()
  File "/home/samuel/.cache/0install.net/implementations/
sha1new=9c116df3689d60df58925a7c634064ac2394f696/ROX-Lib2/python/rox/
Menu.py", line 232, in _activate
    self.fns[action].activate(self.caller)
  File "/home/samuel/.cache/0install.net/implementations/
sha1new=9c116df3689d60df58925a7c634064ac2394f696/ROX-Lib2/python/rox/
Menu.py", line 82, in activate
    getattr(caller, self.fn)(*self.values)
  File "/home/samuel/.cache/0install.net/implementations/
sha1=329e6c0191f65ef2996b49837d04c4cfe6934758/Edit/EditWindow.py", line
682, in save
    self.save_to_file(self.uri)
  File "/home/samuel/.cache/0install.net/implementations/
sha1new=9c116df3689d60df58925a7c634064ac2394f696/ROX-Lib2/python/rox/
saving.py", line 164, in save_to_file
    os.rename(tmp, path)
OSError: [Errno 1] Opération non permise


When I save with another editor, let's say nano, it works, so I think it
may be in the behaviour of Edit that there is a problem.


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
rox-users mailing list
rox-users@...
https://lists.sourceforge.net/lists/listinfo/rox-users

Re: Edit : cannot save on sshfs mounted file system

by Lennon Cook-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Samuel Dionne-Riel <samuel@...> wrote:
> What happens is that it creates a
> temporary files, then has some troubles renaming it... thus it gives
> me this traceback:
This same behavior also causes other problems - for example, it has the
side-effect of resetting permissions and extended attributes, every
time the file is saved.

Is there a reason for this behavior? Why can't it just try to overwrite
the file in-place, like most other editors? The only obvious reason
would be for atomicity (so that it doesn't write half the file and then
fail); for which a better solution - again, adopted by some existing
programs - would be to save a backup copy of the *old* version until
it's done all it can to get the new version on disk.


--
Lennon Victor Cook
"He who receives an idea from me receives without lessening, as he who
lights his candle at mine receives light without darkening" -- Thomas
Jefferson


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
rox-users mailing list
rox-users@...
https://lists.sourceforge.net/lists/listinfo/rox-users

signature.asc (196 bytes) Download Attachment

Re: Edit : cannot save on sshfs mounted file system

by Thomas Leonard-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/5/7 Lennon Cook <lennon@...>:

> Samuel Dionne-Riel <samuel@...> wrote:
>> What happens is that it creates a
>> temporary files, then has some troubles renaming it... thus it gives
>> me this traceback:
> This same behavior also causes other problems - for example, it has the
> side-effect of resetting permissions and extended attributes, every
> time the file is saved.
>
> Is there a reason for this behavior? Why can't it just try to overwrite
> the file in-place, like most other editors? The only obvious reason
> would be for atomicity (so that it doesn't write half the file and then
> fail); for which a better solution - again, adopted by some existing
> programs - would be to save a backup copy of the *old* version until
> it's done all it can to get the new version on disk.

That still leaves you with an inconsistent file during the save (which can
be a problem for config files) and if the save fails.

Any idea why the rename is failing?

Also, it shouldn't be losing the permissions (it preserves them for me, on
a normal filesystem).


--
Dr Thomas Leonard http://rox.sourceforge.net
GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
rox-users mailing list
rox-users@...
https://lists.sourceforge.net/lists/listinfo/rox-users

Re: Edit : cannot save on sshfs mounted file system

by Samuel Dionne-Riel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le Fri, 09 May 2008 20:25:00 +0100, Thomas Leonard a écrit :

> 2008/5/7 Lennon Cook <lennon@...>:
>
> That still leaves you with an inconsistent file during the save (which
> can be a problem for config files) and if the save fails.
>
> Any idea why the rename is failing?
>
> Also, it shouldn't be losing the permissions (it preserves them for me,
> on a normal filesystem).

I have no idea of why the rename is failing, it must be a problem with
sshfs, here's what I tried in the console:
samuel@HOMER:~/BENCH/test/silence$ nano test.txt
samuel@HOMER:~/BENCH/test/silence$ touch bla.txt
samuel@HOMER:~/BENCH/test/silence$ mv bla.txt test.txt
mv: ne peut déplacer `bla.txt' vers `test.txt': Opération non permise
[can't move bla.txt to test.txt]
samuel@HOMER:~/BENCH/test/silence$ cd ..
samuel@HOMER:~/BENCH/test$ cd ..
samuel@HOMER:~/BENCH$ touch test.txt
samuel@HOMER:~/BENCH$ nano test
samuel@HOMER:~/BENCH$ nano test.txt
samuel@HOMER:~/BENCH$ touch bla.txt
samuel@HOMER:~/BENCH$ nano test.txt
samuel@HOMER:~/BENCH$ mv bla.txt test.txt
samuel@HOMER:~/BENCH$

silence is in a sshfs mountpoint, BENCH is in my home mountpoint.

--

Anyway, here's a wonky-really-crazy "patch" I made, don't tell me I'm mad
for doing this, I already know.

Replace line 164 of current version of ROX-Lib2/python/rox/saving.py
                                os.rename(tmp, path)
by
                                tmp2 = 'tmp2-' + `random.randrange
(1000000)`
                                tmp2 = os.path.join(parent_dir, tmp2)
                                os.rename(path, tmp2)
                                os.rename(tmp, path)
                                os.unlink(tmp2)

I know it seems crazy, but it's a proof of concept that at least makes
Edit useable, but I'm sure that any python gurus will scream at me when
seeing this, this must be a really ugly hack...

Now, I'm off searching the sshfs mailing list or at least contact
someone, as it may seem that the problem isn't on your end...


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
rox-users mailing list
rox-users@...
https://lists.sourceforge.net/lists/listinfo/rox-users

Re: Edit : cannot save on sshfs mounted file system

by Samuel Dionne-Riel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le Fri, 09 May 2008 22:58:40 +0000, Samuel Dionne-Riel a écrit :

> Le Fri, 09 May 2008 20:25:00 +0100, Thomas Leonard a écrit :
>
>> 2008/5/7 Lennon Cook <lennon@...>:
>>
>> Any idea why the rename is failing?
>
> I have no idea of why the rename is failing, it must be a problem with
> sshfs[...]
>
> Anyway, here's a wonky-really-crazy "patch" I made, don't tell me I'm
> mad for doing this, I already know.
>
[snip]
>
> I know it seems crazy, but it's a proof of concept that at least makes
> Edit useable, but I'm sure that any python gurus will scream at me when
> seeing this, this must be a really ugly hack...
>
> Now, I'm off searching the sshfs mailing list or at least contact
> someone, as it may seem that the problem isn't on your end...
>


STOP!!
Forget what I just sent, it might not be sane, if you happen to have the
same problem with sshfs, use:
-oworkaround=rename
as an option, it will make it work like expected.

I should have searched this before being stupid.


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
rox-users mailing list
rox-users@...
https://lists.sourceforge.net/lists/listinfo/rox-users

Re: Edit : cannot save on sshfs mounted file system

by Thomas Leonard-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/5/10 Samuel Dionne-Riel <samuel@...>:

> Le Fri, 09 May 2008 22:58:40 +0000, Samuel Dionne-Riel a écrit :
>
>> Le Fri, 09 May 2008 20:25:00 +0100, Thomas Leonard a écrit :
>>
>>> 2008/5/7 Lennon Cook <lennon@...>:
>>>
>>> Any idea why the rename is failing?
>>
>> I have no idea of why the rename is failing, it must be a problem with
>> sshfs[...]
>>
>> Anyway, here's a wonky-really-crazy "patch" I made, don't tell me I'm
>> mad for doing this, I already know.
>>
> [snip]
>>
>> I know it seems crazy, but it's a proof of concept that at least makes
>> Edit useable, but I'm sure that any python gurus will scream at me when
>> seeing this, this must be a really ugly hack...
>>
>> Now, I'm off searching the sshfs mailing list or at least contact
>> someone, as it may seem that the problem isn't on your end...
>>
>
>
> STOP!!
> Forget what I just sent, it might not be sane, if you happen to have the
> same problem with sshfs, use:
> -oworkaround=rename
> as an option, it will make it work like expected.

Ah, good! So this is fixed in newer versions of openssh?


--
Dr Thomas Leonard http://rox.sourceforge.net
GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
rox-users mailing list
rox-users@...
https://lists.sourceforge.net/lists/listinfo/rox-users

Re: Edit : cannot save on sshfs mounted file system

by Samuel Dionne-Riel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le Sat, 10 May 2008 11:06:28 +0100, Thomas Leonard a écrit :

> 2008/5/10 Samuel Dionne-Riel <samuel@...>:
>> Le Fri, 09 May 2008 22:58:40 +0000, Samuel Dionne-Riel a écrit :
>>
>> STOP!!
>> Forget what I just sent, it might not be sane, if you happen to have
>> the same problem with sshfs, use:
>> -oworkaround=rename
>> as an option, it will make it work like expected.
>
> Ah, good! So this is fixed in newer versions of openssh?

Well, I don't think it has anything to do with openssh, it's sshfs, a
fuse filesystem, but anyway, there is a workaround... I don't know why it
isn't turned on by default, but it seems to work now.


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
rox-users mailing list
rox-users@...
https://lists.sourceforge.net/lists/listinfo/rox-users