Giter Club home page Giter Club logo

Comments (8)

johnae avatar johnae commented on May 26, 2024

It's likely something about the rails console environment that causes this. Perhaps causes issues with the pty. Been a long time since I worked on this. Maybe reading https://ruby-doc.org/stdlib-2.5.3/libdoc/pty/rdoc/PTY.html would help?

from sambal.

jhonatsz avatar jhonatsz commented on May 26, 2024

will take a look into this one. though right now been able to make it work by switching from debian to ubuntu image. This seems to solve my issue. But the cons is i need to build an ubuntu image with ruby first instead of using the official ruby image based on debian.

my initial thought was why is this lib not working on any debian os env

from sambal.

danielnielsennumber1 avatar danielnielsennumber1 commented on May 26, 2024

I am having the same problem using debian.
I dont quite understand the solution that you have sugested @jhonatsz
Does that mean that when you install the gem in ubuntu it works?
Is it possible to use the ubuntu gem in debian?

from sambal.

jhonatsz avatar jhonatsz commented on May 26, 2024

@danielnielsennumber1 there is no ubuntu gem, i did switch my base image to ubuntu and install ruby that works for me.

from sambal.

danielnielsennumber1 avatar danielnielsennumber1 commented on May 26, 2024

That makes sense.
Since im using debian as my system OS i cant just do that.

Im trying to debug on this problem to find a solution.
I have monkeypatched the gem so i can get the input/output ptys(they are the same though)

It seems like the PTY does not get the last line from the smbclient. "smb: >"
It just hangs forever. Im not sure if the problem is in the smbclient end or pty.

❯ smbclient '**host and share**' -U *user**/*pass**
Try "help" to get a list of possible commands.
smb: \> ls *
  .                                   D        0  Thu Dec  6 10:17:05 2018
  ..                                  D        0  Thu Dec  6 10:17:05 2018
  Faktura                             D        0  Fri Apr  8 15:09:29 2022
  fakturatest                         D        0  Thu Dec  6 11:59:00 2018
  kontoudtog                          D        0  Mon Sep  6 09:18:56 2021
  test                                D        0  Tue Sep 11 10:16:22 2018

                262143231 blocks of size 4096. 114399680 blocks available
smb: \>


from (pry):25:in `gets'
[15] [spec_crm][development] pry(main)> client.input.puts("ls * ")
=> nil
[16] [spec_crm][development] pry(main)> client.output.gets
=> "ls * \r\n"
[17] [spec_crm][development] pry(main)> client.output.gets
=> "\e[?2004l\r  .                                   D        0  Thu Dec  6 10:17:05 2018\r\n"
[18] [spec_crm][development] pry(main)> client.output.gets
=> "  ..                                  D        0  Thu Dec  6 10:17:05 2018\r\n"
[19] [spec_crm][development] pry(main)> client.output.gets
=> "  Faktura                             D        0  Fri Apr  8 15:09:29 2022\r\n"
[20] [spec_crm][development] pry(main)> client.output.gets
=> "  fakturatest                         D        0  Thu Dec  6 11:59:00 2018\r\n"
[21] [spec_crm][development] pry(main)> client.output.gets
=> "  kontoudtog                          D        0  Mon Sep  6 09:18:56 2021\r\n"
[22] [spec_crm][development] pry(main)> client.output.gets
=> "  test                                D        0  Tue Sep 11 10:16:22 2018\r\n"
[23] [spec_crm][development] pry(main)> client.output.gets
=> "\r\n"
[24] [spec_crm][development] pry(main)> client.output.gets
=> "\t\t262143231 blocks of size 4096. 114399680 blocks available\r\n"
[25] [spec_crm][development] pry(main)> client.output.gets




^CInterrupt:
from (pry):36:in `gets'

from sambal.

danielnielsennumber1 avatar danielnielsennumber1 commented on May 26, 2024

If i do two writes I can get past the hang the first time and i see some strange characters
=> "\e[?2004hsmb: \> ls * \r\n"

[71] [spec_crm][development] pry(main)> client.input.puts("ls * ")
=> nil
[72] [spec_crm][development] pry(main)> client.input.puts("ls * ")
=> nil
[73] [spec_crm][development] pry(main)> client.output.gets
=> "ls * \r\n"
[74] [spec_crm][development] pry(main)> client.output.gets
=> "\e[?2004l\r  .                                   D        0  Thu Dec  6 10:17:05 2018\r\n"
[75] [spec_crm][development] pry(main)> client.output.gets
=> "  ..                                  D        0  Thu Dec  6 10:17:05 2018\r\n"
[76] [spec_crm][development] pry(main)> client.output.gets
=> "  Faktura                             D        0  Fri Apr  8 15:09:29 2022\r\n"
[77] [spec_crm][development] pry(main)> client.output.gets
=> "  fakturatest                         D        0  Thu Dec  6 11:59:00 2018\r\n"
[78] [spec_crm][development] pry(main)> client.output.gets
=> "  kontoudtog                          D        0  Mon Sep  6 09:18:56 2021\r\n"
[79] [spec_crm][development] pry(main)> client.output.gets
=> "  test                                D        0  Tue Sep 11 10:16:22 2018\r\n"
[80] [spec_crm][development] pry(main)> client.output.gets
=> "\r\n"
[81] [spec_crm][development] pry(main)> client.output.gets
=> "\t\t262143231 blocks of size 4096. 114399680 blocks available\r\n"
[82] [spec_crm][development] pry(main)> client.output.gets
=> "\e[?2004hsmb: \\> ls * \r\n"
[83] [spec_crm][development] pry(main)> client.output.gets
=> "\e[?2004l\r  .                                   D        0  Thu Dec  6 10:17:05 2018\r\n"
[84] [spec_crm][development] pry(main)> client.output.gets
=> "  ..                                  D        0  Thu Dec  6 10:17:05 2018\r\n"
[85] [spec_crm][development] pry(main)> client.output.gets
=> "  Faktura                             D        0  Fri Apr  8 15:09:29 2022\r\n"
[86] [spec_crm][development] pry(main)> client.output.gets
=> "  fakturatest                         D        0  Thu Dec  6 11:59:00 2018\r\n"
[87] [spec_crm][development] pry(main)> client.output.gets
=> "  kontoudtog                          D        0  Mon Sep  6 09:18:56 2021\r\n"
[88] [spec_crm][development] pry(main)> client.output.gets
=> "  test                                D        0  Tue Sep 11 10:16:22 2018\r\n"
[89] [spec_crm][development] pry(main)> client.output.gets
=> "\r\n"
[90] [spec_crm][development] pry(main)> client.output.gets
=> "\t\t262143231 blocks of size 4096. 114399680 blocks available\r\n"
[91] [spec_crm][development] pry(main)> client.output.gets

since my usecase is quite simple im just gonna use system for now. But maybe this will help someone else who has the problem who knows more about ptys and control chars.

from sambal.

stuartluscombe avatar stuartluscombe commented on May 26, 2024

I don't have any suggestions on how to resolve this issue, but I can confirm that it is different between Debian and Ubuntu.

After experiencing the issue that my connections were succeeding, but I couldn't navigate on Debian, I spun up a separate Ubuntu instance (WSL2) and rebuilt my dev environment. The connections were fine straight away in there.

from sambal.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.