Logs: liberachat/#haskell
| 2021-08-11 19:44:23 | × | phma_ quits (phma@2001:5b0:211f:5fe8:78b1:ef72:430f:1b2b) (Read error: Connection reset by peer) |
| 2021-08-11 19:46:31 | × | azeem quits (~azeem@dynamic-adsl-84-220-236-17.clienti.tiscali.it) (Ping timeout: 268 seconds) |
| 2021-08-11 19:47:34 | → | azeem joins (~azeem@176.200.246.189) |
| 2021-08-11 19:48:25 | → | favonia joins (~favonia@user/favonia) |
| 2021-08-11 19:51:51 | × | norias quits (~jaredm@c-98-219-195-163.hsd1.pa.comcast.net) (Ping timeout: 258 seconds) |
| 2021-08-11 19:54:33 | × | MQ-17J quits (~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Read error: Connection reset by peer) |
| 2021-08-11 19:55:00 | → | phma_ joins (phma@2001:5b0:212a:e878:afe7:6ceb:226:dcbd) |
| 2021-08-11 19:56:19 | → | Guest822 joins (~Guest82@176.88.30.49) |
| 2021-08-11 19:56:50 | <Guest822> | @undo [x | Just x <- xs] |
| 2021-08-11 19:56:50 | <lambdabot> | concatMap (\ a -> case a of { Just x -> [x]; _ -> []}) xs |
| 2021-08-11 19:58:06 | <Guest822> | @undo picks (x:xs) = (x,xs):[(y,x:ys) | (y,ys) <- picks xs] |
| 2021-08-11 19:58:06 | <lambdabot> | picks (x : xs) = (x, xs) : concatMap (\ (y, ys) -> [(y, x : ys)]) (picks xs) |
| 2021-08-11 19:58:25 | × | azeem quits (~azeem@176.200.246.189) (Ping timeout: 248 seconds) |
| 2021-08-11 19:58:49 | → | azeem joins (~azeem@dynamic-adsl-84-220-236-17.clienti.tiscali.it) |
| 2021-08-11 19:59:04 | → | MQ-17J joins (~MQ-17J@8.6.144.209) |
| 2021-08-11 19:59:23 | × | phma_ quits (phma@2001:5b0:212a:e878:afe7:6ceb:226:dcbd) (Read error: Connection reset by peer) |
| 2021-08-11 20:00:16 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-08-11 20:00:28 | jpds1 | is now known as jpds |
| 2021-08-11 20:03:27 | × | Skyfire quits (~pyon@user/pyon) (Ping timeout: 245 seconds) |
| 2021-08-11 20:04:03 | × | Guest822 quits (~Guest82@176.88.30.49) (Quit: Client closed) |
| 2021-08-11 20:04:05 | × | ec quits (~ec@gateway/tor-sasl/ec) (Ping timeout: 244 seconds) |
| 2021-08-11 20:05:16 | × | juhp quits (~juhp@128.106.188.220) (Ping timeout: 258 seconds) |
| 2021-08-11 20:05:33 | → | Skyfire joins (~pyon@user/pyon) |
| 2021-08-11 20:05:35 | → | phma_ joins (phma@2001:5b0:211b:9608:8da1:6cde:bf81:5b9c) |
| 2021-08-11 20:07:23 | → | juhp joins (~juhp@128.106.188.220) |
| 2021-08-11 20:09:38 | × | drd quits (~drd@2001:b07:a70:9f1f:1562:34de:f50f:77d4) (Ping timeout: 272 seconds) |
| 2021-08-11 20:09:44 | ← | jakalx parts (~jakalx@base.jakalx.net) (Error from remote client) |
| 2021-08-11 20:10:00 | × | emliunix quits (~emliunix@8.38.148.66) (Remote host closed the connection) |
| 2021-08-11 20:10:09 | × | matijja quits (~matijja@193.77.181.201) (Ping timeout: 248 seconds) |
| 2021-08-11 20:10:22 | → | emliunix joins (~emliunix@8.38.148.66) |
| 2021-08-11 20:11:48 | → | benin036932 joins (~benin@183.82.205.178) |
| 2021-08-11 20:12:19 | → | ec joins (~ec@gateway/tor-sasl/ec) |
| 2021-08-11 20:12:28 | → | matijja joins (~matijja@193.77.181.201) |
| 2021-08-11 20:15:14 | × | retro_ quits (~retro@5ec19a54.skybroadband.com) (Ping timeout: 258 seconds) |
| 2021-08-11 20:21:36 | × | burnsidesLlama quits (~burnsides@dhcp168-023.wadham.ox.ac.uk) (Remote host closed the connection) |
| 2021-08-11 20:28:14 | → | vysn joins (~vysn@user/vysn) |
| 2021-08-11 20:28:53 | × | ec quits (~ec@gateway/tor-sasl/ec) (Ping timeout: 244 seconds) |
| 2021-08-11 20:30:45 | × | matijja quits (~matijja@193.77.181.201) (Quit: ZNC 1.8.1 - https://znc.in) |
| 2021-08-11 20:31:08 | → | matijja joins (~matijja@193.77.181.201) |
| 2021-08-11 20:32:51 | × | MoC quits (~moc@user/moc) (Quit: Konversation terminated!) |
| 2021-08-11 20:36:37 | → | ec joins (~ec@gateway/tor-sasl/ec) |
| 2021-08-11 20:44:29 | → | pavonia joins (~user@user/siracusa) |
| 2021-08-11 20:47:47 | × | favonia quits (~favonia@user/favonia) (Remote host closed the connection) |
| 2021-08-11 20:48:00 | × | ec quits (~ec@gateway/tor-sasl/ec) (Ping timeout: 244 seconds) |
| 2021-08-11 20:49:45 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 2021-08-11 20:54:57 | × | markpythonicbitc quits (~markpytho@50.228.44.6) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-08-11 20:55:53 | → | ec joins (~ec@gateway/tor-sasl/ec) |
| 2021-08-11 20:59:39 | × | Obo quits (~roberto@70.pool90-171-81.dynamic.orange.es) (Quit: WeeChat 2.8) |
| 2021-08-11 21:02:00 | × | eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2021-08-11 21:04:14 | × | lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 268 seconds) |
| 2021-08-11 21:04:17 | × | curiousgay quits (~curiousga@77-120-186-48.kha.volia.net) (Ping timeout: 245 seconds) |
| 2021-08-11 21:05:01 | <maralorn> | When I write `<(echo foo)` in shell it returns a file descriptor `/proc/self/fd/14` where now another process can read from. How can I achieve exactly that in Haskell? |
| 2021-08-11 21:05:58 | <dsal> | There are a lot of different things going on there. What are you trying to do? |
| 2021-08-11 21:06:06 | <geekosaur> | you want the file descriptor, or the pathname to it? |
| 2021-08-11 21:07:06 | × | bitmapper quits (uid464869@id-464869.tooting.irccloud.com) (Quit: Connection closed for inactivity) |
| 2021-08-11 21:07:26 | <maralorn> | I want the pathname. |
| 2021-08-11 21:07:49 | → | acidjnk_new3 joins (~acidjnk@p200300d0c72b954045cad12a4be3b29e.dip0.t-ipconnect.de) |
| 2021-08-11 21:08:04 | <maralorn> | Concretely I have a program that I want to call in my shakefile that wants a filename pointing to a file containing a password. |
| 2021-08-11 21:08:37 | <monochrom> | The shell creates a pipe, then finds out the FD of the read end, let's say it happens to be 14, then generates the string "/proc/self/fd/14" and passes it down as a command line argument. |
| 2021-08-11 21:08:39 | <maralorn> | But I don‘t want to write my password to disk or even the tmpfs. |
| 2021-08-11 21:09:06 | <geekosaur> | ah, the old hold-in-in-a-pipe trick |
| 2021-08-11 21:09:21 | <maralorn> | Yeah |
| 2021-08-11 21:09:33 | → | acidjnk joins (~acidjnk@p200300d0c72b954099fc00439288b01d.dip0.t-ipconnect.de) |
| 2021-08-11 21:09:44 | <geekosaur> | which kinda fails with /proc/self/fd anyway |
| 2021-08-11 21:09:56 | <geekosaur> | or at least lost being safe even from root |
| 2021-08-11 21:10:27 | <maralorn> | Well, good enough. Also I am root. |
| 2021-08-11 21:10:54 | → | jneira_ joins (~jneira_@28.red-80-28-169.staticip.rima-tde.net) |
| 2021-08-11 21:11:13 | <maralorn> | I guess I can do something like `withPipe` and then convert the read end handle to an FD? |
| 2021-08-11 21:11:22 | × | acidjnk_new quits (~acidjnk@p200300d0c72b9540687e52e56cad208d.dip0.t-ipconnect.de) (Ping timeout: 245 seconds) |
| 2021-08-11 21:11:44 | <monochrom> | And the "echo foo" part is run under output redirection too, its stdout is the write end of the pipe, say FD 15. |
| 2021-08-11 21:12:37 | <monochrom> | Which package does withPipe come from? (Certainly not what comes with GHC.) |
| 2021-08-11 21:12:58 | × | acidjnk_new3 quits (~acidjnk@p200300d0c72b954045cad12a4be3b29e.dip0.t-ipconnect.de) (Ping timeout: 272 seconds) |
| 2021-08-11 21:13:01 | <sm> | you could have your haskell program run a little bit of shell (bash), probably ? |
| 2021-08-11 21:13:27 | <maralorn> | monochrom: I can‘t find right now it tbh. |
| 2021-08-11 21:13:40 | <geekosaur> | @hoogle withPipe |
| 2021-08-11 21:13:40 | <lambdabot> | GI.GLib.Functions spawnAsyncWithPipes :: (HasCallStack, MonadIO m) => Maybe [Char] -> [[Char]] -> Maybe [[Char]] -> [SpawnFlags] -> Maybe SpawnChildSetupFunc -> m (Int32, Int32, Int32, Int32) |
| 2021-08-11 21:14:03 | <maralorn> | monochrom: https://hackage.haskell.org/package/shh-0.7.1.4/docs/Shh-Internal.html#v:withPipe |
| 2021-08-11 21:14:35 | <maralorn> | But I would feel a little bit stupid to get a dependency to shh just for doing that. |
| 2021-08-11 21:14:43 | <monochrom> | I have never heard of shh. I can't vouch for it. |
| 2021-08-11 21:14:57 | <maralorn> | Converting a handle to an fd is in base. |
| 2021-08-11 21:15:12 | <maralorn> | shh is more or less like shelly and it’s quite nice. |
| 2021-08-11 21:15:41 | <maralorn> | I guess I can have a look at the implementation there … |
| 2021-08-11 21:16:10 | <sm> | isn't there something suitable in https://hackage.haskell.org/package/process-1.6.13.2/docs/System-Process.html ? |
| 2021-08-11 21:16:10 | <monochrom> | Generally I would be super paranoid about detailed technical semantics of "converting" between Handle and FD. |
| 2021-08-11 21:16:41 | <maralorn> | sm: Yes |
| 2021-08-11 21:16:43 | <maralorn> | https://hackage.haskell.org/package/process-1.6.13.2/docs/System-Process.html#v:createPipe |
| 2021-08-11 21:16:48 | <maralorn> | Looks about right. |
| 2021-08-11 21:16:56 | <monochrom> | For example, after the Handle->FD "conversion", if you close that Handle, does that close the FD too? Is this consistent with what you want? |
| 2021-08-11 21:16:58 | <maralorn> | Or better https://hackage.haskell.org/package/process-1.6.13.2/docs/System-Process.html#v:createPipeFd |
| 2021-08-11 21:17:40 | <monochrom> | And do not sleep well if you don't write explicit code to close that Handle either. GC can close it behind your back. |
| 2021-08-11 21:19:31 | sm | confirms that `readCreateProcessWithExitCode (shell "ls <(echo test)") ""` does not work |
| 2021-08-11 21:19:56 | <maralorn> | It doesn‘t? Why not? |
| 2021-08-11 21:20:09 | <sm> | <() syntax is rejected by something |
| 2021-08-11 21:20:18 | <sm> | Prelude System.Process> readCreateProcessWithExitCode (shell "echo <(echo test)") "" |
| 2021-08-11 21:20:18 | <sm> | (ExitFailure 2,"","/bin/sh: -c: line 0: syntax error near unexpected token `('\n/bin/sh: -c: line 0: `echo <(echo test)'\n") |
| 2021-08-11 21:20:25 | <sm> | ah, it's not using bash |
| 2021-08-11 21:20:29 | <maralorn> | Might be a bashism? |
| 2021-08-11 21:20:32 | <maralorn> | yeah |
| 2021-08-11 21:20:49 | <maralorn> | Anyways, I believe I have my solution now. |
| 2021-08-11 21:21:07 | × | takuan quits (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection) |
All times are in UTC.