justincormack / ljsyscall

LuaJIT Unix syscall FFI
http://www.myriabit.com/ljsyscall/
Other
440 stars 53 forks source link

at least lfs is broken on later versions of TrueOS (eg. FreeBSD 12.0 current) #218

Open johnae opened 6 years ago

johnae commented 6 years ago

I've had a spare laptop running TrueOS for testing my own projects on FreeBSD, TrueOS ofc being FreeBSD with drm-next and other things making it a much better option for a laptop. After updating to the latest stable release of TrueOS (release 17.12, released on 12 December 2017 I believe), at least lfs has started acting very odd. In short, I get segfaults every time when I run my own project and it seems to mostly be about lfs (though I'm not sure it's the only problem). For example, here's a run of the tests in ljsyscall:

$ luajit test/test.lua
test_raw_socket
  [test_raw_socket:test_ip_checksum]    Ok
test_termios
  [test_termios:test_ioctl_winsize]     Ok
  [test_termios:test_isatty_fail]       Ok
  [test_termios:test_pts_termios]       Ok
test_clock
  [test_clock:test_clock_gettime]       Ok
  [test_clock:test_clock_nanosleep]     Failed
  [test_clock:test_clock_nanosleep_abs]         Failed
test_mmap
  [test_mmap:test_getpagesize]  Ok
  [test_mmap:test_madvise]      Ok
  [test_mmap:test_mlock]        Ok
  [test_mmap:test_mlockall]     Ok
  [test_mmap:test_mmap_anon]    Ok
  [test_mmap:test_mmap_fail]    Ok
  [test_mmap:test_mmap_file]    Ok
  [test_mmap:test_mmap_page_offset]     Ok
  [test_mmap:test_msync]        Ok
test_processes
  [test_processes:test_execve]  Ok
  [test_processes:test_fork_wait]   [test_processes:test_fork_wait]     Ok
  [test_processes:test_fork_wait3]   [test_processes:test_fork_wait3]   Ok
  [test_processes:test_fork_wait4]   [test_processes:test_fork_wait4]   Ok
  [test_processes:test_fork_waitid]     Skipped
  [test_processes:test_fork_waitpid]   [test_processes:test_fork_waitpid]       Ok
  [test_processes:test_nice]    Ok
  [test_processes:test_setpgid]         Ok
  [test_processes:test_setsid]   [test_processes:test_setsid]   [test_processes:test_setsid]    Ok
test_proc
  [test_proc:test_proc_init]    Skipped
  [test_proc:test_proc_self]    Skipped
zsh: segmentation fault  luajit test/test.lua

So that segfaults after a short while.

Here's also something that's not right:

$ mkdir /tmp/foo
$ luajit -e 'lfs=require "syscall.lfs";print(lfs.attributes("/tmp/foo").mode)'
other

The above should be "directory" ofc. Can I help out in solving this somehow - what else can I do? TrueOS, before I updated, was based on an earlier FreeBSD 12.0 Current while the December 12 release is based on a later such 12.0 Current. Since TrueOS has boot environments (eg. I can easily boot from what was installed before the update) I've booted into what I had before the update and verified everything still works as expected there.

justincormack commented 6 years ago

Hmm, if clock_nanosleep fails one of the basic types must have changed...

On 11 Feb 2018 10:07, "John Axel Eriksson" notifications@github.com wrote:

I've had a spare laptop running TrueOS for testing my own projects on FreeBSD, TrueOS ofc being FreeBSD with drm-next and other things making it a much better option for a laptop. After updating to the latest stable release of TrueOS (release 17.12, released on 12 December 2017 I believe), at least lfs has started acting very odd. In short, I get segfaults every time when I run my own project and it seems to mostly be about lfs (though I'm not sure it's the only problem). For example, here's a run of the tests in ljsyscall:

