busybox/util-linux
Euan Harris 254e47372f nsenter: fix parsing of -t, -S and -G options
-t, -S and -G each take mandatory integer arguments.   getopt32long()'s
option string syntax for this type of argument is 'c:+', however nsenter's
opt_str uses 'c+', which specifies two options 'c' and '+' which do not
take arguments.   This means that giving a target PID causes nsenter to
exit and print the usage string:

  # nsenter -t1 sh
  nsenter: unrecognized option: 1
  BusyBox v1.27.2 (2017-12-12 10:41:50 GMT) multi-call binary.
  ...

The long form options are also broken:

  # nsenter --setuid=1000 --setgid=1000 sh
  BusyBox v1.29.0.git (2018-05-04 13:56:49 UTC) multi-call binary.
  ...

`nsenter --target=<pid> sh` parses correctly and appears to work, but
<pid> is ignored and set to 0.   This doesn't raise an error unless one
of the namespace arguments is also given:

  # ./busybox_unstripped nsenter --target=42 sh
  # exit

  # ./busybox_unstripped nsenter -n --target=42 sh
  BusyBox v1.29.0.git (2018-05-04 13:56:49 UTC) multi-call binary.
  ...

This has caused problems in a couple of places:

  https://github.com/linuxkit/linuxkit/issues/567
  https://github.com/gliderlabs/docker-alpine/issues/359
  https://github.com/kontena/pharos-cluster/pull/81

Signed-off-by: Euan Harris <euan.harris@docker.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-05-13 20:14:07 +02:00
..
2017-08-08 21:55:02 +02:00
2017-10-30 14:55:01 +01:00
2018-01-14 14:32:11 +01:00
2018-01-25 09:34:23 +01:00
2017-07-21 09:50:55 +02:00
2017-07-21 09:50:55 +02:00
2017-08-08 21:55:02 +02:00
2017-08-07 22:21:54 +02:00
2017-07-21 09:50:55 +02:00
2016-06-19 18:15:33 +02:00
2013-02-11 00:22:59 +01:00
2017-08-08 21:55:02 +02:00
2017-08-07 23:17:14 +02:00
2017-07-21 09:50:55 +02:00
2017-08-08 21:55:02 +02:00
2017-08-09 19:24:19 +02:00
2018-03-08 13:23:06 +01:00
2017-07-21 09:50:55 +02:00
2017-08-08 21:55:02 +02:00
2017-08-05 23:28:19 +02:00
2017-08-05 23:28:19 +02:00
2016-03-14 19:34:15 +01:00
2017-07-21 09:50:55 +02:00
2017-08-05 01:51:12 +02:00
2018-03-11 19:35:58 +01:00
2017-07-21 09:50:55 +02:00
2017-08-08 21:55:02 +02:00
2017-08-08 21:55:02 +02:00
2017-08-08 21:55:02 +02:00
2017-08-16 11:45:09 +02:00