Re: BUG: /proc/self/exe reports relative paths, should always return absolute paths?
Svante Signell, on mer. 20 sept. 2017 08:46:49 +0200, wrote: > I changed the patch for __execve() to keep file_name if the path is absolute > and > call realpath() for relative paths. But then if you call a script that looks at $0 from a relative path, it'll break. > (I did also a cetcwd() version, but that does not seem to be needed, and using > realpath() is simpler.) It's simpler but doesn't work in the case above. Samuel
Re: X Terminal issues
Samuel Thibault, on jeu. 21 sept. 2017 00:24:28 +0200, wrote: > Riccardo Mottola, on mer. 20 sept. 2017 23:53:17 +0200, wrote: > > xterm: Error 27, errno 1073741849: Inappropriate ioctl for device > > Reason: spawn: ioctl() failed on TIOCLSET > > There are probably a lot more things like that which we shouldn't > expose. (At least those which are not defined on Linux) Samuel
Re: X Terminal issues
Hello, Riccardo Mottola, on mer. 20 sept. 2017 23:53:17 +0200, wrote: > xterm: Error 27, errno 1073741849: Inappropriate ioctl for device > Reason: spawn: ioctl() failed on TIOCLSET Mmm, this is indeed not implemented. We should probably not expose it in bits/ioctls.h. There are probably a lot more things like that which we shouldn't expose. Samuel
X Terminal issues
Hi HURDers, Both if I start xterm as uxterm, I get these errors: $ uxterm xterm: Error 27, errno 1073741849: Inappropriate ioctl for device Reason: spawn: ioctl() failed on TIOCLSET $ xterm xterm: Error 27, errno 1073741849: Inappropriate ioctl for device Reason: spawn: ioctl() failed on TIOCLSET uxterm used to work, but I belive xterm was fixed too. Anyone else has issues? My packages are upgraded as of today. Thanks, Riccardo
Re: [PATCH] eth-multiplxer: Implement ds_device_close()
Ooops!! I forgot that! :) 2017-09-20 20:06 GMT+02:00 James Clarke: > On 20 Sep 2017, at 11:08, Joan Lledó wrote: >> >> --- >> eth-multiplexer/Makefile | 2 +- >> eth-multiplexer/device_impl.c | 5 + >> 2 files changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/eth-multiplexer/Makefile b/eth-multiplexer/Makefile >> index cefa0abd..2b19de6d 100644 >> --- a/eth-multiplexer/Makefile >> +++ b/eth-multiplexer/Makefile >> @@ -29,6 +29,6 @@ LCLHDRS = ethernet.h util.h vdev.h netfs_impl.h >> HURDLIBS = ports ihash iohelp fshelp shouldbeinlibc netfs bpf >> LDLIBS = -lpthread >> >> -CFLAGS += -I$(top_srcdir)/libbpf >> +CFLAGS += -I$(top_srcdir)/libbpf -ggdb -O0 > > I don't think you meant to include this hunk? :) > > James >
Re: [PATCH] eth-multiplxer: Implement ds_device_close()
On 20 Sep 2017, at 11:08, Joan Lledówrote: > > --- > eth-multiplexer/Makefile | 2 +- > eth-multiplexer/device_impl.c | 5 + > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/eth-multiplexer/Makefile b/eth-multiplexer/Makefile > index cefa0abd..2b19de6d 100644 > --- a/eth-multiplexer/Makefile > +++ b/eth-multiplexer/Makefile > @@ -29,6 +29,6 @@ LCLHDRS = ethernet.h util.h vdev.h netfs_impl.h > HURDLIBS = ports ihash iohelp fshelp shouldbeinlibc netfs bpf > LDLIBS = -lpthread > > -CFLAGS += -I$(top_srcdir)/libbpf > +CFLAGS += -I$(top_srcdir)/libbpf -ggdb -O0 I don't think you meant to include this hunk? :) James
[PATCH] eth-multiplxer: Implement ds_device_close()
--- eth-multiplexer/Makefile | 2 +- eth-multiplexer/device_impl.c | 5 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/eth-multiplexer/Makefile b/eth-multiplexer/Makefile index cefa0abd..2b19de6d 100644 --- a/eth-multiplexer/Makefile +++ b/eth-multiplexer/Makefile @@ -29,6 +29,6 @@ LCLHDRS = ethernet.h util.h vdev.h netfs_impl.h HURDLIBS = ports ihash iohelp fshelp shouldbeinlibc netfs bpf LDLIBS = -lpthread -CFLAGS += -I$(top_srcdir)/libbpf +CFLAGS += -I$(top_srcdir)/libbpf -ggdb -O0 include ../Makeconf diff --git a/eth-multiplexer/device_impl.c b/eth-multiplexer/device_impl.c index d7c8beeb..b84a3309 100644 --- a/eth-multiplexer/device_impl.c +++ b/eth-multiplexer/device_impl.c @@ -96,6 +96,11 @@ ds_device_open (mach_port_t master_port, mach_port_t reply_port, kern_return_t ds_device_close (struct vether_device *device) { + if (device == NULL) +return D_NO_SUCH_DEVICE; + + destroy_vdev(device); + return 0; } -- 2.11.0
[PATCH] eth-multiplxer: Implement ds_device_close()
Hello, One difference between pfinet and lwip translators is that pfinet doesn't delete interfaces (or I haven't found how to do it) while lwip does. For instance, if one starts pfinet with: settrans -fga /servers/socket/2 /hurd/pfinet -i /dev/eth1 -a 192.168.123.178 -m 255.255.255.0 -g 192.168.123.1 and then runs: fsysopts /servers/socket/2 --interface=/dev/eth2 --address=192.168.124.178 --netmask=255.255.255.0 --gateway=192.168.124.1 the result is this: root@hurd:/home/jlledom# fsysopts /servers/socket/2 /hurd/pfinet --interface=/dev/eth1 --address=192.168.123.178 --netmask=255.255.255.0 --address6=fc00:123::5054:ff:feb6:1ab3/64 --address6=fe80::5254:b6:1ab3/10 --address6=fe80::5054:ff:feb6:1ab3/10 --gateway6=fe80::5054:ff:fef6:d496 --interface=/dev/eth2 --address=192.168.124.178 --netmask=255.255.255.0 --gateway=192.168.124.1 --address6=fe80::5254:4b:ad11/10 --address6=fe80::5054:ff:fe4b:ad11/10 fsysopts added a new interface. But doing the same with lwip leads to this: root@hurd:/home/jlledom# fsysopts /servers/socket/2 /hurd/lwip --interface=/dev/eth2 --address=192.168.124.178 --netmask=255.255.255.0 --gateway=192.168.124.1 --address6=FE80::5054:FF:FE4B:AD11/64 --address6=FC00:124::5054:FF:FE4B:AD11/64 The stack is reset and reconfigured, and only the given interface is added. I implemented this by simply removing all interfaces anytime somebody calls fsysopts, and adding the new ones. If some interface already exists, it's deleted and created again. This behaviour generated a problem when working with eth-multiplexer. Adding a new interface calls ds_device_open in eth-multiplexer and that returns a port name, whereas deleting the interface deallocates the port name in lwip, but nothing happens in eth-multiplexer since ds_device_close is unimplemented, when lwip tries to create the same interface again, eth-multiplexer returns the same port name, and trying to use it leads to a MIG_SERVER_DIED error. This use to happen when ifupdown uses dhclient to get an address and is not a problem in pfinet since it doesn't remove the interface. I wrote a little patch to implement ds_device_close(). This patch is working for me, but I'm not sure whether it's the right way to do it or may affect other servers. I'd appreciate some feedback. Regards, Joan
Re: BUG: /proc/self/exe reports relative paths, should always return absolute paths?
On Mon, 2017-09-18 at 20:56 +0200, Samuel Thibault wrote: > Svante Signell, on lun. 18 sept. 2017 19:45:39 +0200, wrote: > > lrwxr-xr-x 1 root root 26 Aug 17 07:38 /usr/sbin/update-fmtutil -> update- > > tl- > > stacked-conffile > > > > In this case the link name should not be resolved. Any ideas? > > Well, it should, but just not the symlink parts, only the cwd part. > > Perhaps we could simply to check whether the file_name begins with a > '/', in case we can keep as it is, or not, in which case we can just > prepend the getcwd(). I changed the patch for __execve() to keep file_name if the path is absolute and call realpath() for relative paths. Seems to work fine now, new patch attached. (I did also a cetcwd() version, but that does not seem to be needed, and using realpath() is simpler.)2.13-33 dates when this was added TODO: _DEBIAN_ in versions however pose problem. Remove the _DEBIAN_ version once packages are rebuilt against 2.21. 2010-08-04 Emilio Pozuelo Monfort* hurd/hurdexec.c (_hurd_exec): Deprecate it. (_hurd_exec_file_name): New function. * hurd/hurd.h (_hurd_exec): Deprecate it. (_hurd_exec_file_name): Declare it. * hurd/Versions: Export it. * sysdeps/mach/hurd/execve.c: Use it. * sysdeps/mach/hurd/fexecve.c: Likewise. * sysdeps/mach/hurd/spawni.c: Likewise. From d1793416cf8bf6fccd42679a8ec30b0058823ab8 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Sat, 22 May 2010 18:26:29 +0200 Subject: [PATCH] Use the new file_exec_file_name RPC Pass the file name of executable to the exec server, which it needs to execute #!-scripts. Currently, the exec server tries to guess the name from argv[0] but argv[0] only contains the executable name by convention. --- hurd/Makefile |4 +- hurd/Versions |4 ++ hurd/hurd.h | 14 -- hurd/hurdexec.c | 50 ++--- sysdeps/mach/hurd/execve.c |6 ++-- sysdeps/mach/hurd/fexecve.c |7 ++--- sysdeps/mach/hurd/spawni.c | 59 ++-- 8 files changed, 102 insertions(+), 43 deletions(-) Index: glibc-2.24-17.2/hurd/Versions === --- glibc-2.24-17.2.orig/hurd/Versions +++ glibc-2.24-17.2/hurd/Versions @@ -140,6 +140,14 @@ libc { _hurd_sigstate_unlock; _hurd_sigstate_delete; } + GLIBC_2.13_DEBIAN_33 { +# "quasi-internal" functions +_hurd_exec_file_name; + } + GLIBC_2.21 { +# "quasi-internal" functions +_hurd_exec_file_name; + } HURD_CTHREADS_0.3 { # weak refs to libthreads functions that libc calls iff libthreads in use Index: glibc-2.24-17.2/hurd/Makefile === --- glibc-2.24-17.2.orig/hurd/Makefile +++ glibc-2.24-17.2/hurd/Makefile @@ -32,8 +32,8 @@ user-interfaces := $(addprefix hurd/,\ auth auth_request auth_reply startup \ process process_request \ msg msg_reply msg_request \ - exec exec_startup crash interrupt \ - fs fsys io term tioctl socket ifsock \ + exec exec_experimental exec_startup crash interrupt \ + fs fs_experimental fsys io term tioctl socket ifsock \ login password pfinet \ ) server-interfaces := hurd/msg faultexc Index: glibc-2.24-17.2/hurd/hurd.h === --- glibc-2.24-17.2.orig/hurd/hurd.h +++ glibc-2.24-17.2/hurd/hurd.h @@ -241,12 +241,20 @@ extern FILE *fopenport (io_t port, const extern FILE *__fopenport (io_t port, const char *mode); -/* Execute a file, replacing TASK's current program image. */ +/* Deprecated: use _hurd_exec_file_name instead. */ extern error_t _hurd_exec (task_t task, file_t file, char *const argv[], - char *const envp[]); + char *const envp[]) __attribute_deprecated__; + +/* Execute a file, replacing TASK's current program image. */ + +extern error_t _hurd_exec_file_name (task_t task, + file_t file, + const char *filename, + char *const argv[], + char *const envp[]); /* Inform the proc server we have exited with STATUS, and kill the Index: glibc-2.24-17.2/hurd/hurdexec.c === --- glibc-2.24-17.2.orig/hurd/hurdexec.c +++ glibc-2.24-17.2/hurd/hurdexec.c @@ -25,16 +25,37 @@ #include #include #include +#include #include #include +#include + /* Overlay TASK, executing FILE with arguments ARGV and environment ENVP. If TASK == mach_task_self (), some ports are dealloc'd by the exec server. - ARGV and ENVP are terminated by NULL pointers. */ + ARGV and ENVP are terminated by NULL pointers. + Deprecated: use _hurd_exec_file_name instead. */ error_t _hurd_exec (task_t task, file_t file, char *const argv[], char *const