(System "command") problem

Hello,

I'm working on Kubuntu and i'm trying to use rclone for backups.
I wrote a simple script with racket/system:

#!/snap/bin/racket

#lang racket/base

(require racket/system)

(newline)
(displayln "  The command \"rclone --help\" will be executed")
(display   "  Do you want to continue?: ")

(if (equal? (read-line) "yes")
    (system "rclone --help")
    (displayln "  execution aborted"))

(newline)

This gives me an error: /bin/sh: 1: rclone: not found

I tryed (find-executable-path "rclone") but it gives me #false
If I use rclone from the command line it works.

Where's the mistake?

Matteo

It looks like the shell that racket is opening does not have "rclone" in its path. The environment variables for this shell are probably inherited from those shared with racket.

I can see two paths for solving this. One is to work to make sure that the path used in the shell creation are the same as those in your cli shell.

The other way (what I would suggest), is just to use the full path to rclone in your use of system.

1 Like

It might complicate matters that you are using a Flatpak, but see:

2 Likes

I tryed:

which rclone
=> /usr/bin/rclone

but if I run:

(system "/usr/bin/rclone --help")
=> /bin/sh: 1: /usr/bin/rclone: not found

and if I run:

(system* "/usr/bin/rclone" "--help")
=> exec failed (No such file or directory; errno=2)

If I look in /usr/bin/ I can find rclone and if I run it, it works.

Matteo

If you installed Racket as a Flatpak, Snap, or similar, it will likely be running in a mount namespace (in the Linux kernel sense) where /usr/bin is different than /usr/bin on your real filesystem. You might try:

(directory-list "/usr/bin")

I expect you will find very few things there.

1 Like

This is not the only problem I encountered so far. I installed
the Emacs racket-mode but the REPL didn't work.

I tried to install Racket with PPA but It didn't work.
I installed it through the script and now everything works.

Merry Christmas and Happy New Year
Matteo