Subject: “inappropriate ioctl for device” when running in RStudio Server

From: Ricardo Wurmus <[email-masked]>
Date: Fri, 16 Sep 2022 11:24:19 +0200

When running “guix” in RStudio Server the “terminal-window-size”
procedure triggers an error.  (You can ignore the cause of the error,
because I’m running this in a container where
/var/guix/profiles/per-user/rekado doesn’t exist.)

--8<---------------cut here---------------start------------->8---
> system("/bin/guix pull")
guix pull: error: while creating directory `/var/guix/profiles/per-user/rekado': Permission denied
hint: Backtrace:
          18 (primitive-load "/bin/guix")
In guix/ui.scm:
   2263:7 17 (run-guix . _)
  2226:10 16 (run-guix-command _ . _)
In ice-9/boot-9.scm:
  1752:10 15 (with-exception-handler _ _ #:unwind? _ # _)
  1747:15 14 (with-exception-handler #<procedure 7f0945757510 at ic…> …)
  1752:10 13 (with-exception-handler _ _ #:unwind? _ # _)
In guix/store.scm:
   656:37 12 (thunk)
In guix/status.scm:
    815:4 11 (call-with-status-report _ _)
In guix/store.scm:
   1318:3 10 (_)
   1295:8  9 (call-with-build-handler #<procedure 7f094576fd50 at g…> …)
In guix/scripts/pull.scm:
    526:3  8 (_)
In guix/profiles.scm:
   2300:6  7 (ensure-profile-directory)
In ice-9/boot-9.scm:
  1685:16  6 (raise-exception _ #:continuable? _)
  1685:16  5 (raise-exception _ #:continuable? _)
In guix/ui.scm:
   827:16  4 (_ _)
   311:42  3 (display-hint "Please create the @file{/var/guix/profi…" …)
In ice-9/boot-9.scm:
  1747:15  2 (with-exception-handler #<procedure 7f094576f2a0 at ic…> …)
In guix/build/syscalls.scm:
  2287:35  1 (_)
   2276:8  0 (terminal-window-size _)

guix/build/syscalls.scm:2276:8: In procedure terminal-window-size:
In procedure terminal-window-size: Inappropriate ioctl for device
--8<---------------cut here---------------end--------------->8---

Here yousee that the call to terminal-window-size fails because the
RStudio Server IDE in the web browser is not a true TTY.
“terminal-window-size” should fail gracefully.

-- 
Ricardo