Skip to content

Commit

Permalink
Merge pull request #919 from sg2342/extended_start_script_tests_pathn…
Browse files Browse the repository at this point in the history
…ame_escape

add shelltest for pathname quoting in extended_start_script
  • Loading branch information
ferd authored Jun 13, 2022
2 parents c94a1d0 + 6fe8201 commit 4baa294
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[].
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-sname node@localhost
-setcookie cookie1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
$ rebar3 as pathname_escape tar -n pathname_escape
> / Tarball successfully created: /
>= 0

# make a file _build/p that contains all bytes 0x01..0x0f except
# 0x00 (NUL) and 0x2f (/) : because those must not be part of a POSIX filename
#
# also exclude 0x22 ("), 0x60 (`) and anything > 0x0f : the extendend_bin
# script can handle it but various parts of the erlang runtime (that exec /bin/sh
# with unsanatized input) would fail.
#
# use the content of the _build/p as filename component of the release ROOTDIR
#
$ for c in $(for x in $(seq 1 33) $(seq 35 46) $(seq 48 95) $(seq 97 127); do printf '%03o\n' $x; done); do printf \\$c ; done > ./_build/p
>= 0

$ mkdir -p "./_build/test/$(cat ./_build/p)"
>= 0

$tar -C "./_build/test/$(cat ./_build/p)" -xf ./_build/pathname_escape/rel/pathname_escape/pathname_escape-0.1.0.tar.gz

$ "./_build/test/$(cat ./_build/p)/bin/pathname_escape" daemon
>= 0

$ sleep 1
>= 0

$ "./_build/test/$(cat ./_build/p)/bin/pathname_escape" ping
>
pong
>= 0

$ "./_build/test/$(cat ./_build/p)/bin/pathname_escape" stop
>= 0
10 changes: 10 additions & 0 deletions shelltests/extended_start_script_tests/rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@
{overlay, [
{mkdir, "releases/{{release_version}}/config"},
{template, "config/included.config", "releases/{{release_version}}/config/included.config"}]}]}.

{profiles, [
{pathname_escape, [
{relx, [
{release, {pathname_escape, "0.1.0"}, [sasl]},
{sys_config, "config/pathname_escape.sys.config"},
{vm_args, "config/pathname_escape.vm.args"}]
}]
}]
}.

0 comments on commit 4baa294

Please sign in to comment.