$ luajit test/test.lua test_raw_socket [test_raw_socket:test_ip_checksum] Ok test_termios [test_termios:test_ioctl_winsize] Ok [test_termios:test_isatty_fail] Ok [test_termios:test_pts_termios] Ok test_clock [test_clock:test_clock_gettime] Ok [test_clock:test_clock_nanosleep] Failed [test_clock:test_clock_nanosleep_abs] Failed test_mmap [test_mmap:test_getpagesize] Ok [test_mmap:test_madvise] Ok [test_mmap:test_mlock] Ok [test_mmap:test_mlockall] Ok [test_mmap:test_mmap_anon] Ok [test_mmap:test_mmap_fail] Ok [test_mmap:test_mmap_file] Ok [test_mmap:test_mmap_page_offset] Ok [test_mmap:test_msync] Ok test_processes [test_processes:test_execve] Ok [test_processes:test_fork_wait] [test_processes:test_fork_wait] Ok [test_processes:test_fork_wait3] [test_processes:test_fork_wait3] Ok [test_processes:test_fork_wait4] [test_processes:test_fork_wait4] Ok [test_processes:test_fork_waitid] Skipped [test_processes:test_fork_waitpid] [test_processes:test_fork_waitpid] Ok [test_processes:test_nice] Ok [test_processes:test_setpgid] Ok [test_processes:test_setsid] [test_processes:test_setsid] [test_processes:test_setsid] Ok test_proc [test_proc:test_proc_init] Skipped [test_proc:test_proc_self] Skipped zsh: segmentation fault luajit test/test.lua

So that segfaults after a short while.

Here's also something that's not right:

$ mkdir /tmp/foo $ luajit -e 'lfs=require "syscall.lfs";print(lfs.attributes("/tmp/foo").mode)' other

The above should be "directory" ofc. Can I help out in solving this somehow - what else can I do? TrueOS before was based on an earlier FreeBSD 12.0 Current while the December 12 release is based on a later such 12.0 Current.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/justincormack/ljsyscall/issues/218, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdcPMdn2XJLf7-6CBIv05NaiIBFPLMFks5tTrvlgaJpZM4SBSIB .

johnae commented 6 years ago

Yeah it would appear so. I'll see if I can find something on that - I've looked around briefly but haven't found anything yet.

Den sön 11 feb. 2018 18:45Justin Cormack notifications@github.com skrev:

Hmm, if clock_nanosleep fails one of the basic types must have changed...

On 11 Feb 2018 10:07, "John Axel Eriksson" notifications@github.com wrote:

I've had a spare laptop running TrueOS for testing my own projects on FreeBSD, TrueOS ofc being FreeBSD with drm-next and other things making it a much better option for a laptop. After updating to the latest stable release of TrueOS (release 17.12, released on 12 December 2017 I believe), at least lfs has started acting very odd. In short, I get segfaults every time when I run my own project and it seems to mostly be about lfs (though I'm not sure it's the only problem). For example, here's a run of the tests in ljsyscall:

$ luajit test/test.lua test_raw_socket [test_raw_socket:test_ip_checksum] Ok test_termios [test_termios:test_ioctl_winsize] Ok [test_termios:test_isatty_fail] Ok [test_termios:test_pts_termios] Ok test_clock [test_clock:test_clock_gettime] Ok [test_clock:test_clock_nanosleep] Failed [test_clock:test_clock_nanosleep_abs] Failed test_mmap [test_mmap:test_getpagesize] Ok [test_mmap:test_madvise] Ok [test_mmap:test_mlock] Ok [test_mmap:test_mlockall] Ok [test_mmap:test_mmap_anon] Ok [test_mmap:test_mmap_fail] Ok [test_mmap:test_mmap_file] Ok [test_mmap:test_mmap_page_offset] Ok [test_mmap:test_msync] Ok test_processes [test_processes:test_execve] Ok [test_processes:test_fork_wait] [test_processes:test_fork_wait] Ok [test_processes:test_fork_wait3] [test_processes:test_fork_wait3] Ok [test_processes:test_fork_wait4] [test_processes:test_fork_wait4] Ok [test_processes:test_fork_waitid] Skipped [test_processes:test_fork_waitpid] [test_processes:test_fork_waitpid] Ok [test_processes:test_nice] Ok [test_processes:test_setpgid] Ok [test_processes:test_setsid] [test_processes:test_setsid] [test_processes:test_setsid] Ok test_proc [test_proc:test_proc_init] Skipped [test_proc:test_proc_self] Skipped zsh: segmentation fault luajit test/test.lua

