rustlings icon indicating copy to clipboard operation
rustlings copied to clipboard

Restlings panicked due to "Permission denied" after I launched it

Open soul2zimate opened this issue 11 months ago • 3 comments

Restlings panicked due to "Permission denied" after I launched it as below (I added RUST_BACKTRACE=full environment variable to display a backtrace):

thread 'main' panicked at src/tools/clippy/src/main.rs:139:10:
could not run cargo: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
stack backtrace:
   0:        0x11026b0c0 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h4b01b56329a0a8fc
   1:        0x10da730e4 - core::fmt::write::h5ac783d2f16cae69
   2:        0x11025efa4 - std::io::Write::write_fmt::h740ae8bf4425e1f4
   3:        0x11026af80 - std::sys::backtrace::BacktraceLock::print::h822ac0a1da741b33
   4:        0x11026d4a4 - std::panicking::default_hook::{{closure}}::h182e34e1427a763f
   5:        0x11026d2a0 - std::panicking::default_hook::hf3c673ab0d652139
   6:        0x11026de8c - std::panicking::rust_panic_with_hook::ha68643d4311595e9
   7:        0x11026da38 - std::panicking::begin_panic_handler::{{closure}}::h0edcf2e5c8ce9186
   8:        0x11026b55c - std::sys::backtrace::__rust_end_short_backtrace::h25049b070cf1a527
   9:        0x11026d6fc - _rust_begin_unwind
  10:        0x11293bce4 - core::panicking::panic_fmt::ha0b5c5252c2f1706
  11:        0x11293c0cc - core::result::unwrap_failed::h49b97238f5f454fc
  12:        0x104360970 - cargo_clippy[198b87c2d23e2101]::main
  13:        0x10435ebc8 - std[c851462af2470259]::sys::backtrace::__rust_begin_short_backtrace::<fn(), ()>
  14:        0x10435ebe0 - std[c851462af2470259]::rt::lang_start::<()>::{closure#0}
  15:        0x1102506a0 - std::rt::lang_start_internal::hd55fd6ef897020fb
  16:        0x104360fe8 - _main

Output
       Welcome to...                      
                 _   _ _                  
  _ __ _   _ ___| |_| (_)_ __   __ _ ___  
 | '__| | | / __| __| | | '_ \ / _` / __| 
 | |  | |_| \__ \ |_| | | | | | (_| \__ \ 
 |_|   \__,_|___/\__|_|_|_| |_|\__, |___/ 
                               |___/      

This exercise compiles successfully. The remaining exercises contain a compiler
or logic error. The central concept behind Rustlings is to fix these errors and
solve the exercises. Good luck!

The file of this exercise is `exercises/00_intro/intro1.rs`. Have a look!
The current exercise path will be always shown under the progress bar.
You can click on the path to open the exercise file in your editor.


Progress: [>---------------------------------------------------------------------------------------------------]   0/94
Current exercise: exercises/00_intro/intro1.rs

h:hint / l:list / c:check all / x:reset / q:quit ? 

My rust and system information:

➜  rustlings git:(main) ✗ rustc --version
rustc 1.85.1 (4eb161250 2025-03-15)

➜  rustlings git:(main) ✗ sw_vers
ProductName:		macOS
ProductVersion:		15.3.2
BuildVersion:		24D81

soul2zimate avatar Apr 01 '25 05:04 soul2zimate

Also experiencing same. rustling init throw up this error.

This command will create the directory `rustlings/`which will contain the exercises.
Press ENTER to continue

Error: Initialization failed

Caused by:
    0: Failed to create the `rustlings/` directory
    1: Permission denied (os error 13)```

xxxxxx@DESKTOP:~/rust-learning$ rustling```

```

     ```  Welcome to...
                 _   _ _
  _ __ _   _ ___| |_| (_)_ __   __ _ ___
 | '__| | | / __| __| | | '_ \ / _` / __|
 | |  | |_| \__ \ |_| | | | | | (_| \__ \
 |_|   \__,_|___/\__|_|_|_| |_|\__, |___/
                               |___/
```
```
The exercises/ directory couldn't be found in the current directory.
If you are just starting with Rustlings, run the command `rustlings init` to initialize it

```

Obasoro avatar Apr 02 '25 03:04 Obasoro

Make sure that you are able to create files and directories in the directory where you try to initialize Rustlings. You seem to be missing the write permission in this directory. Try a different one.

Try running mkdir test, touch test.txt and ls -l before running rustlings init. What output do you get?

mo8it avatar Apr 29 '25 09:04 mo8it

➜  test pwd
/Users/chaowan/test
➜  test ls -l
total 0
drwxr-xr-x@ 12 chaowan  staff  384 Apr 30 11:38 rustlings
-rw-r--r--   1 chaowan  staff    0 Apr 30 11:37 test.txt

I have the write permission inside the directory, the error happens when I run rustlings inside rustlings directory and press ENTER I see that error:

thread 'main' panicked at src/tools/clippy/src/main.rs:139:10:
could not run cargo: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

above the welcome message.

soul2zimate avatar Apr 30 '25 03:04 soul2zimate

Sorry, I forgot about this issue. Is it possible that you don't have Clippy installed? If you still have this issue, please post the output of cargo clippy --version

mo8it avatar Jul 04 '25 21:07 mo8it