adam12 changed the topic of #ruby to: Ruby 3.3.1, 3.2.4, 3.1.5 https://www.ruby-lang.org | Logs https://libera.irclog.whitequark.org/ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
jenrzzz has joined #ruby
graywolf has quit [Ping timeout: 264 seconds]
MoskitoHero has joined #ruby
donofrio__ has joined #ruby
yosafbridge has quit [Quit: Leaving]
jenrzzz has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
MoskitoHero has quit [Ping timeout: 256 seconds]
donofrio_ has quit [Ping timeout: 245 seconds]
brokkoli_origin has quit [Ping timeout: 260 seconds]
brokkoli_origin has joined #ruby
MoskitoHero has joined #ruby
yosafbridge has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
MoskitoHero has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
MoskitoHero has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
MoskitoHero has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
Linux_Kerio has joined #ruby
elcuervo has quit [Ping timeout: 245 seconds]
jenrzzz has joined #ruby
elcuervo has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
MoskitoHero has joined #ruby
jenrzzz has joined #ruby
MoskitoHero has quit [Ping timeout: 255 seconds]
Vonter has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
konsolebox has joined #ruby
MoskitoHero has joined #ruby
MoskitoHero has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
pascal_blaze has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
jenrzzz has joined #ruby
pascal_blaze has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
cappy has quit [Quit: Leaving]
jenrzzz has joined #ruby
_ht has joined #ruby
MoskitoHero has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
MoskitoHero has quit [Ping timeout: 240 seconds]
MoskitoHero has joined #ruby
MoskitoHero has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 245 seconds]
pascal_blaze has quit [Quit: Textual IRC Client: www.textualapp.com]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
MoskitoHero has joined #ruby
MoskitoHero has quit [Client Quit]
jenrzzz has joined #ruby
gaussianblue has joined #ruby
hansolo has quit [Ping timeout: 268 seconds]
factor2 has quit [Ping timeout: 256 seconds]
factor2 has joined #ruby
hansolo has joined #ruby
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
grenierm has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
Vonter has quit [Ping timeout: 260 seconds]
jenrzzz has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
gr33n7007h has quit [Quit: WeeChat 4.2.2]
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
grenierm has quit [Quit: Client closed]
grenierm has joined #ruby
jenrzzz has joined #ruby
Trivial has joined #ruby
gr33n7007h has joined #ruby
Vonter has joined #ruby
gaussianblue has quit [Quit: leaving]
jenrzzz has quit [Ping timeout: 245 seconds]
gaussianblue has joined #ruby
wand has quit [Remote host closed the connection]
wand has joined #ruby
jenrzzz has joined #ruby
Vonter has quit [Read error: Connection reset by peer]
Vonter has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
Guest98 has joined #ruby
Guest98 has quit [Client Quit]
jenrzzz has joined #ruby
nmollerup has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
donofrio__ has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
grenierm has quit [Quit: Client closed]
donofrio has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
<konsolebox> Anyone knows how to explicitly prevent ruby from interpreting arguments in a shebang when the script is called with `ruby script.rb`?
jenrzzz has joined #ruby
Trivial has quit [Ping timeout: 264 seconds]
patrick has quit [Ping timeout: 256 seconds]
patrick_ is now known as patrick
Hel67 has joined #ruby
Hel67 has quit [Client Quit]
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
donofrio has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 252 seconds]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
jenrzzz has joined #ruby
gaussianblue has quit [Quit: leaving]
bambanxx has joined #ruby
ken_barber has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
jenrzzz has joined #ruby
<adam12> konsolebox: Example?
<konsolebox> adam12: I created this C program to make sure a stub only executes against the ruby implementation it was built to in Gentoo. When I add --autopick as the first token of the argument it gets read by the Ruby implementation that's loaded. Ruby apparently scans the shebang header for options.
<adam12> Can you put `--` before it. `-- --autopick`?
<konsolebox> adam12: For example a script that's supposed to have #!/usr/bin/ruby will be modified to have `#!/usr/bin/rubyexec --autopick,ruby32,ruby31`. So if none of the implementations are currently "selected" in Gentoo, either of those two that are available will be executed instead.
<konsolebox> adam12: That doesn't help it. I tried it already.
<konsolebox> adam12: What does help is placing the argument after the implementations so I'll have ruby32,ruby31,--autopick.
<konsolebox> adam12: But I prefer explicitly telling Ruby not to do scanning instead of blindly relying on it just ignoring non-option arguments.
jenrzzz has quit [Ping timeout: 255 seconds]
<adam12> konsolebox: I can't say I've seen it eat args like that.
<adam12> konsolebox: rubyexec is your C program?
<konsolebox> Yes
<adam12> konsolebox: Can you share src?
bambanxx has joined #ruby
<mooff> i remember reading about the feature. you can put e.g. "#!/bin/ruby -r ostruct", then don't have to require "ostruct" in the script, even if run directly with /bin/ruby
<adam12> mooff: RUBYOPT ?
mark22k has quit [Quit: The Lounge - https://thelounge.chat]
<adam12> RUBYOPT="-rostruct"
<adam12> konsolebox: Are you passing argv back to ruby unchanged?
<konsolebox> No it's modified through create_new_argv. I already printf'd each argument of the resulting new_argv. It's made right as expected.
<adam12> konsolebox: Do you are stripping `--autopick,etc` from argv before execv ruby?
<adam12> so/Do/So
mark22k has joined #ruby
<konsolebox> adam12: Yes, argv[0] becomes path to ruby implementation binary, argv[1] becomes path to script. argv[2] becomes NULL. None else are added unless an argument is passed.
<adam12> konsolebox: Ohh. I see. But ruby is seeing `--autopick`? If not, then I am not sure I follow :(
<konsolebox> Yes Ruby still "sees" --autopick because it scans the shebang of the script.
<adam12> OOh.
<konsolebox> Not as an argument but from the script itself.
<adam12> What if you put a second shebang
<adam12> #!ruby
<adam12> after the first one
<adam12> I know it's a hack but I'm just curious.
jenrzzz has joined #ruby
<adam12> There's also ruby -x
<konsolebox> adam12: Doesn't help. With a script just having $'#!/usr/bin/rubyexec --autopick,ruby32,ruby31\n#!ruby\n\nputs ARGV.inspect', I get "ruby: invalid option --autopick,ruby32,ruby31 (-h will show valid options) (RuntimeError)" (ruby script.rb) or "/usr/bin/ruby32: invalid option --autopick,ruby32,ruby31 (-h will show valid options) (RuntimeError)" ($PWD/script.rb)
srbaker has quit [Quit: srbaker]
<adam12> konsolebox: Would you humour me by calling rubyexec something else like `konsolexec`?
<konsolebox> Lol
<konsolebox> I name it similar to Gentoo's pythonexec
<adam12> I know, but what if the scan looks for `/ruby.*/` (since a lot of older uses of ruby involved number suffixes like ruby19)
<mooff> what if you tell ruby to get the script from stdin, then write it from the second line onwards to its stdin
jenrzzz has quit [Ping timeout: 256 seconds]
<konsolebox> mooff: I think that'll make it complicated and may affect some scripts that may read the script's filename. Also redirecting the script code input to stdin would be risky since it may affect actually stdin input for it.
<konsolebox> *actual
<mooff> check out -x on https://linux.die.net/man/1/ruby
<konsolebox> adam12: I currently have a modified Gentoo package of https://github.com/defunkt/gist using it. It's working for now because I placed the option at the end.
<adam12> The C code is essentially `if (strstr(shebang, "ruby")) { parse args }`
<konsolebox> Hmm
<mooff> ^ sounds like it. inside if (strstr(shebang, "#!"))
<konsolebox> I might have to name it to something else then.
<mooff> or strpos() == 0, or whatever
<mooff> yeah.
<mooff> execrb, rbexec?
jenrzzz has joined #ruby
<konsolebox> I'm thinking of rbexec as one of it yes. I also thought about simply rx but then it would be a bit cryptic. Anyway I'm not in a hurry to decide. I'll take my time.
<adam12> konsolebox: I'll be curious to know if renaming binary fixes your issue. lmk when you get a chance.
<konsolebox> adam12: I can try it now.
<konsolebox> Yep it fixed it.
<adam12> Interesting stuff.
<konsolebox> Gist ran with --autopick,ruby...
<adam12> Learn something new every day, I guess.
<konsolebox> adam12: Yeah, Thanks for the help :)
<adam12> There's a re-exec trick that I think leah2 shared? which I thought was similar.
<konsolebox> mooff: Also you too
mark22k has quit [Quit: The Lounge - https://thelounge.chat]
mark22k has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
ken_barber has quit [Quit: Client closed]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
Guest57 has joined #ruby
user71 has joined #ruby
Guest57 has quit [Client Quit]
jenrzzz has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
elcuervo has quit [Ping timeout: 245 seconds]
elcuervo has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
donofrio has joined #ruby
jenrzzz has joined #ruby
dostoyevsky2 has quit [Quit: leaving]
dostoyevsky2 has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
_ht has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
graywolf has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
patrick_ has joined #ruby
patrick has joined #ruby
patrick has quit [Changing host]
patrick_ is now known as patrick
patrick_ has joined #ruby
jenrzzz has joined #ruby
patrick has quit [Read error: Connection reset by peer]
patrick_ is now known as patrick
patrick_ has joined #ruby
patrick has quit [Killed (iridium.libera.chat (Nickname regained by services))]
patrick_ is now known as patrick
patrick_ has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
patrick has quit [Ping timeout: 256 seconds]
patrick_ is now known as patrick
jenrzzz has joined #ruby
bambanxx has quit [Ping timeout: 256 seconds]
wand has quit [Ping timeout: 260 seconds]
jenrzzz has quit [Ping timeout: 245 seconds]
osc4rpt has quit [Ping timeout: 272 seconds]
jenrzzz has joined #ruby
osc4rpt has joined #ruby
mark22k has quit [Quit: The Lounge - https://thelounge.chat]
mark22k has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
cappy has joined #ruby
jenrzzz has joined #ruby
otisolsen70 has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
cappy has quit [Quit: Leaving]
otisolsen70 has quit [Quit: Leaving]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
Trivial has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
nopc0de has joined #ruby
jenrzzz has joined #ruby
kenyon has quit [Remote host closed the connection]
konsolebox has quit [Quit: .]
kenyon has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
osc4rpt has quit [Ping timeout: 268 seconds]
osc4rpt has joined #ruby
bambanxx has joined #ruby
wand has joined #ruby
___nick___ has quit [Ping timeout: 255 seconds]
wand has quit [Ping timeout: 260 seconds]
wand has joined #ruby
Starfoxxes has quit [Ping timeout: 255 seconds]
graywolf has quit [Quit: WeeChat 4.2.1]
Starfoxxes has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
user71 has quit [Quit: Leaving]
CrazyEddy has joined #ruby
Linux_Kerio has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
jenrzzz has joined #ruby
wand has quit [Ping timeout: 260 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
factor2 has quit [Ping timeout: 256 seconds]
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
Trivial has quit [Ping timeout: 264 seconds]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
Trivial has joined #ruby
c10l0 has joined #ruby
moo- has joined #ruby
bougyman_ has joined #ruby
BSaboia_ has joined #ruby
rvalue- has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
dannyAAM_ has joined #ruby
bougyman has quit [Quit: ZNC 1.8.2 - https://znc.in]
c10l has quit [Quit: Ping timeout (120 seconds)]
moo has quit [Remote host closed the connection]
BSaboia has quit [Quit: ZNC - https://znc.in]
dannyAAM has quit [Excess Flood]
rvalue has quit [Remote host closed the connection]
zayd has quit [Remote host closed the connection]
r3m has quit [Remote host closed the connection]
c10l0 is now known as c10l
r3m has joined #ruby
dannyAAM_ is now known as dannyAAM
rvalue- is now known as rvalue
jenrzzz has joined #ruby
zayd has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
bambanxx has joined #ruby
jenrzzz has joined #ruby
<zayd> I'm thinking of adding configuration to my fetch script by doing it with a custom .rb file that the user writes that defines the main function and what is printed instead of the traditional .conf or .yml. Is this a bad idea? I feel like it could allow for more natural and more fine-tuned customization with less moving parts.
<adam12> zayd: Seems fine and not actually that abnormal.
<adam12> zayd: It's likely audience dependent. If you think they can write Ruby then it would probably be more flexible. If they can't write Ruby, then yaml/whatever better solution.
<zayd> Yeah, I was playing with Suckless' stuff recently in a virtual machine and was kind of inspired by how they do their configs. I figured that this would probably be even easier because you don't have to recompile and the different configs can be stored in their own files in $XDG_CONFIG_HOME and then selected from a command line option like `--config /path/to/config.rb`
<zayd> adam12: I feel like Ruby is easy enough to approach for this type of thing and even if a user doesn't want to do that, they can either use the default config or use the 3000 other and probably better fetch scripts that come out daily
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
nopc0de has quit [Read error: Connection reset by peer]
Trivial has quit [Ping timeout: 240 seconds]