So that segfaults after a short while.

Here's also something that's not right:

$ mkdir /tmp/foo $ luajit -e 'lfs=require "syscall.lfs";print(lfs.attributes("/tmp/foo").mode)' other

The above should be "directory" ofc. Can I help out in solving this somehow - what else can I do? TrueOS before was based on an earlier FreeBSD 12.0 Current while the December 12 release is based on a later such 12.0 Current.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/justincormack/ljsyscall/issues/218, or mute the thread < https://github.com/notifications/unsubscribe-auth/AAdcPMdn2XJLf7-6CBIv05NaiIBFPLMFks5tTrvlgaJpZM4SBSIB

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/justincormack/ljsyscall/issues/218#issuecomment-364771242, or mute the thread https://github.com/notifications/unsubscribe-auth/AABurHsopo3eqFsIObFlhsi4XiHG0-Doks5tTycngaJpZM4SBSIB .

johnae commented 6 years ago

Haven't taken a closer look but this does seem like quite a big change that could affect lfs at least (I'm not sure if or when this may have been included in TrueOS):

https://github.com/freebsd/freebsd/commit/e75ba1d5c4c79376a78351c8544388491db49664#diff-12c2f5b61ce3b017a25144619d13ca66

justincormack commented 6 years ago

Ah that would do it.

On 12 Feb 2018 08:34, "John Axel Eriksson" notifications@github.com wrote:

Haven't taken a closer look but this does seem like quite a big change that could affect lfs at least (I'm not sure if or when this may have been included in TrueOS):

freebsd/freebsd@e75ba1d#diff-12c2f5b61ce3b017a25144619d13ca66 https://github.com/freebsd/freebsd/commit/e75ba1d5c4c79376a78351c8544388491db49664#diff-12c2f5b61ce3b017a25144619d13ca66

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/justincormack/ljsyscall/issues/218#issuecomment-364856484, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdcPAGl-39r5v-2pHiLihdn_L6cT4hzks5tT_eFgaJpZM4SBSIB .

justincormack commented 6 years ago

There is version detection code at https://github.com/justincormack/ljsyscall/blob/master/syscall/freebsd/version.lua so can start to make changes, but it may get more complicated if there are different snapshots of 12 in the wild.

On 12 Feb 2018 08:46, "Justin Cormack" justin.cormack@docker.com wrote:

Ah that would do it.

On 12 Feb 2018 08:34, "John Axel Eriksson" notifications@github.com wrote:

Haven't taken a closer look but this does seem like quite a big change that could affect lfs at least (I'm not sure if or when this may have been included in TrueOS):

freebsd/freebsd@e75ba1d#diff-12c2f5b61ce3b017a25144619d13ca66 https://github.com/freebsd/freebsd/commit/e75ba1d5c4c79376a78351c8544388491db49664#diff-12c2f5b61ce3b017a25144619d13ca66

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/justincormack/ljsyscall/issues/218#issuecomment-364856484, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdcPAGl-39r5v-2pHiLihdn_L6cT4hzks5tT_eFgaJpZM4SBSIB .

johnae commented 6 years ago

Yeah there are different snapshots out there most likely and quite difficult to be compatible with all of them if changes like this go into some snapshot. However, as version 12 Current is a moving target, it may be reasonable to try to follow the tip version rather than trying to be compatible with all versions of the same. It seems quite likely that the 64-bit inode project is here to stay and will be part of the stable release of 12 whenever that happens.

justincormack commented 6 years ago

Yes, sounds good.

Will look at installing a head version.

On 12 Feb 2018 09:13, "John Axel Eriksson" notifications@github.com wrote:

Yeah there are different snapshots out there most likely and quite difficult to be compatible with all of them if changes like this go into some snapshot. However, as version 12 Current is a moving target, it may be reasonable to try to follow the tip version rather than trying to be compatible all versions of the same. It seems quite likely that the 64-bit inode project is here to stay and will be part of the stable release of 12 whenever that happens.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/justincormack/ljsyscall/issues/218#issuecomment-364865334, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdcPIY23_84uuoyJaw9x-VYuxDOp82uks5tUAClgaJpZM4SBSIB .