[horde] VFS ssh2 _listFolder() buglet?

Benedetto Vassallo vassallo at unipa.it
Fri Jan 7 08:54:12 UTC 2011


Def. Quota Lawrence Stewart <lstewart at room52.net>:

> Hi Benedetto,
>
> On 01/07/11 09:44, Benedetto Vassallo wrote:
>>
>> Def. Quota Lawrence Stewart <lstewart at room52.net>:
>>
>>> Hi all,
>>>
>>> Whilst switching my Gollem config over to using the ssh2 backend, I
>>> think I've found a bug in the ssh2 VFS code. I got the Gollem config to
>>> the point where I could successfully upload files, but the directory
>>> listing would always claim the directory to be empty without any sort of
>>> error logged in the horde log file.
>>>
>>> After a bit of sleuthing, I tracked the offending line of code to:
>>>
>>> $stream = @ssh2_exec($this->_stream, 'LC_TIME=C ls -' . $ls_args . ' ' .
>>> escapeshellarg($path));
>>>
>>> (Horde v3.3.11, line 489 of lib/VFS/ssh2.php)
>>>
>>> I use FreeBSD as the server OS and tcsh as my shell. Prefixing the
>>> command with an ENV=VAR assignment only works on Bourne type shells. It
>>> seems the sftp server on FreeBSD runs the command in the context of the
>>> user's selected shell as opposed to /bin/sh, because the offending line
>>> produces no output as a result of the command failing.
>>>
>>> My solution fixes the problem for me and I believe is more correct than
>>> the current code. By prefixing the ls command with "env", all shells
>>> including tcsh are happy i.e.:
>>>
>>> $stream = @ssh2_exec($this->_stream, 'env LC_TIME=C ls -' . $ls_args . '
>>> ' . escapeshellarg($path));
>>>
>>> Prefixing with env allows everything to work perfectly for me.
>>>
>>> Does the above seem reasonable or have I misunderstood something? I'll
>>> file a bug report with the patch if people think my analysis is correct.
>>>
>>> Cheers,
>>> Lawrence
>>>
>>> PS: I haven't looked, but I suspect there could be instances of other
>>> such problems in the tree. It would be useful to do an audit of command
>>> lines run by horde to look for others which set env vars in the same
>>> manner as the above code.
>>
>> Hello,
>> As a feedback I use Horde 3.3.11 and gollem 1.1.2 on CentOs 5.5, php
>> 5.1.6, bash shell and ssh2 backend works fine for me.
>
> Thanks for the data point. I would expect this to be the case given that
> bash is a Bourne-like shell and happily runs 'ENV=VAR command'. What
> would be interesting to know is if a csh derivative shell on Linux
> encounters the same issue I'm seeing.
>
> Do you feel like trying a quick little experiment of temporarily
> changing your shell with the chsh command to csh or tcsh and seeing if
> gollem fails to give you a directory listing back? If you have
> "'createhome' => true" set in your ssh2 backend for Gollem, you will get
> an error along the lines of "Cannot create home dir" when you try click
> on your Gollem vdir. This is because the dir listing fails, so it thinks
> it needs to create the homedir which already exists, and it propagates
> the failure to create the dir up to horde which effectively blocks
> access to your vdir. If you see that error or you have "'createhome' =>
> false" and get an empty dir listing when you know files should be
> listed, try switching your shell back to bash and confirm everything
> comes good again.
>
> That aside, my proposed change is harmless for people running sh/bash so
> I don't see a reason not to make the change. I'm still curious to know
> the outcome of the above experiment on a Linux system.
>
> Cheers,
> Lawrence
>

Hello Lawrence
Changing the login shell to csh I have the same problem.
I see an empty folder even when folder is containing files.

Regards
-- 
Benedetto Vassallo
Sistema Informativo di Ateneo
Settore Gestione Reti Hardware e Software
U.O. Sviluppo e manutenzione dei sistemi
Università degli studi di Palermo

Red Hat Certified Engineer Certificate Number: 804007793324656

Phone: +3909123860056
Fax: +390916529124

-------------------------------------------------------------------------
This message was sent using the University of Palermo web mail interface.



More information about the horde mailing list