Subject: bug#53355: guix shell --check: confusing error message

From: Maxime Devos <[email-masked]>
Date: Sat, 25 Jun 2022 19:40:48 +0200

Chris Marusich schreef op za 25-06-2022 om 09:52 [-0700]:
> Yes, I agree those are good reasons to avoid a temporary file if we
> can.
> To that end, do you know if we can somehow force Guile to use a
> specific
> file descriptor for the pipe?  In the patch I wrote earlier, which
> uses
> redirection, the problem was that I could not control Guile's choice
> of
> file descriptors.  Guile chose file descriptor 19 for one end of the
> pipe, and I don't know how to make it use anything else.  If we can
> arrange for Guile to consistently use file descriptor 7, for example,
> then probably it would work in all the shell I've tested.
> 
> I wonder if maybe I can just duplicate the file descriptor?  I don't
> know; if for example Guile reserves all the file descriptors below 10
> for other uses, it might be hard.
> 

Have a look at ‘(guile)Ports and File Descriptors’.  It has lots of
procedures for duplicating and renumbering.  That's fragile though, you
might accidentally overwrite an fd that's being used for something
else.

(Normally move->fdes would prevent overwriting things by moving pre-
existing fds out of the way, adjusting ports automatically, but move-
>fdes doesn't know (yet) about the pipe that Guile uses for
finalisation, see maybe:
<https://debbugs.gnu.org/cgi/bugreport.cgi?bug=48563>)

I think it would be best to patch the dash appropriately (though fixing
move->fdes would be nice too).

Greetings,
Maximee.