nelhage / reptyr

Reparent a running program to a new terminal
MIT License
5.78k stars 216 forks source link

Test suite failure on ix86 #52

Closed scop closed 9 years ago

scop commented 9 years ago

Test suite fails on ix86 on Fedora 20 and development, succeeds on x86_64 and armv7hl:

https://kojipkgs.fedoraproject.org//work/tasks/615/8690615/build.log

python test/tty-steal.py
Traceback (most recent call last):
  File "test/tty-steal.py", line 16, in <module>
    reptyr.expect("ECHO: world")
  File "/usr/lib/python2.7/site-packages/pexpect/__init__.py", line 1418, in expect
    timeout, searchwindowsize)
  File "/usr/lib/python2.7/site-packages/pexpect/__init__.py", line 1433, in expect_list
    timeout, searchwindowsize)
  File "/usr/lib/python2.7/site-packages/pexpect/__init__.py", line 1521, in expect_loop
    raise EOF(str(err) + '\n' + str(self))
pexpect.EOF: End Of File (EOF). Exception style platform.
<pexpect.spawn object at 0xf725cb0c>
version: 3.1
command: ./reptyr
args: ['./reptyr', '-T', '8302']
searcher: <pexpect.searcher_re object at 0xf725cb4c>
buffer (last 100 chars): ''
before (last 100 chars): 'Unable to attach to pid 8302: Bad address\r\nworld\r\n'
after: <class 'pexpect.EOF'>
match: None
match_index: None
exitstatus: 1
flag_eof: True
pid: 8303
child_fd: 4
closed: False
timeout: 30
delimiter: <class 'pexpect.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
scop commented 9 years ago

Forgot to note that this is with both reptyr 0.6.1 and the current git.

nelhage commented 9 years ago

Hmm. Is the builder running an ix86 chroot inside an x86_64 host? If so, this may be related to that configuration.

I'll try to spin up a Fedora box and see if I can debug.

scop commented 9 years ago

Yes, I believe the setup is like that.

nelhage commented 9 years ago

an update – I spun up a Fedora 20 i386 box today and have been able to reproduce the failure. Haven't dug in further yet, but will update this issue as I do.

nelhage commented 9 years ago

Turns out I completely misunderstood socketcall, and this never worked on ia32 (I never actually ran the test suite on 32-bit, myself). Thanks for reporting this! Can you verify that current master fixes the issue for you? If so, I'll release an 0.6.2.

scop commented 9 years ago

With current master the test suite now passes in my local i386 chroot as well as in the Fedora build system. But now build fails for armv7hl:

https://kojipkgs.fedoraproject.org//work/tasks/5778/8785778/build.log

cc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches  -march=armv7-a -mfpu=vfpv3-d16  -mfloat-abi=hard -Wall -Werror -D_GNU_SOURCE -g   -c -o attach.o attach.c
In file included from platform/platform.h:26:0,
                 from attach.c:46:
attach.c: In function 'setup_steal_socket_child':
attach.c:398:48: error: 'PAGE_SIZE' undeclared (first use in this function)
                         steal->child_scratch + PAGE_SIZE/2,
                                                ^
platform/linux/linux.h:73:49: note: in definition of macro 'do_socketcall'
             __ret = ptrace_socketcall((child), (scratch),               \
                                                 ^
attach.c:398:48: note: each undeclared identifier is reported only once for each function it appears in
                         steal->child_scratch + PAGE_SIZE/2,
                                                ^
platform/linux/linux.h:73:49: note: in definition of macro 'do_socketcall'
             __ret = ptrace_socketcall((child), (scratch),               \
                                                 ^
attach.c: In function 'steal_child_pty':
attach.c:447:48: error: 'PAGE_SIZE' undeclared (first use in this function)
                         steal->child_scratch + PAGE_SIZE/2,
                                                ^
platform/linux/linux.h:73:49: note: in definition of macro 'do_socketcall'
             __ret = ptrace_socketcall((child), (scratch),               \
                                                 ^
<builtin>: recipe for target 'attach.o' failed
make: *** [attach.o] Error 1

Should those PAGE_SIZEs be changed to sysconf(_SC_PAGE_SIZE)? If not, I guess (untested) adding #include <asm/page.h> to attach.c would fix it.

nelhage commented 9 years ago

Whoops, thanks for the report. Replaced with sysconf calls, and tested on both i386 and ARM.

scop commented 9 years ago

Build and test suite success now in Fedora devel i386, x86_64, and armv7hl.

nelhage commented 9 years ago

Awesome, thanks for verifying. Pushed 0.6.2 with both fixes.