[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Test case for fakeroot-hurd failure with a socket
From: |
Svante Signell |
Subject: |
Test case for fakeroot-hurd failure with a socket |
Date: |
Mon, 04 May 2015 14:14:16 +0200 |
Hi,
Attached is the test code where fakeroot-hurd fails.
fakeroot-hurd ./test_sockets
bind: Operation not supported
Using fakeroot-tcp or no fakeroot succeeds:
./test_sockets
Receiving via datagram socket
plain (similar with fakeroot-tcp)
=====
rpctrace ./test_sockets
...
67<--141(pid9219)->dir_unlink ("test_sockets_socket") = 0x40000002 (No
such file or directory)
task131(pid9219)->mach_port_deallocate (pn{ 5}) = 0
task131(pid9219)->vm_allocate (17189648 4096 1) = 0 16957440
109<--142(pid9219)->dir_lookup ("servers/socket/1" 0 0) = 0 1 ""
158<--157(pid9219)
158<--157(pid9219)->socket_create (2 0) = 0 160<--159(pid9219)
task131(pid9219)->mach_port_mod_refs (pn{ 5} 0 1) = 0
67<--141(pid9219)->dir_mkfile (16 438) = 0 162<--161(pid9219)
162<--161(pid9219)->file_set_translator (6 6 0 "/hurd/ifsock" (null))
= 0
162<--161(pid9219)->dir_lookup ("" 0 0) = 0 1 "" 164<--163(pid9219)
164<--163(pid9219)->ifsock_getsockaddr () = 0 166<--165(pid9219)
162<--161(pid9219)->file_chmod (420) = 0
67<--141(pid9219)->dir_link ( 162<--161(pid9219)
"test_sockets_socket" 1) = 0
task131(pid9219)->mach_port_deallocate (pn{ 21}) = 0
task131(pid9219)->mach_port_deallocate (pn{ 20}) = 0
task131(pid9219)->mach_port_deallocate (pn{ 5}) = 0
160<--159(pid9219)->socket_bind ( 166<--165(pid9219)) = 0
task131(pid9219)->mach_port_deallocate (pn{ 22}) = 0
67<--141(pid9219)->dir_lookup ("test_sockets_socket" 0 0) = 0 1 ""
166<--167(pid9219)
166<--167(pid9219)->file_chmod (292) = 0
task131(pid9219)->mach_port_deallocate (pn{ 22}) = 0
156<--155(pid9219)->io_write ("Receiving via datagram socket\n"
-1)Receiving via datagram socket
= 0 30
140<--144(pid9219)->proc_mark_exit_request (0 0) = 0
task131(pid9219)->task_terminate () = 0
Child 9219 exited with 0
fakeroot-hurd
=============
fakeroot-hurd rpctrace ./test_sockets
10<--46(pid9244)->dir_unlink ("test_sockets_socket") = 0x40000002 (No
such file or directory)
task34(pid9244)->mach_port_deallocate (pn{ 7}) = 0
task34(pid9244)->vm_allocate (17189648 4096 1) = 0 16957440
9<--47(pid9244)->dir_lookup ("servers/socket/1" 0 0) = 0 1 ""
63<--62(pid9244)
63<--62(pid9244)->socket_create (2 0) = 0 65<--64(pid9244)
task34(pid9244)->mach_port_mod_refs (pn{ 7} 0 1) = 0
10<--46(pid9244)->dir_mkfile (16 438) = 0 67<--66(pid9244)
67<--66(pid9244)->file_set_translator (6 6 0 "/hurd/ifsock" (null)) =
0x4000002d (Operation not supported)
task34(pid9244)->mach_port_deallocate (pn{ 22}) = 0
task34(pid9244)->mach_port_deallocate (pn{ 7}) = 0
task34(pid9244)->mach_port_deallocate (pn{ 21}) = 0
task34(pid9244)->mach_port_mod_refs (pn{ 6} 0 1) = 0
task34(pid9244)->mach_port_mod_refs (pn{ 19} 0 1) = 0
11<--45(pid9244)->io_get_openmodes () = 0 259
11<--45(pid9244)->io_stat () = 0 {14 999 0 0 0 1368812073 0 8397200 1
1000 5 0 0 1430739968 0 1430739968 0 1430739968 0 512 8 0 0 0 0 0 0 0 0
0 0 0}
11<--45(pid9244)->io_seek (0 1) = 0x4000001d (Illegal seek)
61<--60(pid9244)->io_write ("bind: Operation not supported\n" -1)bind:
Operation not supported
= 0 30
task34(pid9244)->mach_port_deallocate (pn{ 19}) = 0
task34(pid9244)->mach_port_deallocate (pn{ 6}) = 0
43<--49(pid9244)->proc_mark_exit_request (256 0) = 0
task34(pid9244)->task_terminate () = 0
Child 9244 exited with 1
./my_fakeroot-hurd rpctrace ./test_sockets
With original code in trans/fakeroot.c:
netfs_attempt_chmod (struct iouser *cred, struct node *np, mode_t mode)
{
if ((mode & S_IFMT) == 0)
mode |= np->nn_stat.st_mode & S_IFMT;
if ((mode & S_IFMT) != (np->nn_stat.st_mode & S_IFMT))
return EOPNOTSUPP;
<<<- Errors out here ->>>
/* We don't bother with error checking since the fake mode change
should
always succeed--worst case a later open will get EACCES. */
(void) file_chmod (netfs_node_netnode (np)->file, mode);
set_faked_attribute (np, FAKE_MODE);
np->nn_stat.st_mode = mode;
return 0;
}
With modifications to handle the socket case:
(and printouts in netfs_S_dir_lookup())
...
if ((mode & S_IFMT) == 0)
{
mode |= np->nn_stat.st_mode & S_IFMT;
/* We don't bother with error checking since the fake mode change
should
always succeed--worst case a later open will get EACCES. */
(void) file_chmod (netfs_node_netnode (np)->file, mode);
set_faked_attribute (np, FAKE_MODE);
np->nn_stat.st_mode = mode;
}
if ((mode & S_IFMT) != 0)
{
fprintf(stderr,"trans/fakeroot.c: netfs_attempt_chmod: mode=%0o
\n", mode)\
;
fprintf(stderr,"trans/fakeroot.c: netfs_attempt_chmod:
(mode&S_IFMT)=%0o,\
S_IFSOCK=%0o\n", (mode & S_IFMT), S_IFSOCK);
fprintf(stderr,"trans/fakeroot.c: netfs_attempt_chmod:
np->nn_stat.st_mod\
e=%0o, (np->nn_stat.st_mode & S_IFMT)=%0o\n", np->nn_stat.st_mode,
(np->nn_stat\
.st_mode & S_IFMT));
fflush(stderr);
if ((mode & S_IFMT) != (np->nn_stat.st_mode & S_IFMT))
{
switch (mode & S_IFMT)
{
...
case S_IFSOCK:
fprintf(stderr, "case S_IFSOCK\n");
fflush(stderr);
np->nn_stat.st_mode = mode;
break;
...
fakeroot-hurd rpctrace ./test_sockets
...
10<--46(pid9260)->dir_unlink ("test_sockets_socket") = 0x40000002 (No
such file or directory)
task34(pid9260)->mach_port_deallocate (pn{ 7}) = 0
task34(pid9260)->vm_allocate (17189648 4096 1) = 0 16957440
9<--47(pid9260)->dir_lookup ("servers/socket/1" 0 0)
trans_fakeroot.c:netfs_S_dir_lookup: calling dir_lookup: dir=26,
filename='servers/socket/1', mode=0
trans_fakeroot.c:netfs_S_dir_lookup: BEFORE switch *do_retry:
*do_retry=1, retry_name='', file=60, err=0
= 0 1 "" 63<--62(pid9260)
63<--62(pid9260)->socket_create (2 0) = 0 65<--64(pid9260)
task34(pid9260)->mach_port_mod_refs (pn{ 7} 0 1) = 0
10<--46(pid9260)->dir_mkfile (16
438)trans/fakeroot.c:netfs_attempt_mkfile: BEFORE dir_mkfile:
real_mode=666, mode=666
trans/fakeroot.c:netfs_attempt_mkfile: AFTER dir_mkfile: new_file=54
= 0 67<--66(pid9260)
67<--66(pid9260)->file_set_translator (6 6 0 "/hurd/ifsock"
(null))trans/fakeroot.c: netfs_attempt_chmod: mode=140666
trans/fakeroot.c: netfs_attempt_chmod: (mode&S_IFMT)=140000,
S_IFSOCK=140000
trans/fakeroot.c: netfs_attempt_chmod: np->nn_stat.st_mode=100666,
(np->nn_stat.st_mode & S_IFMT)=100000
case S_IFSOCK
= 0
67<--66(pid9260)->dir_lookup ("" 0 0)
trans_fakeroot.c:netfs_S_dir_lookup: calling dir_lookup: dir=54,
filename='', mode=0
trans_fakeroot.c:netfs_S_dir_lookup: BEFORE switch *do_retry:
*do_retry=1, retry_name='', file=59, err=0
= 0 1 "" 69<--68(pid9260)
69<--68(pid9260)->ifsock_getsockaddr () = 0x4000002d (Operation not
supported)
task34(pid9260)->mach_port_deallocate (pn{ 23}) = 0
task34(pid9260)->mach_port_deallocate (pn{ 22}) = 0
task34(pid9260)->mach_port_deallocate (pn{ 7}) = 0
task34(pid9260)->mach_port_deallocate (pn{ 21}) = 0
task34(pid9260)->mach_port_mod_refs (pn{ 6} 0 1) = 0
task34(pid9260)->mach_port_mod_refs (pn{ 19} 0 1) = 0
11<--45(pid9260)->io_get_openmodes () = 0 259
11<--45(pid9260)->io_stat () = 0 {14 999 0 0 0 1368812073 0 8397200 1
1000 5 0 0 1430740200 0 1430740200 0 1430740200 0 512 8 0 0 0 0 0 0 0 0
0 0 0}
11<--45(pid9260)->io_seek (0 1) = 0x4000001d (Illegal seek)
61<--60(pid9260)->io_write ("bind: Gratuitous error\n" -1)bind:
Gratuitous error
= 0 23
task34(pid9260)->mach_port_deallocate (pn{ 19}) = 0
task34(pid9260)->mach_port_deallocate (pn{ 6}) = 0
43<--49(pid9260)->proc_mark_exit_request (256 0) = 0
task34(pid9260)->task_terminate () = 0
Child 9260 exited with 1
test_sockets.c
Description: Text Data
- Test case for fakeroot-hurd failure with a socket,
Svante Signell <=
- Re: Test case for fakeroot-hurd failure with a socket, Samuel Thibault, 2015/05/06
- Re: Test case for fakeroot-hurd failure with a socket, Svante Signell, 2015/05/07
- Re: Test case for fakeroot-hurd failure with a socket, Samuel Thibault, 2015/05/07
- RFC: [PATCH] Re: Test case for fakeroot-hurd failure with a socket, Svante Signell, 2015/05/12
- Re: RFC: [PATCH] Re: Test case for fakeroot-hurd failure with a socket, Samuel Thibault, 2015/05/12
- Re: RFC: [PATCH] Re: Test case for fakeroot-hurd failure with a socket, Svante Signell, 2015/05/13
- Re: RFC: [PATCH] Re: Test case for fakeroot-hurd failure with a socket, Samuel Thibault, 2015/05/13
- Re: RFC: [PATCH] Re: Test case for fakeroot-hurd failure with a socket, Samuel Thibault, 2015/05/13
- Re: RFC: [PATCH] Re: Test case for fakeroot-hurd failure with a socket, Svante Signell, 2015/05/13
- Re: RFC: [PATCH] Re: Test case for fakeroot-hurd failure with a socket, Samuel Thibault, 2015/05/13