Crystal: Not able to run or compile any code from 25.1 on

Created on 14 Nov 2018  路  4Comments  路  Source: crystal-lang/crystal

The error im receiving is

./crystal build ~/Documents/crystal_projects/testing/src/new.cr 
execvp: Not a directory: Not a directory (Errno)
  from ???
  from ???
  from ???
  from ???
  from ???
  from ???
  from ???
  from ???
  from ???
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues

The code inside of this file was simply

puts "Hello World"

This particular version is

./crystal -v
Crystal 0.27.0 [c9d1eef8f] (2018-11-01)

LLVM: 4.0.0
Default target: x86_64-unknown-linux-gnu

but i have successfully reproduced this particular bug on version 26.1 as well.

The project was created using the crystal init app command

Most helpful comment

Your PATH is broken and contains /home/brice/Documents/btex/btex, which is a file and not a directory. Since the compiler is compiled with musl libc, not glibc, this case isn't handled.

This was fixed by musl in https://git.musl-libc.org/cgit/musl/commit/src/process/execvp.c?id=8e0b38060d7a9916fc2b5de0dd7c166ef60be9c1, which is part of musl 1.1.19, which is part of alpine 3.8, so we need to update our alpine linux version from 3.7 in the distribution scripts.

For now, unbreak your PATH by removing all entries which are files, not directories.

All 4 comments

Can you prefix the command with strace -f and paste the last 50 lines or so here? My best guess is that an executable is trying to be run, but one of the parent directories is actually a file.

Here it is

execve("./crystal", ["./crystal", "build", "/home/brice/Documents/crystal_pr"...], [/* 137 vars */]) = 0
brk(NULL)                               = 0x55d4a1c54000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=148558, ...}) = 0
mmap(NULL, 148558, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fe62d857000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1868984, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe62d856000
mmap(NULL, 3971488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe62d28d000
mprotect(0x7fe62d44d000, 2097152, PROT_NONE) = 0
mmap(0x7fe62d64d000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c0000) = 0x7fe62d64d000
mmap(0x7fe62d653000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe62d653000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe62d855000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe62d854000
arch_prctl(ARCH_SET_FS, 0x7fe62d855700) = 0
mprotect(0x7fe62d64d000, 16384, PROT_READ) = 0
mprotect(0x55d49fd24000, 8192, PROT_READ) = 0
mprotect(0x7fe62d87c000, 4096, PROT_READ) = 0
munmap(0x7fe62d857000, 148558)          = 0
getuid()                                = 1000
getgid()                                = 1000
getpid()                                = 27205
rt_sigaction(SIGCHLD, {0x55d49fb18540, ~[RTMIN RT_1], SA_RESTORER, 0x7fe62d2c24b0}, NULL, 8) = 0
geteuid()                               = 1000
brk(NULL)                               = 0x55d4a1c54000
brk(0x55d4a1c75000)                     = 0x55d4a1c75000
getppid()                               = 27202
stat("/home/brice/Downloads/crystal-0.27.0-1/bin", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("./crystal", O_RDONLY)             = 3
fcntl(3, F_DUPFD, 10)                   = 10
close(3)                                = 0
fcntl(10, F_SETFD, FD_CLOEXEC)          = 0
geteuid()                               = 1000
getegid()                               = 1000
rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0x55d49fb18540, ~[RTMIN RT_1], SA_RESTORER, 0x7fe62d2c24b0}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7fe62d2c24b0}, NULL, 8) = 0
rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7fe62d2c24b0}, NULL, 8) = 0
read(10, "#!/bin/sh\n\n################## ht"..., 8192) = 2924
pipe([3, 4])                            = 0
clone(strace: Process 27206 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fe62d8559d0) = 27206
[pid 27205] close(4)                    = 0
[pid 27206] close(10 <unfinished ...>
[pid 27205] read(3,  <unfinished ...>
[pid 27206] <... close resumed> )       = 0
[pid 27206] close(3)                    = 0
[pid 27206] dup2(4, 1)                  = 1
[pid 27206] close(4)                    = 0
[pid 27206] pipe([3, 4])                = 0
[pid 27206] clone(strace: Process 27207 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fe62d8559d0) = 27207
[pid 27207] close(3 <unfinished ...>
[pid 27206] close(4 <unfinished ...>
[pid 27207] <... close resumed> )       = 0
[pid 27206] <... close resumed> )       = 0

This was the command i used to get the trace

 touch log2 | strace -f ./crystal build ~/Documents/crystal_projects/testing/src/new.cr 2>&1 | tee -a log2

I've attached the log file with the full trace. Let me know what other information may be helpful!

Thanks!

log.txt.zip

Your PATH is broken and contains /home/brice/Documents/btex/btex, which is a file and not a directory. Since the compiler is compiled with musl libc, not glibc, this case isn't handled.

This was fixed by musl in https://git.musl-libc.org/cgit/musl/commit/src/process/execvp.c?id=8e0b38060d7a9916fc2b5de0dd7c166ef60be9c1, which is part of musl 1.1.19, which is part of alpine 3.8, so we need to update our alpine linux version from 3.7 in the distribution scripts.

For now, unbreak your PATH by removing all entries which are files, not directories.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pbrusco picture pbrusco  路  3Comments

RX14 picture RX14  路  3Comments

asterite picture asterite  路  3Comments

Papierkorb picture Papierkorb  路  3Comments

lgphp picture lgphp  路  3Comments