Closed magpie514 closed 2 years ago
Hmm interesting - thanks for the bug report.
I've never seen that error before, can you try updating to the latest commit to see if that fixes it? I made some filesystem related changes.
If it still shows that error, can you attach the strace output?
Thanks for replying! I tried updating, make clean and building again. Same error. Here is the strace output:
strace 123
execve("./123", ["123"], 0x7fff521a2850 /* 110 vars */) = 0
[ Process PID=7716 runs in 32 bit mode. ]
brk(NULL) = 0x8fc9000
arch_prctl(0x3001 /* ARCH_??? */, 0xffa488c8) = -1 EINVAL (Invalid argument)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7efe000
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)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
statx(3, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=139041, ...}) = 0
mmap2(NULL, 139041, PROT_READ, MAP_PRIVATE, 3, 0) = 0xf7edc000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/i386-linux-gnu/libc.so.6", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0p\27\2\0004\0\0\0"..., 512) = 512
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\303v\324\34\377Ds\24*\227\254\37\361\352\2643"..., 96, 468) = 96
statx(3, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=2280756, ...}) = 0
mmap2(NULL, 2312124, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xf7ca7000
mprotect(0xf7cc7000, 2129920, PROT_NONE) = 0
mmap2(0xf7cc7000, 1581056, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x20000) = 0xf7cc7000
mmap2(0xf7e49000, 544768, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a2000) = 0xf7e49000
mmap2(0xf7ecf000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x227000) = 0xf7ecf000
mmap2(0xf7ed2000, 38844, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xf7ed2000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/i386-linux-gnu/libtinfo.so.6", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0\0\0\0004\0\0\0"..., 512) = 512
statx(3, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=174336, ...}) = 0
mmap2(NULL, 177836, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xf7c7b000
mprotect(0xf7c82000, 139264, PROT_NONE) = 0
mmap2(0xf7c82000, 69632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0xf7c82000
mmap2(0xf7c93000, 65536, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0xf7c93000
mmap2(0xf7ca4000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x28000) = 0xf7ca4000
close(3) = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7c79000
set_thread_area({entry_number=-1, base_addr=0xf7c79700, limit=0x0fffff, seg_32bit=1, contents=0, read_exec_only=0, limit_in_pages=1, seg_not_present=0, useable=1}) = 0 (entry_number=12)
set_tid_address(0xf7c79768) = 7716
set_robust_list(0xf7c79770, 12) = 0
rseq(0xf7c79c20, 0x20, 0, 0x53053053) = 0
mprotect(0xf7ecf000, 8192, PROT_READ) = 0
mprotect(0xf7ca4000, 8192, PROT_READ) = 0
mprotect(0x8131000, 4096, PROT_READ) = 0
mprotect(0xf7f3b000, 8192, PROT_READ) = 0
ugetrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
munmap(0xf7edc000, 139041) = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
getrandom("\x23\x8b\x4e\xca", 4, GRND_NONBLOCK) = 4
brk(NULL) = 0x8fc9000
brk(0x8fea000) = 0x8fea000
brk(0x8feb000) = 0x8feb000
openat(AT_FDCWD, "/lib/chrclass/ascii", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
geteuid32() = 1000
getcwd("/home/magpie/Repositories/123elf", 1024) = 33
access("/home/magpie", R_OK|X_OK) = 0
access("/home/magpie/.l123set", F_OK) = 0
openat(AT_FDCWD, "/home/magpie/.l123set", O_RDONLY|O_LARGEFILE) = 3
ioctl(3, TCGETS, 0xffa4778c) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "1001 \"10\"\n1002 \"/proc/self/cwd/r"..., 1024) = 266
access("/proc/self/cwd/root/lotus/123.v10", R_OK|X_OK) = 0
access("/proc/self/cwd/root/lotus", R_OK|X_OK) = 0
access("/proc/self/cwd/root/lotus/123.v10", R_OK|X_OK) = 0
access("/proc/self/cwd/root/lotus/123.v10/ri/USA-English", R_OK|X_OK) = 0
read(3, "", 1024) = 0
close(3) = 0
openat(AT_FDCWD, "/proc/self/cwd/root/lotus/123.v10/ri/USA-English/123.ri", O_RDONLY|O_LARGEFILE) = 3
ioctl(3, TCGETS, 0xffa477e0) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "; @(#)123.ri\t113.1 18:43:17 6/14"..., 1024) = 1024
read(3, "ional argument]$Optional argumen"..., 1024) = 467
read(3, "", 1024) = 0
close(3) = 0
rt_sigaction(SIGABRT, {sa_handler=0x81199bc, sa_mask=[ABRT], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGUSR1, {sa_handler=0x81199bc, sa_mask=[USR1], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGUSR2, {sa_handler=0x81199bc, sa_mask=[USR2], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGHUP, {sa_handler=0x8119950, sa_mask=[HUP], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGPIPE, {sa_handler=0x8119950, sa_mask=[PIPE], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGQUIT, {sa_handler=0x81199bc, sa_mask=[QUIT], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=0x8119950, sa_mask=[TERM], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x8119950, sa_mask=[INT], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGILL, {sa_handler=0x81199bc, sa_mask=[ILL], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSEGV, {sa_handler=0x81199bc, sa_mask=[SEGV], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGALRM, {sa_handler=SIG_IGN, sa_mask=[ALRM], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x81199bc, sa_mask=[BUS], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTTOU, {sa_handler=SIG_IGN, sa_mask=[TTOU], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTTIN, {sa_handler=SIG_IGN, sa_mask=[TTIN], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGFPE, {sa_handler=0x8119c1c, sa_mask=[FPE], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
access("/home/magpie/.l123set", F_OK) = 0
openat(AT_FDCWD, "/home/magpie/.l123set", O_RDONLY|O_LARGEFILE) = 3
ioctl(3, TCGETS, 0xffa47784) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "1001 \"10\"\n1002 \"/proc/self/cwd/r"..., 1024) = 266
access("/proc/self/cwd/root/lotus/123.v10/hlp/USA-English", R_OK|X_OK) = 0
access("/proc/self/cwd/root/lotus/123.v10/cbd", R_OK|X_OK) = 0
access("/proc/self/cwd/root/lotus/123.v10/cbd/l_ascii.bun", R_OK) = 0
access("/proc/self/cwd/root/lotus/123.v10/cbd", R_OK|X_OK) = 0
access("/proc/self/cwd/root/lotus/123.v10/cbd/l13cUSA3.cbd", R_OK) = 0
access("/proc/self/cwd/root/lotus/123.v10/cbd", R_OK|X_OK) = 0
access("/proc/self/cwd/root/lotus/123.v10/cbd/l_ascii.bun", R_OK) = 0
access("/proc/self/cwd/root/lotus/123.v10/pbd", R_OK|X_OK) = 0
access("/proc/self/cwd/root/lotus/123.v10/pbd/egas25cs.vbd", R_OK) = 0
read(3, "", 1024) = 0
close(3) = 0
access("/proc/self/cwd/root/lotus/123.v10/keymaps", R_OK|X_OK) = 0
access("/home/magpie/lotus.bcf", R_OK) = -1 ENOENT (No such file or directory)
access("/proc/self/cwd/root/lotus/123.v10/sysV386", R_OK|X_OK) = 0
access("/proc/self/cwd/root/lotus/123.v10/sysV386/lotus.bcf", R_OK) = 0
access("/proc/self/cwd/root/lotus/123.v10/fonts", R_OK|X_OK) = 0
access("/proc/self/cwd/root/lotus/123.v10/keymaps/x", R_OK|X_OK) = 0
access("/proc/self/cwd/root/lotus/123.v10/keymaps/x/xterm-256color", R_OK) = 0
access("/home/magpie/.l123cnf", R_OK) = -1 ENOENT (No such file or directory)
getcwd("/home/magpie/Repositories/123elf", 256) = 33
statx(AT_FDCWD, "/home/magpie//", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=4096, ...}) = 0
statx(1, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFCHR|0600, stx_size=0, ...}) = 0
write(1, "123: Cannot initialize system fi"..., 49123: Cannot initialize system file configuration
) = 49
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
exit_group(1) = ?
+++ exited with 1 +++
Let me know if there's anything else I can provide.
I think this must be because of the /proc/self/cwd usage. I've removed that now, so this might just start working. I have it working here in a virtual machine with 22.04, hopefully some of the recent cleanups fixed it!
So far it still does the same, even with the latest commits.
Is it possible you have an old ~/.l123set
file? Could you try deleting it?
Tried deleting it, replacing it with a newer one, changing perms of that file, no change so far.
Also tried using a different terminal (xterm, from Konsole) and also no difference.
Currently at commit 33e945a5028e1044866979106541dc83a3393448, of course after make clean and rebuild.
EDIT: Got no unusual partitions or complex mounts. Current uname -a
output is Linux WINDINA 5.15.0-051500-generic #202110312130 SMP Sun Oct 31 21:33:20 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
.
This is interesting.
I tried executing it using a temporary HOME
. Like this, it runs.
I don't think there's anything unusual about my HOME
, it's a standard, unencrypted user folder in a /home mount point (ext4). What could be causing this?
Weird! I'm really confused, but I want to solve this -- everything in the strace looks totally normal.
If you don't mind trying a few things, maybe we can figure out what it's complaining about... If you run 123 under gdb, can you try breaking on lexit
(that's not a typo, lexit not exit) and showing me the stack? Like this:
$ gdb ./123
(gdb) b lexit
Breakpoint 1 at 0x8117ec6
(gdb) r
<123 probably prints some error>
(gdb) bt
#3 0x080d86c5 in leaf_pgm_node ()
#4 0x080d8576 in wleaf_node ()
#5 0x080da648 in input_task ()
#6 0x08112cf2 in sched ()
#7 0x081120e7 in __unix_main ()
#8 0x0812eb1d in main (argc=1, argv=0xffffda84, envp=0xffffda8c) at main.c:70
This is what I get with regular home. It....doesn't seem to be called, huh.
Reading symbols from 123...
(gdb) b lexit
Breakpoint 1 at 0x8117e5a
(gdb) r
Starting program: /home/magpie/Repositories/123elf/123
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
123: Cannot initialize system file configuration
[Inferior 1 (process 499338) exited with code 01]
(gdb) bt
No stack.
With temp home, exiting with /Quit:
HOME="/dev/shm/tmp.fWFKODRRlE/" gdb 123
GNU gdb (Ubuntu 12.0.90-0ubuntu1) 12.0.90
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from 123...
(gdb) b lexit
Breakpoint 1 at 0x8117e5a
(gdb) r
Starting program: /home/magpie/Repositories/123elf/123
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Inferior 1 (process 500884) exited normally]
(gdb) bt
No stack.
That caught me off-guard. Not sure how to interpret this. Let me know if there's anything else I can try. Do you want the produced binary for a "biopsy", too?
Hmm, can you try exit
with the l
too? It usually calls lexit()
when it can't start, so I assumed it would call that!
This is what I get:
Reading symbols from 123...
(gdb) b lexit
Breakpoint 1 at 0x8117e5a
(gdb) b exit
Breakpoint 2 at 0x804bf60
(gdb) r
Starting program: /home/magpie/Repositories/123elf/123
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
123: Cannot initialize system file configuration
Breakpoint 2, 0xf7da1440 in exit () from /lib/i386-linux-gnu/libc.so.6
(gdb) bt
#0 0xf7da1440 in exit () from /lib/i386-linux-gnu/libc.so.6
#1 0x08112875 in terminate_program ()
#2 0x081120e7 in main_init ()
#3 0x08112076 in __unix_main ()
#4 0x0812eab1 in main (argc=1, argv=0xffffcfa4, envp=0xffffcfac) at main.c:70
Hmm - I can see it reaches code that if it doesn't think your $HOME is valid (I know you had already figured that out, but just confirming from reading the code).
Things it rejects:
stat()
fails, or says it is not a directoryAll of those seem fine to me:
statx(AT_FDCWD, "/home/magpie//", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=4096, ...}) = 0
The stat works, and says S_IFDIR...maybe I'm not translating it properly? 😕
Just in case this is the strace at commit e1acff3fa8fe0bb352ea09d77d15401c65fac39d
execve("./123", ["123"], 0x7ffdfd5c5130 /* 111 vars */) = 0
[ Process PID=597827 runs in 32 bit mode. ]
brk(NULL) = 0x946f000
arch_prctl(0x3001 /* ARCH_??? */, 0xffe06028) = -1 EINVAL (Invalid argument)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7f37000
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)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
statx(3, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=139097, ...}) = 0
mmap2(NULL, 139097, PROT_READ, MAP_PRIVATE, 3, 0) = 0xf7f15000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/i386-linux-gnu/libc.so.6", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0p\27\2\0004\0\0\0"..., 512) = 512
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\303v\324\34\377Ds\24*\227\254\37\361\352\2643"..., 96, 468) = 96
statx(3, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=2280756, ...}) = 0
mmap2(NULL, 2312124, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xf7ce0000
mprotect(0xf7d00000, 2129920, PROT_NONE) = 0
mmap2(0xf7d00000, 1581056, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x20000) = 0xf7d00000
mmap2(0xf7e82000, 544768, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a2000) = 0xf7e82000
mmap2(0xf7f08000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x227000) = 0xf7f08000
mmap2(0xf7f0b000, 38844, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xf7f0b000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib32/libncurses.so.6", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0\0\0\0004\0\0\0"..., 512) = 512
statx(3, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=165176, ...}) = 0
mmap2(NULL, 168336, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xf7cb6000
mmap2(0xf7cbb000, 102400, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5000) = 0xf7cbb000
mmap2(0xf7cd4000, 40960, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e000) = 0xf7cd4000
mmap2(0xf7cde000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x27000) = 0xf7cde000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/i386-linux-gnu/libtinfo.so.6", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0\0\0\0004\0\0\0"..., 512) = 512
statx(3, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=174336, ...}) = 0
mmap2(NULL, 177836, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xf7c8a000
mprotect(0xf7c91000, 139264, PROT_NONE) = 0
mmap2(0xf7c91000, 69632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0xf7c91000
mmap2(0xf7ca2000, 65536, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0xf7ca2000
mmap2(0xf7cb3000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x28000) = 0xf7cb3000
close(3) = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7c88000
set_thread_area({entry_number=-1, base_addr=0xf7c88700, limit=0x0fffff, seg_32bit=1, contents=0, read_exec_only=0, limit_in_pages=1, seg_not_present=0, useable=1}) = 0 (entry_number=12)
set_tid_address(0xf7c88768) = 597827
set_robust_list(0xf7c88770, 12) = 0
rseq(0xf7c88c20, 0x20, 0, 0x53053053) = 0
mprotect(0xf7f08000, 8192, PROT_READ) = 0
mprotect(0xf7cb3000, 8192, PROT_READ) = 0
mprotect(0xf7cde000, 4096, PROT_READ) = 0
mprotect(0x8137000, 4096, PROT_READ) = 0
mprotect(0xf7f74000, 8192, PROT_READ) = 0
ugetrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
munmap(0xf7f15000, 139097) = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
getrandom("\x32\x99\x74\xca", 4, GRND_NONBLOCK) = 4
brk(NULL) = 0x946f000
brk(0x9490000) = 0x9490000
brk(0x9491000) = 0x9491000
openat(AT_FDCWD, "/lib/chrclass/ascii", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
geteuid32() = 1000
getcwd("/home/magpie/Repositories/123elf", 1024) = 33
access("/home/magpie", R_OK|X_OK) = 0
access("/home/magpie/.l123set", F_OK) = -1 ENOENT (No such file or directory)
readlink("/proc/self/exe", "/home/magpie/Repositories/123elf"..., 4096) = 36
openat(AT_FDCWD, "/home/magpie/Repositories/123elf/l123set.cf", O_RDONLY|O_LARGEFILE) = 3
ioctl(3, TCGETS, 0xffe04edc) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "1001 Lotus 1-2-3 Version \"10\"\n10"..., 1024) = 500
access("/home/magpie/Repositories/123elf//root/lotus", R_OK|X_OK) = 0
access("/home/magpie/Repositories/123elf//root/lotus/123.v10", R_OK|X_OK) = 0
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/ri/USA-English", R_OK|X_OK) = 0
read(3, "", 1024) = 0
close(3) = 0
openat(AT_FDCWD, "/home/magpie/Repositories/123elf//root/lotus/123.v10/ri/USA-English/123.ri", O_RDONLY|O_LARGEFILE) = 3
ioctl(3, TCGETS, 0xffe04f30) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "; @(#)123.ri\t113.1 18:43:17 6/14"..., 1024) = 1024
read(3, "ional argument]$Optional argumen"..., 1024) = 467
read(3, "", 1024) = 0
close(3) = 0
rt_sigaction(SIGABRT, {sa_handler=0x8119a04, sa_mask=[ABRT], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGUSR1, {sa_handler=0x8119a04, sa_mask=[USR1], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGUSR2, {sa_handler=0x8119a04, sa_mask=[USR2], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGHUP, {sa_handler=0x8119998, sa_mask=[HUP], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGPIPE, {sa_handler=0x8119998, sa_mask=[PIPE], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGQUIT, {sa_handler=0x8119a04, sa_mask=[QUIT], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=0x8119998, sa_mask=[TERM], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x8119998, sa_mask=[INT], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGILL, {sa_handler=0x8119a04, sa_mask=[ILL], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSEGV, {sa_handler=0x8119a04, sa_mask=[SEGV], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGALRM, {sa_handler=SIG_IGN, sa_mask=[ALRM], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x8119a04, sa_mask=[BUS], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTTOU, {sa_handler=SIG_IGN, sa_mask=[TTOU], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTTIN, {sa_handler=SIG_IGN, sa_mask=[TTIN], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGFPE, {sa_handler=0x8119c64, sa_mask=[FPE], sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
access("/home/magpie/.l123set", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/magpie/Repositories/123elf/l123set.cf", O_RDONLY|O_LARGEFILE) = 3
ioctl(3, TCGETS, 0xffe04ed4) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "1001 Lotus 1-2-3 Version \"10\"\n10"..., 1024) = 500
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/pbd", R_OK|X_OK) = 0
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/pbd/egas25cs.vbd", R_OK) = 0
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/hlp/USA-English", R_OK|X_OK) = 0
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/cbd", R_OK|X_OK) = 0
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/cbd/l_ascii.bun", R_OK) = 0
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/cbd", R_OK|X_OK) = 0
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/cbd/l13cUSF3.cbd", R_OK) = 0
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/cbd", R_OK|X_OK) = 0
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/cbd/l_ascii.bun", R_OK) = 0
read(3, "", 1024) = 0
close(3) = 0
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/keymaps", R_OK|X_OK) = 0
access("/home/magpie/lotus.bcf", R_OK) = -1 ENOENT (No such file or directory)
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/sysV386", R_OK|X_OK) = 0
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/sysV386/lotus.bcf", R_OK) = 0
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/fonts", R_OK|X_OK) = 0
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/keymaps/x", R_OK|X_OK) = 0
access("/home/magpie/Repositories/123elf//root/lotus/123.v10/keymaps/x/xterm", R_OK) = 0
access("/home/magpie/.l123cnf", R_OK) = -1 ENOENT (No such file or directory)
getcwd("/home/magpie/Repositories/123elf", 256) = 33
statx(AT_FDCWD, "/home/magpie", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=4096, ...}) = 0
statx(1, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFCHR|0600, stx_size=0, ...}) = 0
write(1, "123: Cannot initialize system fi"..., 49123: Cannot initialize system file configuration
) = 49
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
exit_group(1) = ?
+++ exited with 1 +++
Wait.. I think I have a theory, hold on for a patch!
I see this line in your strace output:
statx(1, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFCHR|0600, stx_size=0, ...}) = 0
I don't think I translate S_IFCHR properly, but I don't know why it's doing that (edit: probably isatty()). Maybe just not returning an error on that case will fix it!
Pulled and rebuilt, but unfortunately no changes so far.
Hmm, okay.
So I think all of this is just it trying to clean up when it thinks it can't continue, the statx() is probably isatty(), and the ioctls() are trying to put the terminal back into a sane state.
statx(1, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFCHR|0600, stx_size=0, ...}) = 0
write(1, "123: Cannot initialize system fi"..., 49123: Cannot initialize system file configuration
) = 49
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
exit_group(1) = ?
+++ exited with 1 +++
So the error must be just after this:
getcwd("/home/magpie/Repositories/123elf", 256) = 33
It only calls that from a few places, things it does:
root/lotus/123.v10/hlp/USA-English/123_sysV.hlp
Okay, last thing to try:
$ gdb ./123
(gdb) b *(path_exists+69)
Breakpoint 1 at 0x811d2ad
(gdb) r
Breakpoint 1, 0x0811d2ad in path_exists ()
(gdb) p/x $ax
$1 = 0x4000
Do you also get 0x4000 if you try this?
Strange again, doesn't seem to trigger.
Reading symbols from 123...
(gdb) b *(path_exists+69)
Breakpoint 1 at 0x811d231
(gdb) r
Starting program: /home/magpie/Repositories/123elf/123
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
123: Cannot initialize system file configuration
[Inferior 1 (process 698543) exited with code 01]
(gdb) p/x $ax
No registers.
As for the others:
123_sysV.hlp
does exist.Thanks, wow, it doesn't even reach there!
I am so confused!
There are only like two things that can fail before that.
123: Cannot initialize memory manager
, and you don't see that.\
characters ????I really can't see anything else that can fail.
That does cause the error you're seeing though:
Breakpoint 4, 0x0811d0b4 in unix_pathname ()
(gdb) return (int) 3
#0 0x0811d27b in path_exists ()
(gdb) c
Continuing.
123: Cannot initialize system file configuration
But "/home/magpie" is obviously a valid pathname --
Can you try this:
(gdb) b path_exists
Breakpoint 1 at 0x811d26f
(gdb) r
Breakpoint 1, 0x0811d26f in path_exists ()
(gdb) finish
Run till exit from #0 0x0811d26f in path_exists ()
0x08110952 in config_init ()
(gdb) p/x $eax
$1 = 0x0
(gdb) finish
Run till exit from #0 0x08110952 in config_init ()
0x0811214b in main_init ()
(gdb) p/x $eax
$2 = 0x0
I am determined to figure this out now 😆
Yeah, I got nothing either, this is quite strange. What makes things really confusing is it working in a different HOME
.
Tried a full reset of my local repository and extracting/building again, same results as well.
123.tar.gz
This is my last produced binary, just in case you can spot something odd in it.
EDIT:
gdb session:
Reading symbols from 123...
(gdb) b path_exists
Breakpoint 1 at 0x811d1f3
(gdb) r
Starting program: /home/magpie/Repositories/123elf/123
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, 0x0811d1f3 in path_exists ()
(gdb) finish
Run till exit from #0 0x0811d1f3 in path_exists ()
0x081108d6 in config_init ()
(gdb) p/x $eax
$1 = 0x3
(gdb) finish
Run till exit from #0 0x081108d6 in config_init ()
0x081120cf in main_init ()
(gdb) p/x $eax
$2 = 0x235e
(gdb)
Locale outputs. (Changing LC_MEASUREMENT
to en_US.UTF-8
makes no difference)
LC_ADDRESS=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=es_ES.UTF-8
LC_TIME=C
LC_COLLATE=C
LC_NUMERIC=en_US.UTF-8
echo $LANG
en_US.UTF-8
My keyboard is Spanish, but changing $HOME like I did should maintain the rest of the environment and DE settings. And yeah my home should be sane, or more than this would break, I think. No exotic setups there though, other than separating /home from / so it's on different disks, which is a fairly common setup.
Thanks for running all these tests! This part is interesting:
(gdb) p/x $eax
$1 = 0x3
It does think your pathname is invalid... but why? Your locale and everything else looks totally normal.
I'll have to think about this, it doesn't seem to use errno
, but I pushed a change to set it just in case there is some redirection I don't understand. If that doesn't help, I'll have to sleep on it 😂
I'm sad to report it doesn't. I admit I'm also intrigued, I'll try a few things tomorrow, maybe changing some paths can make a difference.
Is it possible the fix for #45 might also fix this? 🤔
It is not allowed to use memcpy() with overlapping ranges, all kinds of random errors can occur, that was also true on UNIX. However.. it mostly seemed to kinda work on UNIX, and 123 does it all the time....which can make weird stuff happen on Linux, I decided to just replace every call to memmove() which is slower, but doesn't care if the ranges overlap.
If not I'm out of ideas without being able to single step through the code!
Pulled, cleaned, rebuilt binutils and rebuilt 123. Still no change.
Tried building and running in different locations like /dev/shm or a first level subdir at $HOME and other partitions. Runtime path seems to be unrelated.
It'd be really odd if it's the $HOME dir or its contents, because it doesn't seem to be trying to access other files or configs and it seems to find all files it needs before failing. The environment should still have contents of .profile or .bashrc if I just launch the program like HOME=/x/y/z 123
.
Maybe Lotus really hated magpies and checks for the word in path...
So weird. What about if you do something like this:
$ env -i TERM=xterm HOME=~ ./123
Hm, unfortunately no change.
I've read through every line of the code, it really seems okay!
I've been trying to do weird things to see how to reproduce it.
This works:
$ touch /tmp/foobar
$ chmod 0700 /tmp/foobar
$ HOME=/tmp/foobar ./123
123: Cannot initialize system file configuration
But obviously you would know if your $HOME was not a directory!
What does stat say, is your directory anything unusual, like a bind mount or something?
$ stat ~
File: /home/taviso
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 810h/2064d Inode: 30082 Links: 12
Access: (0755/drwxr-xr-x) Uid: ( 1000/ taviso) Gid: ( 1000/ taviso)
Access: 2022-05-28 12:00:08.953090700 -0700
Modify: 2022-05-28 12:04:34.363090700 -0700
Change: 2022-05-28 12:04:34.363090700 -0700
Birth: 2022-05-23 15:39:12.296457900 -0700
$ stat --file-system ~
File: "/home/taviso"
ID: fedc9aa3bd65bc57 Namelen: 255 Type: ext2/ext3
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 65793553 Free: 65441883 Available: 62082344
Inodes: Total: 16777216 Free: 16741315
Maybe also the extended attributes, could this be a MAC issue, like selinux or something?
$ lsattr -d ~
--------------e------- /home/taviso
$ getfattr -d ~
$ ls -lZd ~
drwxr-xr-x 1 taviso taviso ? 512 May 28 09:52 /home/taviso/
Alright, here goes:
$ stat ~
File: /home/magpie
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 821h/2081d Inode: 16646145 Links: 84
Access: (0755/drwxr-xr-x) Uid: ( 1000/ magpie) Gid: ( 1000/ magpie)
Access: 2040-02-06 12:28:16.000000000 +0100
Modify: 2022-05-28 20:53:18.233080212 +0200
Change: 2022-05-28 20:53:18.233080212 +0200
Birth: 2017-08-24 07:48:25.392428140 +0200
$ stat --file-system ~
File: "/home/magpie"
ID: 1d3da6b9465abd65 Namelen: 255 Type: ext2/ext3
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 167457162 Free: 3589837 Available: 1881805
Inodes: Total: 42598400 Free: 40807804
$lsattr -d ~
--------------e------- /home/magpie
$getfattr -d ~
<no output>
$ls -lZd ~
drwxr-xr-x 84 magpie magpie ? 4096 May 28 20:53 /home/magpie
EDIT: huh that access time is in the future for some reason. I have noatime and nodiratime in my mount options, could that be?
Seems normal, although I guess it's weird that your atime is 20 years in the future... hmm, that is after 2038, the famous 2038 problem.
This is an interesting clue.
I actually just noticed that! Edited the post but you were faster :ninja: Yeah I have disabled access time in my mount options, maybe that's why it's off. Although it's the first time I find something that seems to care, how interesting. Maybe it's using some old-fashioned method and it's indeed running into that problem. Very interesting.
WOW
$ mkdir ~/tmp/bar
$ touch --date=2040-02-06 ~/tmp/bar/
$ HOME=~/tmp/bar ./123
123: Cannot initialize system file configuration
This is the craziest bug I've seen for months lol.
Okay, now that I can reproduce I can track it down... hold on for a patch :)
touch
ed my $HOME (without parameters for current date) and indeed, that makes it run normally!
(of course I reset it so we can reproduce, but it's indeed the access date, that's amazing)
This is definitely the bug, if you use -D_FILE_OFFSET_BITS=64
(which I do) you get stat64, which is supposed to handle these issues. I can see the kernel reports the correct result, but glibc just returns EOVERFLOW.
Perhaps glibc also required __TIMESIZE == 64, but I tried that and no difference.
This is why your strace output looked fine, the kernel is working but glibc is returning the wrong result! Absolutely crazy combination of events.
I think you just haven't been seeing problems because it only affects 32bit processes. I think I need to check with a glibc internals expert to see if this is supposed to work.
This turned out to be really interesting after all! Thank you for your efforts and guesswork, this thread ended up with a plot twist! It was (the modern equivalent of) the Y2K bug all along! Technically my issue is solved, but I'll leave closing the issue to your discretion, if that's alright. In case there's more interesting information related to it. Again, thanks for your time!
Since I'm here, allow me to say this whole project is fascinating. Being able to work with such old, binary-only software and getting it to work (pretty well, all things considered!) is nothing but inspiring.
Perhaps glibc also required __TIMESIZE == 64, but I tried that and no difference.
Does -D_TIME_BITS=64
help?
Can confirm that adding it to CPPFLAGS solves it.
That was quite an adventure, wow!
Thanks @magpie514 for being willing to help track it down, and thanks @tavianator for figuring out the cpp incantation to solve it! Very relieved we figured out the mystery and things make sense again 😂
Glad to have been here. Thanks again for your time and ideas, this was indeed a good one!
Fascinating.
System: Ubuntu 22.04 64b 123elf version: 199b81f400410d23b633ce00edd803bb4a327fd2 Terminal: Konsole (same issue with xterm)
I made a successful binary using the provided scripts and makefile, but executing it just returns a "123: Cannot initialize system file configuration" error. Trying to run it with gdb doesn't return any form of crash or error message, it terminates normally.
Maybe I skipped some configuration step, but the binary seems fine.