justincormack/ljsyscall

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

johnae opened this issue · 7 comments

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.

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-src@e75ba1d#diff-12c2f5b61ce3b017a25144619d13ca66

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.