diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2019-08-07 13:24:40 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2019-08-28 12:16:52 +0300 |
commit | 1fae42b65921ac5fcc61566ad50ad519f174e74e (patch) | |
tree | 19abb0c052a5baff1ac215f77b4c4f9fa403a06c | |
parent | 81b1db59f5fada4d726844977618bbfac4175d58 (diff) | |
download | rpm-1fae42b65921ac5fcc61566ad50ad519f174e74e.tar.gz |
Add a testcases for filenames with weird + invalid characters
Rpm itself has traditionally been able to handle pretty much anything
you throw at it, the surrounding scripts less so. Do a basic smoketest
that the scripts can handle what rpm can (the rules changed recently
in commit ee3126dd3d4ca609f254ac5d647c9ff3e413e9dd) and another test
to catch some invalid filenames.
(cherry picked from commit 4c3e3706e7eaf6a970f671b5e6ed8986d923fa8c)
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/data/SPECS/weirdnames.spec | 37 | ||||
-rw-r--r-- | tests/rpmbuild.at | 44 |
3 files changed, 82 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 166a4994b..baf9aacce 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -80,6 +80,7 @@ EXTRA_DIST += data/SPECS/test-subpackages.spec EXTRA_DIST += data/SPECS/test-subpackages-exclude.spec EXTRA_DIST += data/SPECS/test-subpackages-pathpostfixes.spec EXTRA_DIST += data/SPECS/vattrtest.spec +EXTRA_DIST += data/SPECS/weirdnames.spec EXTRA_DIST += data/SOURCES/buildrequires-1.0.tar.gz EXTRA_DIST += data/SOURCES/hello-1.0-modernize.patch EXTRA_DIST += data/SOURCES/hello-1.0-install.patch diff --git a/tests/data/SPECS/weirdnames.spec b/tests/data/SPECS/weirdnames.spec new file mode 100644 index 000000000..e241e4c26 --- /dev/null +++ b/tests/data/SPECS/weirdnames.spec @@ -0,0 +1,37 @@ +%bcond_with illegal + +Name: weirdnames +Version: 1.0 +Release: 1 +Summary: Testing weird filename behavior +License: GPL +BuildArch: noarch + +%description +%{summary} + +%install +mkdir -p %{buildroot}/opt +cd %{buildroot}/opt +touch "foo'ed" 'bar"ed' "just space" "\$talks" \ + "to?be" "the * are falling" '#nocomment' "(maybe)" \ + "perhaps;not" "true:false" "!absolutely" "&ground" \ + "after{all}" "index[this]" "equals=not" "tee|two" "~right" \ + "<namehere>" +%if %{with illegal} +touch "only time" +# the dependency generator cannot handle newlines in filenames +touch "new +line" + +%endif +for f in *; do + echo -e "#!/bin/ary\ndada\n" > ${f} +done +chmod a+x * + +# script.req fails on the backslash +touch "\.back" + +%files +/opt/* diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at index 88ff5e571..bf663843a 100644 --- a/tests/rpmbuild.at +++ b/tests/rpmbuild.at @@ -98,6 +98,50 @@ run rpmbuild \ ]) AT_CLEANUP +# weird filename survival test +AT_SETUP([rpmbuild package with weird filenames]) +AT_KEYWORDS([build]) +AT_CHECK([ +rm -rf ${TOPDIR} + +runroot rpmbuild -bb --quiet /data/SPECS/weirdnames.spec +runroot rpm -qpl /build/RPMS/noarch/weirdnames-1.0-1.noarch.rpm +], +[0], +[/opt/!absolutely +/opt/#nocomment +/opt/$talks +/opt/&ground +/opt/(maybe) +/opt/<namehere> +/opt/\.back +/opt/after{all} +/opt/bar"ed +/opt/equals=not +/opt/foo'ed +/opt/index[[this]] +/opt/just space +/opt/perhaps;not +/opt/tee|two +/opt/the * are falling +/opt/to?be +/opt/true:false +/opt/~right +], +[]) +AT_CLEANUP + +AT_SETUP([rpmbuild package with illegal filenames]) +AT_KEYWORDS([build]) +AT_CHECK([ +# XXX current output is not well suited for grab + compare, just ignore +runroot rpmbuild -bb --quiet --with illegal /data/SPECS/weirdnames.spec +], +[1], +[], +[ignore]) +AT_CLEANUP + # ------------------------------ # Check if tar build works # TODO: test that the rpms are actually created... |