Loading ...
Sorry, an error occurred while loading the content.

Re: Explorer does not honour port number when editing over SCP

Expand Messages
  • Benjamin R. Haskell
    ... It appears we both missed something, as I also thought this was a worksforme . The problem is not with opening an individual file. It only occurs when
    Message 1 of 11 , Aug 30, 2011
    • 0 Attachment
      On Tue, 30 Aug 2011, Charles Campbell wrote:

      > guyht wrote:
      >> I am experiencing a bug where Explorer does not honour a port number
      >> when editing files over SCP.
      >>
      >> To reproduce
      >>
      >> Open a directory over scp (gvim scp://user@domain:1234//home/user/)
      >>
      >> Files and directories listed as expected...
      >>
      >> Open a file
      >>
      >> vim ignores the port number and attempts to edit the file at
      >> scp://user@domain:22//home/user/file.txt
      >>
      >
      > Hello,
      >
      > The machines I use to test netrw+scp use port#22, so what I did was
      >
      > scp://user@domain:22//home/user/somefile
      >
      > This worked, giving me the contents of the file.
      >
      > scp://user@domain:32//home/user/somefile
      >
      > This does not work. The "22" was extracted properly by NetrwMethod()
      > from the first example I gave above. So, I cannot seem to duplicate
      > your problem and will need your help. Please read :help netrw-debug
      > to generate a debugging trace when you attempt to open a file via the
      > non-default port number.

      It appears we both missed something, as I also thought this was a
      "worksforme".

      The problem is not with opening an individual file. It only occurs when
      opening a file from the directory listing.

      If I open:

      scp://bhaskell@...:443//home/bhaskell/

      The listing is appropriately routed via port 443 (which I use as a
      workaround for firewalls that block SSH port 22, but not HTTPS port
      443).

      But, if I hit Enter on .vimrc in that directory, it opens:

      scp://bhaskell@...//home/bhaskell/.vimrc

      (falling back to the default port, not port 443)

      I'm using Netrw v141n

      If you're in control of any of your test machines, you can simply add
      a second 'Port' line to /etc/ssh/sshd_config and restart sshd.

      E.g. to listen on both 22 and 443:
      Port 22
      Port 443

      --
      Best,
      Ben

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Guy Halford-Thompson
      Ah, sorry I wasn t too clear in my first post, thanks for clarifying. Unfortunately I can t change the sshd_config, going to have to work around it for the
      Message 2 of 11 , Aug 30, 2011
      • 0 Attachment
        Ah, sorry I wasn't too clear in my first post, thanks for clarifying.

        Unfortunately I can't change the sshd_config, going to have to work
        around it for the moment.

        Is this something that is likely to get fixed?

        Ty

        On 30 August 2011 08:33, Benjamin R. Haskell <vim@...> wrote:
        > On Tue, 30 Aug 2011, Charles Campbell wrote:
        >
        >> guyht wrote:
        >>>
        >>> I am experiencing a bug where Explorer does not honour a port number when
        >>> editing files over SCP.
        >>>
        >>> To reproduce
        >>>
        >>> Open a directory over scp (gvim scp://user@domain:1234//home/user/)
        >>>
        >>> Files and directories listed as expected...
        >>>
        >>> Open a file
        >>>
        >>> vim ignores the port number and attempts to edit the file at
        >>> scp://user@domain:22//home/user/file.txt
        >>>
        >>
        >> Hello,
        >>
        >> The machines I use to test netrw+scp use port#22, so what I did was
        >>
        >>  scp://user@domain:22//home/user/somefile
        >>
        >> This worked, giving me the contents of the file.
        >>
        >>  scp://user@domain:32//home/user/somefile
        >>
        >> This does not work.  The "22" was extracted properly by NetrwMethod() from
        >> the first example I gave above.  So, I cannot seem to duplicate your problem
        >> and will need your help.  Please read :help netrw-debug to generate a
        >> debugging trace when you attempt to open a file via the non-default port
        >> number.
        >
        > It appears we both missed something, as I also thought this was a
        > "worksforme".
        >
        > The problem is not with opening an individual file.  It only occurs when
        > opening a file from the directory listing.
        >
        > If I open:
        >
        > scp://bhaskell@...:443//home/bhaskell/
        >
        > The listing is appropriately routed via port 443 (which I use as a
        > workaround for firewalls that block SSH port 22, but not HTTPS port 443).
        >
        > But, if I hit Enter on .vimrc in that directory, it opens:
        >
        > scp://bhaskell@...//home/bhaskell/.vimrc
        >
        > (falling back to the default port, not port 443)
        >
        > I'm using Netrw v141n
        >
        > If you're in control of any of your test machines, you can simply add a
        > second 'Port' line to /etc/ssh/sshd_config and restart sshd.
        >
        > E.g. to listen on both 22 and 443:
        > Port 22
        > Port 443
        >
        > --
        > Best,
        > Ben
        >
        > --
        > You received this message from the "vim_dev" maillist.
        > Do not top-post! Type your reply below the text you are replying to.
        > For more information, visit http://www.vim.org/maillist.php
        >



        --
        Guy Halford-Thompson
        Blog                  - http://www.cach.me/blog
        Twitter               - https://twitter.com/mrwooster
        Google Plus       - http://gplus.name/guy

        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Lech Lorens
        ... Please, quote only the relevant parts of the conversation you are referring to. I believe that the suggestion about changing sshd_config was for Dr Chip.
        Message 3 of 11 , Aug 31, 2011
        • 0 Attachment
          On 31 August 2011 05:46, Guy Halford-Thompson <guy@...> wrote:
          > Ah, sorry I wasn't too clear in my first post, thanks for clarifying.
          >
          > Unfortunately I can't change the sshd_config, going to have to work
          > around it for the moment.
          >
          > Is this something that is likely to get fixed?

          Please, quote only the relevant parts of the conversation you are referring to.

          I believe that the suggestion about changing sshd_config was for Dr Chip.

          With regard to your problem, you can probably work it around by specifying
          in your ~/.ssh/config that the server you are connecting to uses a non-default
          port. It would be something like (I'm writing from memory, forgive me if I'm
          wrong. Check out "man ssh_config"):

          Host your.server.ip.or.name.com
          Port 1234

          For me personally it would actually be much more convenient than having to
          specify the port during every scp/ssh invocation.

          --
          Cheers,
          Lech Lorens

          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • Benjamin R. Haskell
          ... No problem. ... I wouldn t expect you to. That suggestion was in response to Dr. Chip s ... Seems very likely to me. And probably soon, based on his
          Message 4 of 11 , Aug 31, 2011
          • 0 Attachment
            On Tue, 30 Aug 2011, Guy Halford-Thompson wrote:

            > Ah, sorry I wasn't too clear in my first post, thanks for clarifying.

            No problem.


            My turn to clarify, it seems:

            > Unfortunately I can't change the sshd_config, going to have to work
            > around it for the moment.

            I wouldn't expect you to. That suggestion was in response to Dr. Chip's
            lead-in:

            >>> The machines I use to test netrw+scp use port#22,



            > Is this something that is likely to get fixed?

            Seems very likely to me. And probably soon, based on his usual
            turnaround time.

            --
            Best,
            Ben

            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • Benjamin R. Haskell
            ... As far as I can tell, the source of the issue is that autoload/netrw.vim s s:NetrwBrowse calls: (line 2439 in v141n): sil call
            Message 5 of 11 , Aug 31, 2011
            • 0 Attachment
              On Wed, 31 Aug 2011, Benjamin R. Haskell wrote:

              > On Tue, 30 Aug 2011, Guy Halford-Thompson wrote:
              >
              >> Is this something that is likely to get fixed?
              >
              > Seems very likely to me. And probably soon, based on his usual
              > turnaround time.

              As far as I can tell, the source of the issue is that
              autoload/netrw.vim's s:NetrwBrowse calls:

              (line 2439 in v141n):

              sil call netrw#NetRead(2,s:method."://".s:user.s:machine."/".s:path)

              Note the lack of any port numbers. When running my example (with :443),
              the dirname variable in that section properly contains that :443 and
              g:netrw_port is set to 443, but it's not being used.

              The easiest fix would be to use something like:

              let url = s:method."://".s:user.s:machine.(s:port ? ":".s:port : "")."/".s:path

              and replace the two occurrences around line 2439 of:
              s:method."://".s:user.s:machine."/".s:path

              with:
              url

              This worked for me, so, patch attached.

              --
              Best,
              Ben

              --
              You received this message from the "vim_dev" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            • Benjamin R. Haskell
              ... Yes. That s a good workaround. Even better would be to give your.server.ip.or.name.com a shorter name. For example, I have something like: Host home
              Message 6 of 11 , Aug 31, 2011
              • 0 Attachment
                On Wed, 31 Aug 2011, Lech Lorens wrote:

                > On 31 August 2011 05:46, Guy Halford-Thompson wrote:
                >> Unfortunately I can't change the sshd_config, going to have to work
                >> around it for the moment.
                >
                > With regard to your problem, you can probably work it around by
                > specifying in your ~/.ssh/config that the server you are connecting to
                > uses a non-default port. It would be something like (I'm writing from
                > memory, forgive me if I'm wrong. Check out "man ssh_config"):
                >
                > Host your.server.ip.or.name.com
                > Port 1234
                >
                > For me personally it would actually be much more convenient than
                > having to specify the port during every scp/ssh invocation.

                Yes. That's a good workaround.

                Even better would be to give your.server.ip.or.name.com a shorter name.

                For example, I have something like:

                Host home
                HostName your.server.ip.or.name.com
                Port 443

                Then the very short 'scp://home/.vimrc' is my .vimrc in my home dir on
                your.server.ip.or.name.com over port 443

                And the shortname is available via OpenSSH commands:

                ssh home
                scp file1 file2 home:

                --
                Best,
                Ben

                --
                You received this message from the "vim_dev" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
              • Charles Campbell
                ... I ll look into it. Been busy lately.... Regards, Chip -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the
                Message 7 of 11 , Aug 31, 2011
                • 0 Attachment
                  Benjamin R. Haskell wrote:
                  > On Wed, 31 Aug 2011, Benjamin R. Haskell wrote:
                  >
                  >> On Tue, 30 Aug 2011, Guy Halford-Thompson wrote:
                  >>
                  >>> Is this something that is likely to get fixed?
                  >>
                  >> Seems very likely to me. And probably soon, based on his usual
                  >> turnaround time.
                  >
                  > As far as I can tell, the source of the issue is that
                  > autoload/netrw.vim's s:NetrwBrowse calls:
                  >
                  > (line 2439 in v141n):
                  >
                  > sil call netrw#NetRead(2,s:method."://".s:user.s:machine."/".s:path)
                  >
                  > Note the lack of any port numbers. When running my example (with
                  > :443), the dirname variable in that section properly contains that
                  > :443 and g:netrw_port is set to 443, but it's not being used.
                  >
                  > The easiest fix would be to use something like:
                  >
                  > let url = s:method."://".s:user.s:machine.(s:port ? ":".s:port :
                  > "")."/".s:path
                  >
                  > and replace the two occurrences around line 2439 of:
                  > s:method."://".s:user.s:machine."/".s:path
                  >
                  > with:
                  > url
                  >
                  > This worked for me, so, patch attached.
                  >
                  I'll look into it. Been busy lately....
                  Regards,
                  Chip

                  --
                  You received this message from the "vim_dev" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php
                • Charles Campbell
                  ... The patch looks good, so I ll include it. The latest netrw is available for testing (which incorporates that patch) is available at my website:
                  Message 8 of 11 , Aug 31, 2011
                  • 0 Attachment
                    Charles Campbell wrote:
                    > Benjamin R. Haskell wrote:
                    >> On Wed, 31 Aug 2011, Benjamin R. Haskell wrote:
                    >>
                    >>> On Tue, 30 Aug 2011, Guy Halford-Thompson wrote:
                    >>>
                    >>>> Is this something that is likely to get fixed?
                    >>>
                    >>> Seems very likely to me. And probably soon, based on his usual
                    >>> turnaround time.
                    >>
                    >> As far as I can tell, the source of the issue is that
                    >> autoload/netrw.vim's s:NetrwBrowse calls:
                    >>
                    >> (line 2439 in v141n):
                    >>
                    >> sil call netrw#NetRead(2,s:method."://".s:user.s:machine."/".s:path)
                    >>
                    >> Note the lack of any port numbers. When running my example (with
                    >> :443), the dirname variable in that section properly contains that
                    >> :443 and g:netrw_port is set to 443, but it's not being used.
                    >>
                    >> The easiest fix would be to use something like:
                    >>
                    >> let url = s:method."://".s:user.s:machine.(s:port ? ":".s:port :
                    >> "")."/".s:path
                    >>
                    >> and replace the two occurrences around line 2439 of:
                    >> s:method."://".s:user.s:machine."/".s:path
                    >>
                    >> with:
                    >> url
                    >>
                    >> This worked for me, so, patch attached.
                    >>
                    > I'll look into it. Been busy lately....
                    The patch looks good, so I'll include it. The latest netrw is available
                    for testing (which incorporates that patch) is available at my website:
                    http://drchip.0sites.net/astronaut/vim/index.html#NETRW (v143h).

                    Regards,
                    Chip Campbell

                    --
                    You received this message from the "vim_dev" maillist.
                    Do not top-post! Type your reply below the text you are replying to.
                    For more information, visit http://www.vim.org/maillist.php
                  • Guy Halford-Thompson
                    ... Just installed the patch and it works great. Thanks for fixing so quickly -- Guy Halford-Thompson Blog                  - http://www.cach.me/blog
                    Message 9 of 11 , Aug 31, 2011
                    • 0 Attachment
                      On 31 August 2011 07:44, Charles Campbell <Charles.E.Campbell@...> wrote:
                      > Charles Campbell wrote:
                      >>
                      >> Benjamin R. Haskell wrote:
                      >>>
                      >>> On Wed, 31 Aug 2011, Benjamin R. Haskell wrote:
                      >>>
                      >>>> On Tue, 30 Aug 2011, Guy Halford-Thompson wrote:
                      >>>>
                      >>>>> Is this something that is likely to get fixed?
                      >>>>
                      >>>> Seems very likely to me.  And probably soon, based on his usual
                      >>>> turnaround time.
                      >>>
                      >>> As far as I can tell, the source of the issue is that
                      >>> autoload/netrw.vim's s:NetrwBrowse calls:
                      >>>
                      >>> (line 2439 in v141n):
                      >>>
                      >>> sil call netrw#NetRead(2,s:method."://".s:user.s:machine."/".s:path)
                      >>>
                      >>> Note the lack of any port numbers.  When running my example (with :443),
                      >>> the dirname variable in that section properly contains that :443 and
                      >>> g:netrw_port is set to 443, but it's not being used.
                      >>>
                      >>> The easiest fix would be to use something like:
                      >>>
                      >>> let url = s:method."://".s:user.s:machine.(s:port ? ":".s:port :
                      >>> "")."/".s:path
                      >>>
                      >>> and replace the two occurrences around line 2439 of:
                      >>> s:method."://".s:user.s:machine."/".s:path
                      >>>
                      >>> with:
                      >>> url
                      >>>
                      >>> This worked for me, so, patch attached.

                      Just installed the patch and it works great.

                      Thanks for fixing so quickly


                      --
                      Guy Halford-Thompson
                      Blog                  - http://www.cach.me/blog
                      Twitter               - https://twitter.com/mrwooster
                      Google Plus       - http://gplus.name/guy

                      --
                      You received this message from the "vim_dev" maillist.
                      Do not top-post! Type your reply below the text you are replying to.
                      For more information, visit http://www.vim.org/maillist.php
                    Your message has been successfully submitted and would be delivered to recipients shortly.