`sleep` fails if called with an end-of-options delimiter `--`

Lucas Larson lucas.larson at gmail.com
Sun Jun 25 14:19:03 UTC 2023


package: busybox
version: 1.36.1

Bug description:
When using the `sleep` command with the end-of-options delimiter `--` (that
is, `sleep -- 1` or `busybox sleep -- 1`), the command fails to execute
properly. However, both `sleep 1` and `busybox sleep 1` commands work as
expected. According to the POSIX standard, both constructions should be
permitted.

Minimal steps to reproduce:
$ docker pull alpine
$ docker run -it alpine
$ busybox --help | head -1
  BusyBox v1.36.1 (2023-06-02 00:42:02 UTC) multi-call binary.
$ cat /etc/os-release
  NAME="Alpine Linux"
  ID=alpine
  VERSION_ID=3.18.2
  PRETTY_NAME="Alpine Linux v3.18"
  HOME_URL="https://alpinelinux.org/"
  BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"

$ *sleep 1* # sleeps for a second
$ *sleep -- 1*
  sh: invalid number '--' # and container exits
$ busybox sleep 1 # sleeps for a second
$ *busybox sleep -- 1*
  *sleep: invalid number '--'* # container does not exit

$ apk add coreutils # install coreutils on Alpine Linux
$ *coreutils --coreutils-prog=sleep 1* # sleeps for a second
$ *coreutils --coreutils-prog=sleep -- 1* # also sleeps for a second

Thank you,

Lucas Larson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20230625/ca97df42/attachment.html>


More information about the busybox mailing list